Port Modules/Security/secharden-2fa.sh. Configures TOTP two-factor authentication via Google Authenticator for: - SSH (publickey + keyboard-interactive) - Cockpit web interface (PAM with Google Authenticator) - Webmin (if installed, TOTP provider enabled) Includes: - Backup of existing SSH, PAM, and Cockpit configs before changes - PAM sshd and cockpit config deployment - Per-user enrollment scaffolding (setup script + instructions for root and localuser) - SSH service validation before restart 🤖 Generated with [Crush](https://github.com/charmassociates/crush) Assisted-by: GLM-5 via Crush <crush@charm.land>
11 lines
448 B
Bash
11 lines
448 B
Bash
#!/bin/bash
|
|
# Per-user 2FA enrollment helper, generated by KNELIAC.
|
|
echo "Setting up Google Authenticator for user: $USER"
|
|
echo "Please follow the prompts to configure 2FA:"
|
|
echo "1. Answer 'y' to update your time-based token"
|
|
echo "2. Scan the QR code with your authenticator app"
|
|
echo "3. Save the backup codes in a secure location"
|
|
echo "4. Answer 'y' to the remaining questions for security"
|
|
echo ""
|
|
google-authenticator -t -d -f -r 3 -R 30 -W
|