CentOS 를 Windows의 Active Directory에 Join 시키기

|


출처 : http://social.technet.microsoft.com/wiki/contents/articles/25944.how-to-join-unix-linux-to-active-directory.aspx

          http://in-transit.me/data-center/ubuntu/active-directory-login/

          http://arstechnica.com/civis/viewtopic.php?f=16&t=1187287

          http://www.kiloroot.com/add-ubuntu-14-04-lts-server-to-a-windows-active-directory-domain-fullest-integration/

          http://www.golinuxhub.com/2014/05/how-to-configure-linux-client-to-join.html

          http://serverfault.com/questions/630746/pbis-open-ad-authentication-stops-working-on-ubuntu-with-errors-user-accout-ha




0. 사전 설치


CentOS 7 minimal 설치 및 준비


네트워크 설정. 특히 DNS 를 AD server로 두기

# nmcli c modify eth0 ipv4.dns 10.0.0.100


특별히 원하는 PC의 이름이 있다면 아래 파일을 수정하여 hostname을 변경하자.

# vi /etc/hostname

     cli.kanziw.com



필요 PKG 설치 및 업데이트

# yum install -y ntp wget; yum update -y

# systemctl enable ntpd; systemctl start ntpd





1. 방화벽 해제 및 SELinux 해제


# systemctl stop firewalld

# systemctl disable firewalld


# vi /etc/sysconfig/selinux

      7 SELINUX=disabled


SELinux 는 재시작 해야 풀린다.

# reboot





2. 프로그램 다운로드


http://download1.beyondtrust.com/Technical-Support/Downloads/PowerBroker-Identity-Services-Open-Edition/?Pass=True


위 페이지에 방문하여 자신의 OS 및 커널에 맞는 프로그램 다운로드 주소 복사하여 리눅스에 다운로드

# wget http://download.beyondtrust.com/PBISO/8.2.1/linux.rpm.x64/pbis-open-8.2.1.2979.linux.x86_64.rpm.sh


다운로드 한 파일에 실행 권한 부여

# chmod +x pbis-open-8.2.1.2979.linux.x86_64.rpm.sh





3. 설치


실행 권한 부연받은 스크립트 실행


# ./pbis-open-8.2.1.2979.linux.x86_64.rpm.sh


Creating directory pbis-open-8.2.1.2979.linux.x86_64.rpm

Verifying archive integrity... All good.

Uncompressing pbis-open-8.2.1.2979.linux.x86_64.rpm............

Would you like to install package for legacy links? (i.e.  /opt/likewise/bin/lw-find-user-by-name -> /opt/pbis/bin/find-user-by-name) (yes/no) yes

Would you like to install now? (yes/no) yes

Installing packages and old packages will be removed


                   .  .  .                 


Installing Packages was successful


New libraries and configurations have been installed for PAM and NSS.

Please reboot so that all processes pick up the new versions.


As root, run domainjoin-gui or domainjoin-cli to join a domain so you can log on

with Active Directory credentials. Example:

domainjoin-cli join MYDOMAIN.COM MyJoinAccount





4. Join


AD 의 도메인 및 Join 시 사용할 계정 명을 옵션으로 줘서 Join


# domainjoin-cli join kanziw.com administrator

Joining to AD Domain:   kanziw.com

With Computer DNS Name: cli.kanziw.com


administrator@KANZIW.COM's password:

Warning: System restart required

Your system has been configured to authenticate to Active Directory for the

first time.  It is recommended that you restart your system to ensure that all

applications recognize the new settings.


SUCCESS



계정들이 사용할 기본 쉘을 /bin/bash 로 변경

# /opt/pbis/bin/config LoginShellTemplate /bin/bash


Active Directory의 계정들이 CentOS 의 기본 도메인이 되도록 설정

# /opt/pbis/bin/config AssumeDefaultDomain true


Active Directory의 계정들이 sudo 명령어 사용할 수 있도록 하는 설정

그룹에 제한을 두고 싶으면 AD에서 따로 그룹을 만들어 진한 부분을 해당 그룹 명으로 바꿔주면 된다.

# echo "%domain^admins ALL=(ALL) ALL" >> /etc/sudoers




재부팅 하면 끗. 이제 AD의 계정으로 로그인이 가능하다..!

# reboot



login as: administrator

Using keyboard-interactive authentication.

Password:

[administrator@cent7 ~]$



이제 리눅스의 모든 로컬 계정을 삭제한 뒤 AD 계정만 살리고

각 계정별로 로그인 가능/불가 등의 정책과, 리눅스 상에서 계정별 명령어의 제약을 두어 사용하게 하면 될듯 싶다.



[Tip]


1) domain^admins : Active Directory 의 관리자 그룹

2) domain^users : Acive Directory 의 일반 유저 그룹

3) AD에서 추가하는 그룹은 Linux에도 반영된다.

4) Linux의 Local 계정과 AD의 계정을 다시 구분지어 표시하고 싶으면 아래 명령어를 사용하면 된다.

# /opt/pbis/bin/config UserDomainPrefix domain_name

이렇게 되면 AD의 계정 혹은 그룹을 표시할 때 domain_name\user_name 이라 해야 한다.

5) AD 의 계정 정보 확인

# /opt/pbis/bin/find-user-by-name domain_name\user_name

6) 고급 사용자용 설정 명령어 확인

# /opt/pbis/bin/config --dump

7) AD 연동 - LSA Server 관련 정보 확인

# /opt/pbis/bin/get-status

8) 기타 정보 확인

# /opt/pbis/bin/find-objects --help

ex) # /opt/pbis/bin/find-objects --user USERNAME

# vi /etc/pbis/pbis-krb5-ad.conf





[부족한 점]


1) AD 와의 연결이 끊어진 상태에서 로그인 불가 - Local계정 모두 삭제 및 Root로의 SSH 연결 막았다면 원격지에서 리눅스 이용 불가.

2) 계정 로그인 보안이 어떤 방식을 쓰는지 잘 모른다. Kerberos 를 사용하려나..?

    로그인 시 Using keyboard-interactive authentication. 라고 뜨는데 이 것은 어떤 의미를 담고 있을 지도 알아봐야 한다.

3) AD의 강력한 기능인 GPO는 거의 무용지물. 서버 내에서 GPO로 리눅스는 관리가 되지 않는다.


물론 이러한 개선점들은 유료 프로그램에서 지원해준다고 하긴 한다..ㅎㅎㅎㅎ




And