armor-ssh
Secure SSH server by disabling password authentication
Purpose
This cube hardens your SSH server configuration by disabling less secure authentication methods, enforcing SSH key-based authentication only.
Why Disable Password Authentication?
Password-based SSH authentication is vulnerable to:
- Brute-force attacks: Automated scripts trying millions of password combinations
- Dictionary attacks: Guessing common passwords
- Credential stuffing: Using leaked passwords from other breaches
- Weak passwords: Users choosing easily guessable passwords
SSH key authentication is more secure because:
- Keys are cryptographically strong (2048+ bit keys vs 8-12 character passwords)
- Private keys never travel over the network
- Immune to brute-force attacks
- Can be protected with passphrases for additional security
What This Cube Does
-
Disables challenge-response authentication
- Prevents keyboard-interactive authentication prompts
-
Optionally disables password authentication (default: enabled)
- Forces users to authenticate with SSH keys only
- Prevents password-based login attempts
-
Optionally disables PAM (Pluggable Authentication Modules)
- Disables PAM-based authentication methods
- Reduces attack surface
-
Restarts SSH service
- Applies the new configuration immediately
Configuration
Parameters
-
DISABLE_PASSWORD (boolean, default:
true)- Disable password authentication for SSH connections
- ⚠️ WARNING: Ensure you have SSH key access configured before enabling this!
-
DISABLE_PAM (boolean, default:
true)- Disable PAM (Pluggable Authentication Modules) for SSH
- Recommended for key-only authentication setups
Dependencies
None - this cube can run standalone.
Security Best Practices
Before deploying this cube:
- Ensure you have SSH key authentication set up and tested
- Keep an alternative access method available (console access, VNC, etc.)
- Test SSH key login before disabling passwords
- Consider using the
user-addorssh-keymancubes first
After deployment:
- Only SSH key authentication will work
- Password login attempts will be rejected
- Make sure to back up your private SSH key securely
Post-Installation
The SSH service will restart automatically. Your current SSH session will remain active, but new connections must use SSH keys.
To verify the configuration:
sudo grep -E "PasswordAuthentication|ChallengeResponseAuthentication|UsePAM" /etc/ssh/sshd_config
Recovery
If you get locked out:
- Access the server via console (physical or cloud provider's web console)
- Edit
/etc/ssh/sshd_config - Set
PasswordAuthentication yes - Restart SSH:
sudo systemctl restart ssh