SSH Server
- A few basic changes to /etc/ssh/sshd_config
- Disable Root Login:
PermitRootLogin no
Only use Protocol 2:
Protocol 2
Disable Password Authentication:
PasswordAuthentication no
Limit Crypto Options:
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,
aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,
hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,
hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
SSH 2FA Continued
- Install Google Authenticator from distro package (libpam-google-authenticator) or from source
- Enroll each user account:
$ google-authenticator
Scan QR code or add secret to Google Auth app
Add to top of /etc/pam.d/sshd:
auth required pam_google_authenticator.so
On Debian-based systems comment out:
@include common-auth
Change /etc/ssh/sshd_config:
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
Restart ssh service
Login:
$ ssh kyle@server1.example.com
Authenticated with partial success.
Verification code:
Reuse Puppet Certs
- If you use Puppet Masters, you have internal trusted CA
- Makes internal mutual TLS auth much simpler
- Each host has cert, key, CA cert locally:
CERT: /var/lib/puppet/ssl/certs/${cert_name}.pem
KEY: /var/lib/puppet/ssl/private_keys/${cert_name}.pem
CA: /var/lib/puppet/ssl/certs/ca.pem
CRL: /var/lib/puppet/ssl/crl.pem
To use in NGINX:
ssl_certificate /var/lib/puppet/ssl/certs/${cert_name}.pem;
ssl_certificate_key /var/lib/puppet/ssl/private_keys/${cert_name}.pem;
ssl_client_certificate /var/lib/puppet/ssl/certs/ca.pem;
ssl_crl /var/lib/puppet/ssl/crl.pem;
Can add Subject Alt Names to Puppet certs with dns_alt_names option.