{"id":550,"date":"2011-01-28T00:30:38","date_gmt":"2011-12-22T05:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/single-sign-on-ad-authenticated-samba-on-solaris-10-sparc-to-a-windows-2003-active-directory\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-12-22T05:51:50","slug":"single-sign-on-ad-authenticated-samba-on-solaris-10-sparc-to-a-windows-2003-active-directory","status":"publish","type":"post","link":"\/blog\/index.php\/single-sign-on-ad-authenticated-samba-on-solaris-10-sparc-to-a-windows-2003-active-directory\/","title":{"rendered":"Single Sign On + AD Authenticated Samba on Solaris 10 Sparc to a Windows 2003 Active Directory"},"content":{"rendered":"<p>PDC<br \/>\nTo add to the previous post, we&#8217;ll show now a way to ssh to your Solaris 10 SPARC server using an ActiveDirectory<br \/>\nuser+pass, additional to use samba shares anywhere, with your AD credentials.<br \/>\nBUILDING<br \/>\nSamba from blastwave does not include pam_winbind.so, to plug it to PAM, and use our AD user+pass to<br \/>\nlogin to solaris, so we ned to build our own samba. The release i got is samba 3.0.28, from<br \/>\nhttp:\/\/us4.samba.org\/samba\/ftp\/stable\/samba-3.0.28.tar.gz<br \/>\nWe need to make sure all required packages to build and use SAMBA are in the system, so please obtain<br \/>\nthis list<br \/>\nusing pkg-get from blastwave.<br \/>\nOur SAMBA sources like GNU ld, so we are not going to use solaris native ld to build it, we do so by doing:<br \/>\n# mv \/usr\/ccs\/bin\/ld \/usr\/ccs\/bin\/ld. old<br \/>\n# ln -s \/opt\/csw\/bin\/gld \/opt\/csw\/bin\/ld<br \/>\n# export PATH=$PATH:\/opt\/csw\/bin<br \/>\nWe uncompress SAMBA in a directory called &#8220;\/builds&#8221; and then:<br \/>\n# cd \/builds\/samba-3.0.28\/source<br \/>\n# .\/configure &#8211;with-ldap &#8211;with-ads &#8211;with-krb5=\/opt\/csw &#8211;with-winbind &#8211;with-pam &#8211;prefix=\/usr\/samba_ad<br \/>\nThis will use the openldap client libs in \/opt\/csw, same as the krb5 in \/opt\/csw. If all reqs are passed do a<br \/>\n# make &amp;&amp; make install<br \/>\nThen, it will all end at \/usr\/samba_ad<br \/>\nAfter building these you can always remove the gcc suite, automake, autoconf, flex and bison.<br \/>\nWe now need to copy the nsswitch and pam extensions to their locations:<br \/>\n# cp \/builds\/samba-3.0.28\/source\/nsswitch\/libnss_win* \/usr\/lib<br \/>\n# ln -s \/usr\/lib\/libnss_winbind.so \/usr\/lib\/libnss_winbind.so.1<br \/>\n# ln -s \/usr\/lib\/libnss_wins.so \/usr\/lib\/libnss_wins.so.1<br \/>\nNow we copy the pam extension:<br \/>\n# cp \/builds\/samba-3.0.28\/source\/bin\/pam_winbind.so \/usr\/lib\/security<br \/>\n# cp \/builds\/samba-3.0.28\/source\/bin\/pam_winbind.so \/lib\/security<br \/>\n# ln -s \/usr\/lib\/security\/pam_winbind.so \/usr\/lib\/security\/pam_winbind.so.1<br \/>\n# ln -s \/lib\/security\/pam_winbind.so \/lib\/security\/pam_winbind.so.1<br \/>\nCONFIGURING<br \/>\n134\/433<br \/>\n\/opt\/csw\/etc\/krb5.conf<br \/>\n:<br \/>\n\/usr\/samba_ad\/lib\/smb.conf<br \/>\n:<br \/>\n\/etc\/nsswitch.conf<br \/>\n, to add winbind to users and groups:<br \/>\npasswd: files winbind<br \/>\ngroup: files winbind<br \/>\nOur Windows 2003 ActiveDirectory Primary Domain controller is &#8220;fwa-dc01.aww.com&#8221;, our AD domain is<br \/>\n&#8220;AWW.COM&#8221;, and our solaris 10 sparc server is &#8220;netra.aww.com&#8221;, so we add these entries to \/etc\/hosts,<br \/>\ntaking care the FQDN appears first.<br \/>\n172.16.1.38 netra.aww.com netra loghost<br \/>\n172.16.1.55 fwa-dc01.aww.com fwa-dc01<br \/>\nNow we configure pam.conf, we need to make sure home directories are created whenever a user from the<br \/>\nwindows world logs in, so we get pam_mkhomedir from http:\/\/mega.ist. utl.pt\/~filipe\/pam_mkhomedir-sol\/, at<br \/>\nhttp:\/\/mega.ist. utl.pt\/~filipe\/pam_mkhomedir-sol\/pam_mkhomedir-sol-0.0.1.tgz<br \/>\nWe build pam_mkhomedir by uncompressing it at \/builds\/pam_mkhomedir and editing its Makefile to use the<br \/>\nsolaris native ld:<br \/>\nLD=\/usr\/ccs\/bin\/ld.old<br \/>\nnow we just build it<br \/>\n# cd \/builds\/pam_mkhomedir<br \/>\n# make<br \/>\nAnd then we copy it to the system default for PAM modules:<br \/>\n# cp \/builds\/pam_mkhomedir\/pam_mkhomedir.so \/usr\/lib\/security<br \/>\n# ln -s \/usr\/lib\/security\/pam_mkhomedir.so \/usr\/lib\/security\/pam_mkhomedir. so.1<br \/>\n\/etc\/pam.conf<br \/>\n, to use both pam_winbind and pam_mkhomedir, adding 4 lines:<br \/>\nlogin auth sufficient pam_winbind.so.1<br \/>\nother auth sufficient pam_winbind.so.1<br \/>\nother account sufficient pam_winbind.so.1<br \/>\nother session optional pam_mkhomedir.so.1 skel=\/etc\/skel umask=0022<br \/>\nSTARTING DAEMONS<br \/>\nAfter this, we can start samba, and see the effects:<br \/>\n# export PATH=\/usr\/samba_ad\/sbin:\/usr\/samba_ad\/bin:\/opt\/csw\/bin:\/opt\/csw\/sbin:$PATH<br \/>\n# pkill winbindd; pkill smbd;pkill nmbd, \/etc\/init.d\/cswsamba stop<br \/>\n# \/opt\/csw\/bin\/kdestroy<br \/>\n# net ads leave -U &#8220;Administrator%M1cr050ft123&#8221;<br \/>\n# \/opt\/csw\/bin\/kinit Administrator@AWW.COM<br \/>\n# net ads join -U &#8220;Administrator%M1cr050ft123&#8221;<br \/>\n135\/433<br \/>\n# winbindd -B<br \/>\n# smbd -D<br \/>\n# nmbd -D<br \/>\nTESTING<br \/>\nI wrote an easy test script called sambatest.ksh:<br \/>\n#!\/bin\/bash<br \/>\nexport<br \/>\n136\/433<br \/>\nPATH=\/usr\/samba_ad\/sbin:\/usr\/samba_ad\/bin:\/opt\/csw\/bin:\/opt\/csw\/sbin:\/usr\/sbin:\/usr\/bin:\/usr\/openwin\/bin:\/opt\/csw\/gcc3\/bin:\/usr\/sfw\/bin:\/usr\/ccs\/bin:\/usr\/local\/bin:\/usr\/local\/bin:\/usr\/local\/sbin<br \/>\nexport LD_LIBRARY_PATH=\/usr\/samba_ad\/lib<br \/>\nset -x<br \/>\nwhich net<br \/>\nwhich smbd<br \/>\nwhich nmbd<br \/>\nwhich winbindd<br \/>\nwhich klist<br \/>\nwhich kinit<br \/>\n137\/433<br \/>\nsleep 5<br \/>\nsmbclient -L netra -U%<br \/>\nwbinfo -m<br \/>\nwbinfo -g<br \/>\nwbinfo -u<br \/>\ngetent passwd<br \/>\ngetent group<br \/>\nnet ads status<br \/>\nnet ads info<br \/>\nthis<br \/>\n. Please note that wbinfo -m shows your AD domain, wbinfo -g and wbinfo<br \/>\n-u show users and groups, getent passwd should show both your local and AD users.<br \/>\nNow we use ssh with an ActiveDirectory user+pass, it should look like this:<br \/>\nroot@kraftek:~# ssh bmahock@netra<br \/>\nPassword:<br \/>\nCreating directory &#8216;\/export\/home\/AWW.bmahock&#8217;.<br \/>\nLast login: Sat Feb 2 19:53:08 2008 from localhost<br \/>\n\/usr\/openwin\/bin\/xauth: creating new authority file \/export\/home\/AWW.bmahock\/.Xauthority<br \/>\nSun Microsystems Inc. SunOS 5.10 Generic January 2005<br \/>\n-bash-3.00$ id<br \/>\nuid=10004(bmahock) gid=10008(domain users)<br \/>\n-bash-3.00$ pwd<br \/>\n\/export\/home\/AWW.bmahock<br \/>\nThen it&#8217;s just a question of enjoying. \ud83d\ude42<br \/>\nBINARIES<br \/>\nIf you don&#8217;t want to compile much, just install the CSW packages mentioned above, get these binaries:<br \/>\nsamba_ad_solaris_10_sparc.tar.gz<br \/>\n, put them at \/ and untar them, be careful, these contain the libraries<br \/>\nneeded at \/usr\/lib\/security and \/usr\/lib, then just configure \/etc\/nsswitch.conf, \/etc\/pam.conf,<br \/>\n\/usr\/samba_ad\/lib\/smb.conf, \/etc\/krb5.conf and \/opt\/csw\/etc\/krb5.conf, verify for each program and library that<br \/>\nno symbol is missing using ldd, and start your engines!.<br \/>\nSCREENSHOTS<br \/>\nComputers<br \/>\nUsers<br \/>\nfreenx solaris gnome session<br \/>\nfor an ActiveDirectory user, yes he can also use sudo!<br \/>\nwindows xp<br \/>\nusing his AD user+pass, and paswordless-ly view and<br \/>\nsmb.conf<br \/>\n.<br \/>\n138\/433<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PDC To add to the previous post, we&#8217;ll show now a way to ssh to your Solaris 10 SPARC server using an ActiveDirectory user+pass, additional to use samba shares anywhere, with your AD credentials. BUILDING Samba from blastwave does not include pam_winbind.so, to plug it to PAM, and use our AD user+pass to login to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-550","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=550"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/550\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}