Dalam tutorial ini, kita akan membahas bagaimana mengintegrasikan Server Linux (Centos/RHEL) dengan Windows Active Directory untuk tujuan otentikasi. Dalam kasus saya, saya memiliki server Centos/RHEL 6. Ikuti langkah-langkah di bawah ini untuk mengintegrasikan server ini dengan AD menggunakan samba, winbind, dan Kerberos.
Langkah 1 :Instal paket samba-winbind dan kerberos.
# yum install samba-winbind samba-winbind-clients samba krb5-libs krb5-workstation pam_krb5
Langkah 2 :Sinkronisasi waktu.
AD sangat pilih-pilih tentang waktu yang cocok selama otentikasi. Jadi server linux dan waktu server AD harus disinkronkan ke server ntp. Gunakan perintah di bawah ini untuk menyinkronkan waktu server Linux dengan server ntp.
# ntpdate [ntp-server-ip-address/dns-name]
Untuk membuat konfigurasi di atas permanen, edit file “/etc/ntp.conf” dan ganti saja yang ada dengan satu atau lebih server NTP di domain Anda, seperti:
# vi /etc/ntp.conf server [ntp-server-ip-address/dns-name]
Mulai Layanan:
# /etc/init.d/ntpd start # chkconfig ntpd on
Langkah 3 :Edit file /etc/hosts.
# vi /etc/hosts [ip-address] adserver.yourdomain adserver
Langkah 4 :Edit /etc/krb5.conf.
# vi /etc/krb5.conf
[domain_realm]
yourdomain = YOURDOMAIN
[libdefaults]
ticket_lifetime = 24000
default_realm = YOURDOMAIN
dns_lookup_realm = true
dns_lookup_kdc = false
cache_type = 1
forwardable = true
proxiable = true
default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
permitted_enctypes = des3-hmac-sha1 des-cbc-crc
allow_weak_crypto = no
[realms]
YOURDOMAIN = {
kdc = [ip address of AD server:Port]
admin_server = [ip address of AD server:Port]
default_domain = yourdomain
} [appdefaults]
pam = {
debug = true
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
[logging]
default = FILE:/var/krb5/kdc.log
kdc = FILE:/var/krb5/kdc.log
admin_server = FILE:/var/log/kadmind.log Langkah 5 :Sekarang Uji Otentikasi Kerberos.
# kinit [user-name]
Jika diminta kata sandi, masukkan kata sandi iklan pengguna Anda, jika semuanya baik-baik saja, maka kita akan mendapatkan perintah jika tidak, periksa kembali file krb5.conf.
Langkah 6 :Sekarang Konfigurasi Samba dan Winbind.
Edit /etc/samba/smb.conf .
# vi /etc/samba/smb.conf
[global]
workgroup = [Workgroup-Name]
netbios name = site2 ## replace the site2 with hostname
realm =
security = ADS
template shell = /bin/bash
idmap backend = tdb
idmap uid = 1-100000000
idmap gid = 1-100000000
winbind use default domain = Yes
winbind nested groups = Yes
winbind enum users = Yes
winbind enum groups = Yes
template shell = /bin/bash
template homedir = /home/%D/%U
winbind separator = /
winbind nss info = sfu
winbind offline logon = true
hosts allow = 127.0.0.1 0.0.0.0/0
obey pam restrictions = yes
socket options = TCP_NODELAY
max log size = 150
passdb backend = tdbsam
printing = cups
load printers = yes
cups options = raw
printcap name = cups
disable spoolss = Yes
show add printer wizard = No
interfaces = eth0 lo
bind interfaces only = yes
winbind refresh tickets = true
log file = /var/log/samba/log.%m
max log size = 50
log level = 3
encrypt passwords = yes
#map untrusted to domain = yes
#auth methods = winbind guest sam
map untrusted to domain = Yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
public = yes
guest ok = yes
writable = no
printable = yes Langkah 7 :Konfigurasi /etc/nsswitch.conf file untuk menangani otentikasi.
# vi /etc/nsswitch.conf passwd: compat winbind shadow: winbind group: compat winbind
Langkah 8 :Sekarang restart layanan winbind &Samba.
# /etc/init.d/smb restart # /etc/init.d/winbind restart
Sekarang bergabunglah dengan domain:
# net ads join -U [User Name]
Jika perintah di atas melaporkan “Join is OK”, maka uji winbind:
Perintah untuk mencantumkan semua pengguna AD:
# wbinfo -u
Langkah 9 :Sekarang lakukan pengujian &coba login ke server linux melalui kredensial pengguna AD.
# ssh [username]@[ipaddress or hostname of linux server]