{"id":6094,"date":"2016-07-31T16:20:05","date_gmt":"2016-07-31T08:20:05","guid":{"rendered":"http:\/\/rmohan.com\/?p=6094"},"modified":"2016-07-31T16:20:05","modified_gmt":"2016-07-31T08:20:05","slug":"install-nfs-on-the-ldap-server","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6094","title":{"rendered":"Install NFS on the LDAP Server"},"content":{"rendered":"<p>We need to install NFS on the LDAP server. Note: it\u2019s not required to have the LDAP server and the NFS server on the same machine, it\u2019s only easier.<\/p>\n<p>The first step is to install all the necessary packages for NFS. Once these packages are installed, each package needs to be enabled and started.<\/p>\n<p># yum -y install portreserve quota rpcbind nfs4-acl-tools.x86_64 nfs-utils.x86_64<br \/>\n# systemctl enable rpcbind<br \/>\n# systemctl start rpcbind<\/p>\n<p># systemctl enable nfs-server<br \/>\n# systemctl start nfs-server<\/p>\n<p># systemctl enable nfs-lock<br \/>\n# systemctl start nfs-lock<\/p>\n<p># systemctl enable nfs-idmap<br \/>\n# systemctl start nfs-idmap<\/p>\n<p># systemctl enable nfs-idmap<br \/>\n# systemctl start nfs-idmap<\/p>\n<p>We now need to update the \/etc\/exports file.<\/p>\n<p># vi \/etc\/exports<br \/>\n\/home\/guests 192.168.56.105(rw,sync)<br \/>\nOnce the config file is saved, we will now need to export the file.<\/p>\n<p># exportfs -avr<br \/>\nexporting 192.168.56.105:\/home\/guests<br \/>\nEnsure that iptables\/firewalld allow communication using NFS.<\/p>\n<p>Setup the LDAP client<\/p>\n<p>The first step is to install openldap-clients, nss-pam-ldapd, autofs and nfs-utils.<\/p>\n<p># yum install -y openldap-clients nss-pam-ldapd autofs nfs-utils<br \/>\nLets enable and start the autofs daemon.<\/p>\n<p># systemctl enable autofs<br \/>\n# systemctl start autofs<br \/>\nI\u2019m also modifying the hosts file to include a mapping for instructor.example.com which will point to 192.168.56.104.<\/p>\n<p># cat \/etc\/hosts<br \/>\n192.168.56.104 instructor.example.com<br \/>\nWe\u2019ll now connect the LDAP client up to our OpenLDAP server.<\/p>\n<p># authconfig-tui<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-1.jpg\" alt=\"authconfig-1\" width=\"541\" height=\"275\" class=\"aligncenter size-full wp-image-6095\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-1.jpg 541w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-1-300x152.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-1-150x76.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-1-400x203.jpg 400w\" sizes=\"(max-width: 541px) 100vw, 541px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-2.jpg\" alt=\"authconfig-2\" width=\"428\" height=\"197\" class=\"aligncenter size-full wp-image-6096\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-2.jpg 428w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-2-300x138.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-2-150x69.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-2-400x184.jpg 400w\" sizes=\"(max-width: 428px) 100vw, 428px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-3.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2016\/07\/authconfig-3.jpg\" alt=\"authconfig-3\" width=\"378\" height=\"253\" class=\"aligncenter size-full wp-image-6097\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-3.jpg 378w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-3-300x201.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2016\/07\/authconfig-3-150x100.jpg 150w\" sizes=\"(max-width: 378px) 100vw, 378px\" \/><\/a><\/p>\n<p>DO NOT CLICK ON OK, just yet!<\/p>\n<p>Open a separate SSH session to the client and cd to \/etc\/openldap\/cacerts\/.<\/p>\n<p># cd \/etc\/openldap\/cacerts\/<br \/>\nWe\u2019re now going to copy across the certificate from the LDAP server to this directory.<\/p>\n<p># wget http:\/\/instructor.example.com\/cert.pem .<br \/>\nSwitch back to the original SSH session with authconfig-tui open. Press Ok.<\/p>\n<p>Restart the host.<\/p>\n<p># shutdown -r now<br \/>\nOnce the host has started up, run the following getent command to ensure that you can successfully connect to the OpenLDAP server.<\/p>\n<p># getent passwd ldapuser02<br \/>\nldapuser02:x:1001:1001:ldapuser02:\/home\/guests\/ldapuser02:\/bin\/bash<br \/>\nWe\u2019ll verify that we can access the NFS share which we previously setup on the OpenLDAP + NFS server.<\/p>\n<p># showmount -e instructor.example.com<br \/>\nExport list for instructor.example.com:<br \/>\n\/home\/guests 192.168.56.106,192.168.56.105<br \/>\nCreate a new indirect \/etc\/auto.guests map and paste the following line:<\/p>\n<p>* -rw,nfs4 instructor.example.com:\/home\/guests\/&#038;<br \/>\nAdd the following line at the beginning of the \/etc\/auto.master file:<\/p>\n<p>\/home\/guests \/etc\/auto.guests<br \/>\nRestart autofs:<\/p>\n<p># systemctl restart autofs<br \/>\nTest the configuration:<\/p>\n<p># su &#8211; ldapuser02<br \/>\nLast login: Sun Oct 26 20:37:23 EDT 2015 on pts\/0<br \/>\n[ldapuser02@localhost ~]$ ls -lrt<br \/>\ntotal 0<br \/>\n-rwxrwxrwx. 1 ldapuser02 ldapuser02 0 Oct 26 18:20 testfile<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We need to install NFS on the LDAP server. Note: it\u2019s not required to have the LDAP server and the NFS server on the same machine, it\u2019s only easier.<\/p>\n<p>The first step is to install all the necessary packages for NFS. Once these packages are installed, each package needs to be enabled and started.<\/p>\n<p># [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6094"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6094"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6094\/revisions"}],"predecessor-version":[{"id":6098,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6094\/revisions\/6098"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}