C.W.K.
Stream
Lesson 06 of 12 · published

키 기반 인증

~15 min · authentication, passwords, audit, revocation

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

Password 인증이 가야 하는 이유

Password 인증은 키 인증보다 다섯 가지 구체적인 면에서 근본적으로 약해:

  • Guessable — 강한 password 도 brute-force 가능. ed25519 키는 2^256 가능성 — 우주가 먼저 열사망.
  • Phishable — 가짜 서버 만들어서 password 수확 가능. 키는 서버도 검증 (known_hosts 통해).
  • 재사용 — 사람은 password 재사용. 한 번 leak, 여러 번 침해.
  • 전송됨 — Password (암호화돼도) 가 매 로그인마다 네트워크 건너. Private key 는 절대 안 건너.
  • 장치별 감사 불가 — Password 는 password. 키는 장치마다 authorized_keys 의 고유 줄.

authorized_keys 감사

authorized_keys 를 손님 명단처럼 다뤄. 모든 줄이 식별 가능한 주인의 키여야 함. 줄 끝 comment 가 유일한 감사 흔적 — 명확한 comment 가 빠른 revocation 을 의미.

Code

감사하고 권한 박탈·bash
# On the server, see the guest list
cat ~/.ssh/authorized_keys
# Each line:
#   ssh-ed25519 AAAA...abc you_username@macbook-2024
#   ssh-ed25519 AAAA...def you_username@office-mac
#   ssh-ed25519 AAAA...ghi you_username@retired-laptop  ← revoke me

# Revoke a single device — remove its line
sed -i.bak '/retired-laptop/d' ~/.ssh/authorized_keys

# See the fingerprint of every line (cleaner audit)
ssh-keygen -l -f ~/.ssh/authorized_keys
키 전용 인증 강제 (Track 8 미리보기)·bash
# /etc/ssh/sshd_config (server-side)
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes

# Restart sshd (Linux)
sudo systemctl restart sshd
# macOS — toggle Remote Login off/on in System Settings

External links

Exercise

SSH 가능한 아무 서버에서 ssh-keygen -l -f ~/.ssh/authorized_keys 돌려서 모든 키 나열. 각 줄마다 — comment 에서 장치 식별 가능해? "user@host" 만 있거나 comment 없으면 미래 감사 두통. 보너스 — 약한 comment 있는 키들 재생성하고 항목 교체.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.