4 ms·
Show HN: Shell utility to encrypt a file into a self-decrypting script
- soconfused1 11y agoWhy would not just use a asymmetric crypto and just use the public key to encrypt files for automated back ups without needing a password? Seems like a lot of work to produce something with less security.
- deleted 11y ago[deleted]
- calebm 11y agoNice! I actually did a similar project which is a web app to encrypt files which produces self-decrypting html files: https://hypervault.github.io/ https://hypervault.github.io/
- sly010 11y agoI was thinking about the same tool not long ago. It could be a way to include simple secrets in your configuration/deploy scripts without having to add an extra dependency on some arbitrary "vault" tool. OpenSSL is available everywhere.
- jjnoakes 11y agoExcept you need to type in the password to decrypt. So it still requires either storing that new secret (the password) somewhere (which defeats the purpose of using this technique to guard your secrets), or you need a human (which defeats the purpose of automated deployments).
- dreamlayers 11y agoI don't like the idea of needing to execute a file to decrypt it. That could be abused by someone, adding malicious code to the decryption code. Of course you could inspect the file, but that's extra work which many people won't bother with. I guess what's really needed is a simple encrypted format that's easy to decrypt without needing to worry about command line arguments. For example, people are generally satisfied with .tar.* formats and not looking for self extracting compressed formats.
- vbezhenar 11y agoThanks, that's a very reasonable suggestion. It's easy to add --decrypt option to the main tool, so it'll decrypt encrypted archive without executing anything. I'll implement it.
- yo-code-sucks 11y agoWhy wouldnt I just pipe tar to pgp?
- deleted 11y ago[deleted]
- jrcii 11y ago> without needing to worry about command line arguments. For example, people are generally satisfied with .tar. I have to google the extract arguments for tar every single time I use it. What was it again, -xfv?
- ivanhoe 11y agoSorry for offtopic, but I find it strange that so many people find it hard to remember, it's just: e(x)tract, be (v)erbose and use (f)ile. If it was gzipped add -z. If you're compressing the file use -c (for compress) instead of -x. To me it was one of the easier commands to memorize...
- jagger27 11y agoA few extra tips for tar: -xvf is sufficient even if the archive is compressed The dash is optional as well. tar xvf archive.tar.gz works just fine.
- brbsix 11y agoRight near the top of `tar --help`: tar -xf archive.tar # Extract all files from archive.tar. If you work with lots of different types of archives or have a hard time remembering the various tools and arguments, I recommend dtrx (Do The Right Extraction). Super simple and it ensures you don't accidentally dump a whole directory tree somewhere it shouldn't. Assuming you have pip and hg installed, you can install the latest version to your user site with the following command: pip2 install --user hg+http://www.brettcsmith.org/2007/dtrx/dtrx Then all you have to remember is `dtrx ARCHIVE...`
- Freaky 11y agoNeeds a digital signature to verify that neither the data nor the code to decrypt it has been modified. .. and that signature can't really be verified by unverified code.
- vbezhenar 11y agoYes, encrypted file includes unencrypted public key (even if it doesn't need it to decrypt) and it means that anyone who has access to the encrypted file, can produce another encrypted file with the same key. I wanted it to be very simple to use, but probably I'll reconsider that.
- wkoszek 11y agoIt looks useful, especially for sharing something confidential with people who aren't fluent in Terminal (e.g.: "pick what I've sent you, copy to Desktop and execute"). Would be nice to get it packaged via brew/apt-get.
- discreditable 11y agoHow is this better than using gpg in symmetric mode, perhaps with its own wrapper?
- tptacek 11y agoIt's not; it's worse than using GPG in symmetric mode.
- vbezhenar 11y agoEncryption scheme is similar or identical, AFAIK. GPG requires a little bit of manual setup and you need not to forget to include key with the encrypted file. And, of course, to install GPG when you need to decrypt. I wanted to be able to decrypt the file on any system without any additional dependencies (except OpenSSL, of course).
- peterwwillis 11y agoHere's one I wrote a while back that has its own RC4 routine in Perl, so no external dependencies needed. https://github.com/psypete/public-bin/blob/public-bin/src/system/encsh.pl https://github.com/psypete/public-bin/blob/public-bin/src/sy...
- tptacek 11y agoDon't ever use RC4.
- peterwwillis 11y agoCan you show any reasonable case where encrypting a small file once would be unsafe with RC4? Maybe if you had 74 million such files...
- kkl 11y agoThere are known biases throughout RC4 output. There are really bad biases towards the beginning. A small file would likely be XOR'd with certain bytes or patterns of bytes. If this is not exploitable in your hypothetical scenario, it maybe exploitable in others. I think this is generally unsafe.