Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key files named as dot files do not get locked or unlocked #25

Open
aniqueta opened this issue Jul 25, 2021 · 2 comments
Open

Key files named as dot files do not get locked or unlocked #25

aniqueta opened this issue Jul 25, 2021 · 2 comments

Comments

@aniqueta
Copy link

Thanks for the useful (and well thought out) tool.

Key files are named per the originating script. If the user has named that script as a dot file, encpass.sh will name the key file as such. When using the lock and unlock function, they do not match dot files. A quick fix that worked for me was to add shopt -s dotglob to the top of the encpass.sh script. There are probably better ways to do this.

@ahnick
Copy link
Collaborator

ahnick commented Jul 25, 2021

Thanks for reporting this issue @aniqueta and I'm glad you are finding encpass.sh useful.

The main problem around supporting dot files will be trying to do it in a POSIX compliant way and supporting as many legacy shell versions as possible. The shopt solution, while a good one for Bash, unfortunately is not available in other shells. The other thing to note is that this affects not just the locking or unlocking of the key files, but other commands such as listing the buckets/secrets.

One solution may be to introduce the -A option in places where encpass.sh reads the contents of the "keys" and "secrets" directories. I'm exploring this option, but it does not work as I would expect with the -d option (listing just directories), which means that additional changes would need to be introduced in places where that option is currently used. Also, I'm not entirely certain "ls" is the most robust way to handle the reading of these directories. It may be better to switch to the find command. Find apparently was introduced in Version 5 of Unix (https://en.wikipedia.org/wiki/Find_(Unix)#History), so while not as old as "ls" I doubt anyone using encpass.sh is probably using a Unix older than version 5.

In any case, it will take a bit of time to think through the proper solution and weigh potential trade offs with various approaches, but I think supporting hidden scripts for use with encpass.sh should be implemented.

@aniqueta
Copy link
Author

Makes sense. In one of my cases, I'm using macOS with zsh, and shopt -s dotglob normally does not work. Since encpass.sh starts with #!/bin/sh the shell interpreter changes and shopt -s dotglob does work. For zsh, there are also other ways to mimic the shopt command, such as: Zshopt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants