A list of commands I’ve used over the years.
I tend to forget that the default configuration files for packages (if distributed) are in /etc/config
and that I should update those, as the /init.d
scripts pull the defaults and generate files each run.
Nothing better than spending the weekend trying to make your printer work with macOS. HP LaserJet 1018 isn’t officially supported, and I always forget what I did last time…
Not anymore!
If there is one thing Windows does better, it’s drivers! I don’t even recall when was the last time I’ve plugged something that Windows wasn’t able to detect.
GPG is an awesome open-source cryptographic library. One of it’s uses is data encryption. Most of us use file-hosting services like Dropbox, and some of us keep confident stuff in there like passwords, 2FA recovery keys, or CC info. I won’t argue that this is a bad idea, since it’s pretty convenient, but only if the files are properly protected.
The example below uses a folder, and since gpg
can be used on a single file only, we archive the folder, and pass it to gpg
. For decryption, it goes in reverse order, decrypt then extract. If you want to encrypt a single file, just remove the tar
pipes.
Encryption:
tar -cz 2FA/ | gpg --s2k-mode 3 --s2k-count 65011712 --s2k-digest-algo SHA512 --s2k-cipher-algo AES256 --compression-algo BZIP2 -co encrypted_file
Decryption:
gpg -d encrypted_file | tar -zx
Explanation of options:
--symmetric (-c)
to encrypt a file with a passphrase. Symmetric here means the same passphrase is used for both encryption and decryption.--output (-o)
to specify the output file.--compression-algo
to specify the compression algorithm for the output file.--s2k-cipher-algo
to specify the symmetric cipher algorithm used to actually encrypt the message.--s2k-digest-algo
to specify the digest algorithm used for hashing passphrases in various operations (e.g., the symmetric passphrase specified when using -c
).--s2k-mode
to choose how the passphrases for symmetric encryption are mangled.--s2k-count
to specify how many times the passphrases mangling for symmetric encryption is repeated.--decrypt (-d)
to decrypt an encrypted file.To get a list of supported algorithms, use gpg --version
.
I wanted to setup a router for VPN. Use the WAN port to connect it to my main router to get internet access (DHCP), and then connect the router using PPTP to a VPN Server. For some reason I had trouble setting the firewall on my main router to properly handle it. Ended up installing this package, and it worked like a charm:
opkg install kmod-nf-nathelper-extra