IT notes

ssh rsa public key encryption

Encrypt a file using ssh public keys. Create ssh public key in PEM format: ssh-keygen -f -e -m PKCS8 > Use openssl to encrypt/decrypt Encrypt: openssl rsautl -encrypt -pubin -inkey ~/.ssh/ -ssl -in test.txt -out test.txt.enc Decrypt: openssl rsautl -decrypt -inkey ~/.ssh/id_rsa -in test.txt.enc -out test.txt.enc.txt


mosh (mobile shell) Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes. Mosh is a replacement for SSH. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links. How to install server FreeBSD: $ pkg install net/mosh Edit /etc/login.conf and add this to the default: :charset=UTF-8:\ :lang=en_US.UTF-8:\ :setenv=LC_COLLATE=C: After editing /etc/locing.conf run:

Port knocking

In computer networking, port knocking is a method of externally opening ports on a firewall by generating a connection attempt on a set of prespecified closed ports. Once a correct sequence of connection attempts is received, the firewall rules are dynamically modified to allow the host which sent the connection attempts to connect over specific port(s). For example, Using PF on FreeBSD to only open port 22 after X number of attempts to connect on port 1234: