~/blog/mengamankan-ssh-dengan-google-authenticator-opensuse-leap-15

Mengamankan SSH dengan Google Authenticator – openSUSE Leap 15

1 min read Linux

Bagi saya, akses SSH ke Jump server, Jump host atau Jumpbox menggunakan _Public Key _adalah mandatori, kali ini saya akan menambahkan Multi-factor Authentication (MFA) untuk akses SSH ke Jump server saya. Berikut langkah-langkahnya:

  1. Pasang Repositori
zypper addrepo https://download.opensuse.org/repositories/security/openSUSE_Leap_15.0/security.repo
zypper refresh
  1. Pasang paket Google Authenticator
zypper install -y pam-google-authenticator
  1. Jalankan Google Authenticator
google-authenticator

Scan barcode atau masukan Your new secret key ke aplikasi Google Authenticator

  1. Sunting berkas Konfigurasi SSH
vim /etc/ssh/sshd_config

ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
  1. Disable common-auth dan tambahkan auth google
vim /etc/pam.d/sshd

#@include common-auth
auth required pam_google_authenticator.so
  1. Muat ulang layanan SSH
systemctl restart sshd
systemctl status sshd
  1. Ujicoba SSH ke Jump server
ssh -l ary gateway.aryulianto.com -p2222
Authenticated with partial success.
Verification code:

Sekarang kalian akan dimintai kode Google Authenticator setiap kali Anda mencoba masuk melalui SSH.

Sekian dan Terima kasih