파트1까지 했다면 "getent passwd"로 AD의 사용자 목록까지 포함한 사용자 목록을 볼 수 있을 것이다. 또한 "getent group"으로는 AD에 유닉스 그룹 속성을 준 그룹까지도 볼 수 있다. 기쁘게도, root로서 "su - 사용자ID" 명령을 치면 그 사용자로 간접 로그인까지 할 수 있을 것이다. (없는 id로 su를 시도하면 id가 존재하지 않는다면서 되지도 않음. ID인식이 잘 되었다는 소리다!)
하지만, AD의 ID로 직접 로그인 하는 것은 아직 되지 않을 것이다.
왜냐...
"Authenticate"되지 않았기 때문이다.
이 부분은 케르베로스를 이용하게 된다.
컨닝교재는 역시 Winbind를 거치지 않는 아래 것이 되겠다.
$ sudo apt-get install heimdal-clients libpam-heimdal
로 케르베로스를 설치한다.
/etc/krb5.conf를 수정
[libdefaults] 에서는
default_realm을 적절히 수정한다.
[realms]에서는 쓸데없는것을 없애버리고 우리의 도메인만 넣어준다.
[domain_realm]도 적절히 수정...
[libdefaults]
default_realm = EXAMPLE.COM
[realms]
EXAMPLE.COM = {
kdc = 10.30.2.2:88
}
[domain_realm]
.example.com = EXAMPLE.COM
example.com = EXAMPLE.COM
(krb5.conf는 너무 길어서 첨부해두겠다.)
이번엔 PAM모듈을 설정할 차례.
/etc/pam.d/common-auth를 고쳤다.
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth sufficient pam_unix.so nullok_secure
auth sufficient pam_krb5.so ignore_root use_first_pass
(pam_krb5.so를 쓸때에는 root라는 ID는 무시하고, 위의 유닉스 비번을 쳤을 때의 비번을 그대로 적용해보라는 뜻이다.)
/etc/pam.d/common-session을 수정
#
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of sessions of *any* kind (both interactive and
# non-interactive). The default is pam_unix.
#
session required pam_unix.so
session optional pam_foreground.so
session optional pam_krb5.so
session required pam_mkhomedir.so umask=0022 skel=/etc/skel(홈디렉토리 자동 생성)
주의: 아무리 자동 홈디렉토리 생성옵션을 켜놓아도,
/home/2005/user1
/home/2006/user2
이런식으로, home밑에 다중으로 된 하위디렉토리를 생성해야 하는 경우,
2005가 디렉토리가 미리 만들어져있지 않으면 user1은 로그인할 수 없다는 것!
root조차도 su - 할 수 없다고 한다. (permission denied)
/etc/pam.d/common-account를 수정.
#
# /etc/pam.d/common-account - authorization settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authorization modules that define
# the central access policy for use on the system. The default is to
# only deny service to users whose accounts are expired in /etc/shadow.
#
account required pam_unix.so
account [default=bad success=ok user_unknown=ignore service_err=ignore system_err=ignore] pam_krb5.so
와하하하 성공 -_-!!!!!!!!!!!!!!!!!
로컬계정의 로그인과 비교해볼 땐 느리다.
-------------------------------------------
벗뜨... AD ID로 로그인은 콘솔상에서만 된다 으윽...
왜냐.... ssh에서 kerberos를 쓰겠다고 하지 않았기 때문.
/etc/ssh/sshd_config를 수정한다.
# Kerberos options
KerberosAuthentication yes
# KerberosGetAFSToken no
KerberosOrLocalPasswd yes
KerberosTicketCleanup yes
4개가 있는데 그 중 3개를 코멘트 해제하고, 첫번재 것은 yes로 수정.
-------------------------------------------
이번엔 또 뭐가 문제인고 하니... passwd로 비번 변경을 할 수 없다는 것이다 -_-;
/etc/pam.d/common-password파일을 수정해서
password sufficientpam_unix.so nullok obscure min=4 max=8 md5
password required pam_krb5.so minimum_uid=1000
이런 내용으로 변경했다.
이런 설정은.....
-로컬계정의 비번을 변경한다.
-로컬계정이 존재하지 않지만 kerberos사용자가 존재하면 그 비번을 변경한다.
AD계정과 로컬의 /etc/passwd계정이 완전 분리되어있다는 전제하에 구상된 시스템이다.
*kerberos가 먼저 오게 하고 싶지만 안타깝게도 pam_krb5.so가 원하는대로 동작하지 않더군..;
-------------------------------------------
passwd 트러블슈팅
passwd: Authentication token manipulation error
윈도우가 아니라 이런 불칱절한 메시지가 뜨는 것이다. AD정책때문이다.
1. 비번의 복잡성을 만족하지 못한 경우.
2. 비번을 너무 자주 바꾼 경우 (디폴트로 하루에 한 번만 바꿀 수 있다.)
3. 비번을 중복해서 바꾼 경우 (디폴트로 이전 27개는 AD에 저장되어있다.)
결론: 비번을 바꿀 수는 있는데 좀 더 친절하게 설명해주는 윈도우 쪽에서 바꾸는게 낫다?