Google OTP를 설치하는 방법
google-authenticator 패키지 설치
$ yum install -y google-authenticator
Google Authenticator 인증 파일 생성(QR Code 생성)
$ google-authenticator -s ~/.ssh/google_authenticator
Do you want authentication tokens to be time-based (y/n) y
Do you want me to update your "/home/ec2-user/.ssh/google_authenticator" file? (y/n) y
Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y
By default, a new token is generated every 30 seconds by the mobile app.
In order to compensate for possible time-skew between the client and the server,
we allow an extra token before and after the current time. This allows for a
time skew of up to 30 seconds between authentication server and client. If you
experience problems with poor time synchronization, you can increase the window
from its default size of 3 permitted codes (one previous code, the current
code, the next code) to 17 permitted codes (the 8 previous codes, the current
code, and the 8 next codes). This will permit for a time skew of up to 4 minutes
between client and server.
Do you want to do so? (y/n) n
If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting? (y/n) y
ssh 서버의 설정 파일(sshd_config 편집)
$ vim /etc/ssh/sshd_config
...
PermitEmptyPasswords no
PasswordAuthentication no
ChallengeResponseAuthentication yes
UsePAM yes
AuthenticationMethods publickey,password publickey,keyboard-interactive
SSH 인증을 위한 PAM 모듈 설정(sshd 편집)
$ vim /etc/pam.d/sshd
#%PAM-1.0
auth required pam_sepermit.so
#auth substack password-auth
auth include postlogin
### Google Authenticator(Google OTP) ###
auth required pam_google_authenticator.so secret=/home/${USER}/.ssh/google_authenticator nullok
...
sshd 데몬(서비스) 재기동
$ systemctl restart sshd
SecureCRT 설정
Connection > SSH2 > Authentication
- Keyboard Interactive
- PublicKey
SecureCRT SSH 접속
OTP 코드 입력
'리눅스' 카테고리의 다른 글
[리눅스] 우분투 기본 설정 (0) | 2022.04.21 |
---|---|
[리눅스] gitlab runner 설치 및 실행하기 (0) | 2022.04.14 |
[리눅스] 서비스(데몬) 등록 방법 (0) | 2022.04.06 |
로컬 IP 및 공개 IP 찾는 방법(myip) (0) | 2022.04.06 |
우분투에서 sudo를 비밀번호 없이 사용하는 방법 (0) | 2022.04.01 |