Security Cheatsheet
Essential security commands and best practices for SSL/TLS, SSH, encryption, and network security. Keep your systems and data protected.
SSL/TLS
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodesGenerate self-signed SSL certificate
openssl x509 -in cert.pem -text -nooutView certificate details
openssl s_client -connect example.com:443Test SSL connection
openssl verify cert.pemVerify certificate
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crtConvert certificate to PKCS#12 format
SSH
ssh-keygen -t ed25519 -C "your_email@example.com"Generate SSH key pair
ssh-copy-id user@remote_hostCopy SSH key to remote server
ssh -i /path/to/private_key user@remote_hostConnect using specific private key
ssh -L 8080:localhost:80 user@remote_hostCreate SSH tunnel
ssh -D 8080 user@remote_hostCreate SOCKS proxy
Password Management
openssl rand -base64 32Generate secure random password
echo -n 'password' | openssl dgst -sha256Generate SHA-256 hash
echo -n 'password' | openssl dgst -sha512Generate SHA-512 hash
openssl passwd -1 'password'Generate MD5 password hash
openssl rand -hex 16Generate random hex string
Network Security
nmap -sV -p- <target>Scan all ports and detect versions
nmap -sS -p 80,443 <target>TCP SYN scan specific ports
nmap -sU -p 53,123 <target>UDP scan specific ports
nmap -A -T4 <target>Aggressive scan with timing
nmap --script ssl-cert <target>Check SSL certificate
File Encryption
gpg --gen-keyGenerate GPG key pair
gpg --encrypt --recipient user@example.com file.txtEncrypt file for specific recipient
gpg --decrypt file.txt.gpgDecrypt GPG encrypted file
gpg --export --armor user@example.com > public.keyExport public key
gpg --import public.keyImport public key
Security Tools
curl -I https://example.comCheck security headers
openssl s_client -connect example.com:443 -servername example.comCheck SSL/TLS configuration
dig +short TXT _dmarc.example.comCheck DMARC record
dig +short MX example.comCheck MX records
dig +short TXT example.comCheck TXT records