This is an old revision of the document!
= Configuring LDAP/Active Directory on Gentoo Linux =
Follow this HOWTO: http://gentoo-wiki.com/HOWTO_Adding_a_Samba_Server_into_an_existing_AD_Domain
<source lang=“bash”> USE=“acl apache2 bash-completion berkdb hal ipv6 kerberos ldap mysql mysqli nptl nptlonly pam pdf perl php png python quotas readline samba sasl sockets ssl syslog vhosts vim-syntax xml xml2 zlib -arts -debug -gnome -gtk -kde -selinux -qt -X” </source>
<source lang=“bash”> net-misc/ntp caps net-fs/samba ads automount net-nds/openldap -sasl -kerberos sys-auth/nss_ldap -sasl -kerberos sys-auth/pam_ldap -sasl -kerberos </source>
Such that packages install with the following options
<source lang=“bash”> R net-nds/openldap-2.3.39-r2 USE=“berkdb crypt gdbm ipv6 perl samba ssl tcpd -debug -kerberos -minimal -odbc -overlays -sasl (-selinux) -slp -smbkrb5passwd (-readline%*)” 0 kB R app-crypt/mit-krb5-1.5.3-r1 USE=“ipv6 -doc -krb4 -tcl” 0 kB R net-fs/samba-3.0.28 USE=“acl ads automount cups ipv6 ldap pam python quotas readline syslog -async -caps -doc -examples -fam (-selinux) -swat -winbind” LINGUAS=“-ja -pl” 0 kB R sys-auth/nss_ldap-258 USE=“-debug -kerberos -sasl” 0 kB R sys-auth/pam_ldap-183 USE=“ssl -sasl” 0 kB </source>
/etc/ntp.conf needs only the following four lines <source lang=“text”> server river.sihnon.net driftfile /var/lib/ntp/ntp.drift restrict default nomodify nopeer restrict 127.0.0.1 </source>
Start ntp-client to update the clock immediately, then ntpd to keep it in sync <source lang=“bash”>
</source>
/etc/samba/smb.conf <source lang=“ini”> global
workgroup = SIHNON
realm = AD.SIHNON.NET netbios name = Patience server string = Patience File Server
log file = /var/log/samba/log.%m
max log size = 50 log level = 2
map to guest = bad user
security = ADS password server = * encrypt passwords = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
interfaces = 10.0.0.0/24 local master = no domain master = no
name resolve order = wins host lmhosts bcast
wins server = 87.194.163.94 dns proxy = yes
nt acl support = true
create mode = 0664 directory mode = 0755 use spnego = yes
#
comment = Home Directories browseable = no writable = yes - You can enable VFS recycle bin on a per share basis: - Uncomment the next 2 lines (make sure you create a - .recycle folder in the base of the share and ensure - all users will have write access to it. See - examples/VFS/recycle/REAME in the samba docs for details
; vfs object = /usr/lib/samba/vfs/recycle.so </source>
Start Samba, then join the machine to the Domain. <source lang=“bash”>
Administrator's password: Using short domain name – SIHNON Joined 'PATIENCE' to realm 'AD.SIHNON.NET' </source>
/etc/openldap/ldap.conf <source lang=“bash”>
BASE dc=ad,dc=sihnon,dc=net URI ldaps:stitch.sihnon.net HOST 87.194.163.94 REFERRALS no #SIZELIMIT 12 #TIMELIMIT 15 DEREF never TLS_CACERT /etc/ssl/certs/stitch.sihnon.net.pem TLS_REQCERT never </source> /etc/ldap.conf <source lang=“bash”> host 87.194.163.94 uri ldaps:stitch.sihnon.net base dc=ad,dc=sihnon,dc=net ldap_version 3 binddn cn=scout,cn=Users,dc=ad,dc=sihnon,dc=net bindpw ** rootbinddn cn=root,ou=LDAP,dc=ad,dc=sihnon,dc=net scope sub timelimit 30
nss_base_passwd dc=ad,dc=sihnon,dc=net?sub nss_base_shadow dc=ad,dc=sihnon,dc=net?sub nss_base_group dc=ad,dc=sihnon,dc=net?sub?&(objectCategory=group)(gidnumber=*) nss_map_objectclass posixAccount user nss_map_objectclass shadowAccount user nss_map_objectclass posixGroup group nss_map_attribute homeDirectory unixHomeDirectory nss_map_attribute gecos cn nss_map_attribute uniqueMember member
logdir /var/log/nss_ldap
bind_policy soft bind_timelimit 5
pam_groupdn “cn=LinuxUsers,ou=LDAP,dc=ad,dc=sihnon,dc=net” pam_member_attribute member pam_passwd ad pam_password ad
ssl on tls_cacertfile /etc/ssl/certs/stitch.sihnon.net.pem tls_checkpeer no tls_ciphers TLSv1 </source>
/etc/nsswitch.conf <source lang=“bash”>
passwd: files compat ldap shadow: files compat ldap group: files compat ldap
hosts: files dns networks: files dns
services: db files protocols: db files rpc: db files ethers: db files netmasks: files netgroup: files bootparams: files
automount: files aliases: files </source>
/etc/pam.d/system-auth <source lang=“bash”> #%PAM-1.0
auth required pam_env.so auth sufficient pam_unix.so likeauth nullok auth sufficient pam_ldap.so use_first_pass auth required pam_deny.so
account sufficient pam_unix.so account sufficient pam_ldap.so
password required pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3 password sufficient pam_unix.so nullok md5 shadow use_authtok password sufficient pam_ldap.so use_authtok password required pam_deny.so
session required pam_limits.so session required pam_unix.so session required pam_mkhomedir.so skel=/etc/skel/ umask=0022 session required pam_ldap.so </source>
/etc/pam.d/su <source lang=“bash”> #%PAM-1.0
auth sufficient pam_rootok.so
#auth required pam_listfile.so item=ruser sense=allow onerr=fail file=/etc/security/suauth.allow
#auth sufficient pam_wheel.so use_uid trust
#auth sufficient pam_listfile.so item=ruser sense=allow onerr=fail file=/etc/security/suauth.nopass
auth required pam_wheel.so use_uid auth sufficient pam_ldap.so
auth include system-auth
account include system-auth
password include system-auth
session include system-auth session required pam_env.so session optional pam_xauth.so </source>
/etc/ssl/certs/stitch.sihnon.net.pem <source lang=“text”> —–BEGIN CERTIFICATE—– MIIEljCCA36gAwIBAgIQIkEhY3aR7olM0OSGrKd6ETANBgkqhkiG9w0BAQUFADBS MRMwEQYKCZImiZPyLGQBGRYDbmV0MRYwFAYKCZImiZPyLGQBGRYGc2lobm9uMRIw EAYKCZImiZPyLGQBGRYCYWQxDzANBgNVBAMTBlN0aXRjaDAeFw0wODAxMTMwMjU2 MjVaFw0xMzAxMTMwMzA1MTRaMFIxEzARBgoJkiaJk/IsZAEZFgNuZXQxFjAUBgoJ kiaJk/IsZAEZFgZzaWhub24xEjAQBgoJkiaJk/IsZAEZFgJhZDEPMA0GA1UEAxMG U3RpdGNoMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoDEsstUEWWme gXbQPhqlRC6KCL3/RD6UU9ySsAvYoReuW1kXs9kpmWseUrGuzIDyTyT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