I think I might be losing my mind. At work a colleague asked me for instructions on how to join a RHEL6 box to a windows domain and I just pointed him to my blog, but he could not find the post I had in mind, because it looks as if I've not actually posted it, so here it goes:
- Ensure that name resolution is working. At the very least you should be able to ping your domain controller, in my case mars.dev.com. If you can't, have a look at your /etc/resolv.conf file. Sample file:
search dev.com test.com
nameserver 10.168.20.203 - Depending on your installation type, you might have to install several of the packages below (It looks like I went for a base install only):
yum install pam_krb5 pam_ldap nss-pam-ldapd samba policycoreutils-python -y
- Run authconfig-tui. Make sure that Kerberos realm is in capitals:
- Ensure that Name Service Switch is configured for ldap authentication. In essence, check that /etc/nsswitch.conf has the following values:
- Edit the local LDAP name service daemon configuration (/etc/nslcd.conf). A bind account to the Active Directory is needed, so create that account now (I have created binding in the Users OU). The mappings (for Microsoft Service for unix 3.5) need to be modified. Below is a list of changes to /etc/nslcd.conf:
- Change permissions on /etc/nslcd.conf file so that it is only readable by root:
chmod 600 /etc/nslcd.conf
- Ensure that the local LDAP name service daemon (nslcd) is set to start with the server:
chkconfig nslcd on
- Edit /etc/samba/smb.conf. Make sure that there is only a security directive active. Comment out all others.
- Ensure that iptables lets traffic through on port 389:
- Run the following command to join the domain:
- At this point you have successfully joined to the AD domain, you can test this by getting a list of users or group. You should get back the users and/or groups that have linux attributes, at least the binding account.
getent passwd
getent group
- In order to create a user's home directory on first login add this directive to /etc/pam.d/sshd. I only log on using ssh. If you are logging in at the box, rather than remotely, you need to modify /etc/pam.d/logon too, I believe. Note that this will not work if SELinux is on.
session required pam_mkhomedir.so skel=/etc/skel umask=0022
- Allow polyinstatiation in SELinux settings:
setsebool -P allow_polyinstantiation 1
- Temporarily set SELinux to permissive:
- If you login with a domain user (ssh binding@domaintest, where domaintest is the server that has just joined the domain), the directory will be created, but you will also have a record of what would've gone wrong on /var/log/audit/audit.conf had SElinux been on, which in my case is this:
- Create a SELinux policy module to allow the creation of home directories when the user first logs in:
less /var/log/audit/audit.log | grep denied > mkdir.log
audit2why < mkdir.log
audit2allow -M mkdir -i mkdir.log
semodule -i mkdir.pp
- Renable SELinux:
setenforce 1
passwd: files ldapshadow: files ldapgroup: files ldap
binddn cn=binding, cn=User,dc=dev,dc=combindpw mypass
#The Default search scopescope sub
#Customize certain database lookupsbase group dc=dev,dc=combase passwd dc=dev,dc=combase shadow dc=dev,dc=com
# Mappings for Services for UNIX 3.5filter passwd (objectClass=User)map passwd uid msSFU30Namemap passwd uidNumber msSFU30UidNumbermap passwd gidNumber msSFU30GidNumbermap passwd userPassword msSFU30Passwordmap passwd homeDirectory msSFU30HomeDirectorymap passwd LoginShell msSFU30LoginShellfilter shadow (objectClass=User)map shadow uid msSFU30Namemap shadow userPassword msSFU30Passwordfilter group (objectClass=Group)map group uniqueMember msSFU30PosixMembermap group gidNumber msSFU30GidNumber
Network Related Optionsworkgroup =devDomain members optionssecurity = adsrealm = DEV.COMuse kerberos keytab = true #not really sure about this onepassword server = mars.dev.com
iptables –I INPUT –p tcp --dport ldap –j ACCEPT; service iptables save
net ads join –U domainadmin
setenforce 0
type=AVC msg=audit(1329063091.971:160): avc: denied { create } for pid=5510 comm="mkhomedir_helpe" name="binding" scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=dir type=AVC msg=audit(1329063091.973:161): avc: denied { create } for pid=5510 comm="mkhomedir_helpe" name=".bashrc" scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=file type=AVC msg=audit(1329063091.973:161): avc: denied { write open } for pid=5510 comm="mkhomedir_helpe" name=".bashrc" dev=dm-0 ino=263825 scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=file type=AVC msg=audit(1329063091.973:162): avc: denied { setattr } for pid=5510 comm="mkhomedir_helpe" name=".bashrc" dev=dm-0 ino=263825 scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=file type=AVC msg=audit(1329063092.015:163): avc: denied { setattr } for pid=5510 comm="mkhomedir_helpe" name="binding" dev=dm-0 ino=263284 scontext=unconfined_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=dir
I wonder how much tweaking, if any, will be required for a Windows 2008 Active Directory domain.
Hi, very useful post. But what's "bind user" on step 5 ?
ReplyDeleteu mean a simple user account ?
that's right, a simple user account. I've not really investigated the security implications of this, though.
Deleteand, excuse me, an other question. How to make a simple samba join (without ssh kerb auth)?
ReplyDeletei learn so many things from this blog.keep updating.thank you so much.
ReplyDeletecancel norton antivirus
ReplyDeleteAnkara
ReplyDeleteBolu
Sakarya
Mersin
Malatya
PT0
Diyarbakır
ReplyDeleteSamsun
Antep
Kırşehir
Konya
4AKN43
https://titandijital.com.tr/
ReplyDeletenevşehir parça eşya taşıma
bolu parça eşya taşıma
batman parça eşya taşıma
bayburt parça eşya taşıma
FTS
istanbul evden eve nakliyat
ReplyDeletebalıkesir evden eve nakliyat
şırnak evden eve nakliyat
kocaeli evden eve nakliyat
bayburt evden eve nakliyat
8OXDİY
0D3B9
ReplyDeleteKeep Coin Hangi Borsada
İzmir Evden Eve Nakliyat
Huobi Güvenilir mi
Kırklareli Evden Eve Nakliyat
Konya Parça Eşya Taşıma
Aksaray Parça Eşya Taşıma
Ardahan Parça Eşya Taşıma
Qlc Coin Hangi Borsada
Düzce Parça Eşya Taşıma
B529A
ReplyDeleteArdahan Evden Eve Nakliyat
Eryaman Parke Ustası
Kars Parça Eşya Taşıma
Etlik Fayans Ustası
Ardahan Lojistik
Antep Lojistik
Tunceli Şehirler Arası Nakliyat
Van Lojistik
Siirt Lojistik
AA3FC
ReplyDeleteSilivri Fayans Ustası
Ağrı Evden Eve Nakliyat
buy peptides
buy testosterone enanthate
Silivri Parke Ustası
Tokat Evden Eve Nakliyat
Isparta Evden Eve Nakliyat
Amasya Evden Eve Nakliyat
testosterone propionat for sale
E9C9F
ReplyDeletebinance komisyon indirimi %20
شركة تنظيف سجاد بالجبيل DbZaDvs90i
ReplyDeleteمكافحة حشرات NTfRDePX36
ReplyDeleteشركة مكافحة الحمام بالدمام 8rV6mSafOL
ReplyDelete