# $HeadURL$ $LastChangedRevision$ ifndef FACILITY_NSS_MK FACILITY_NSS_MK = 1 # In pass #1: load recipe generators # In pass #0: load generated recipes include method-install.mk include method-service.mk include file-automaster.mk # Tell recipe generators what to generate recipes for ifeq ($(PCMS_PASS_NUM),1) all.install: autofs.install nis.install nslcd.install autofs-ldap.install nfs-common.install libldap-common.install libnss-ldapd.install libpam-ldapd.install all.uninstall: autofs.uninstall nis.uninstall nslcd.uninstall autofs-ldap.uninstall nfs-common.uninstall libldap-common.uninstall libnss-ldapd.uninstall libpam-ldapd.uninstall # The real Makefile else ifeq ($(PCMS_PASS_NUM),0) all.facility: nss.facility autofs.facility ifeq ($(NIS_CLIENT_FLAG),true) nss.facility: lookups-over-nsswitch-conf-over-nis.fix nslcd.uninstall libnss-ldapd.uninstall libpam-ldapd.uninstall nscd -i passwd -i group > /dev/null 2>&1 || rm -f /var/cache/nscd/{passwd,group} touch $@ autofs.facility: autofs-nis.fix touch $@ else ifeq ($(LDAP_CLIENT_FLAG),true) nss.facility: lookups-over-ldap-conf.fix lookups-over-nsswitch-conf-over-ldap.fix lookups-over-pam-d-over-ldap.fix nis.uninstall nscd -i passwd -i group > /dev/null 2>&1 || rm -f /var/cache/nscd/{passwd,group} touch $@ autofs.facility: autofs-ldap.fix touch $@ else nss.facility: lookups-over-nsswitch-conf-over-files.fix nsswitch-static.fix nis.uninstall nslcd.uninstall libnss-ldapd.uninstall libpam-ldapd.uninstall nscd -i passwd -i group > /dev/null 2>&1 || rm -f /var/cache/nscd/{passwd,group} touch $@ autofs.facility: autofs-static.fix touch $@ endif ######################################################################## # # NIS recipes # ######################################################################## # NIS lookups depend on having NIS configured and nsswitch.conf referring to it. lookups-over-nsswitch-conf-over-nis.fix: nis.fix /etc/nsswitch.conf nsswitch-conf-nis.fix touch $@ # Don't write nsswitch.conf until NIS is ready to be referred to. nsswitch-conf-nis.fix: nis.fix /etc/nsswitch.conf lineinfile --replace='^passwd:.*' --text='passwd: files nis' --file=/etc/nsswitch.conf lineinfile --replace='^group:.*' --text='group: files nis' --file=/etc/nsswitch.conf lineinfile --replace='^shadow:.*' --text='shadow: files nis' --file=/etc/nsswitch.conf touch $@ nis.fix: nis-$(NIS_CLIENT_NISDOMAIN).fix touch $@ nis-$(NIS_CLIENT_NISDOMAIN).fix: nis.install /etc/yp.conf /etc/defaultdomain systemctl restart rpcbind # Due to bug LP#1558196 / BTS#805167 rpcbind does not start when ypbind tries to access it # (yes, that's how it's meant to work in the systemctl world). This is a workaround. /bin/systemctl add-wants multi-user.target rpcbind.service systemctl restart nis touch $@ # These two should include $(NIS_CLIENT_NISDOMAIN) in the dependencies # so that if its value changes, then the file is forced to be regenerated. # There should also be some '$(RM) ...' in the recipe so that files # created when that variable was set to something else get deleted. /etc/yp.conf: nis.install echo "domain $(NIS_CLIENT_NISDOMAIN) broadcast" > /etc/yp.conf /etc/defaultdomain: nis.install echo "$(NIS_CLIENT_NISDOMAIN)" > /etc/defaultdomain autofs-nis.fix: lookups-over-nsswitch-conf-over-nis.fix autofs.install nfs-common.install automaster.file autofs-ldap.uninstall $(RM) /etc/auto.{misc,net,smb} systemctl restart autofs touch $@ automaster.file: autofs.install ######################################################################## # # LDAP over ldap.conf recipes # ######################################################################## lookups-over-ldap-conf.fix: lookups-over-ldap-conf-$(LDAP_CLIENT_BASEDN)-$(LDAP_CLIENT_SERVER).fix touch $@ lookups-over-ldap-conf-$(LDAP_CLIENT_BASEDN)-$(LDAP_CLIENT_SERVER).fix: /etc/ldap.conf lineinfile --replace='^#?BASE.*' --text='BASE $(LDAP_CLIENT_BASEDN)' --file=/etc/ldap/ldap.conf lineinfile --replace='^#?URI.*' --text='URI ldap://$(LDAP_CLIENT_SERVER)/' --file=/etc/ldap/ldap.conf touch $@ /etc/ldap.conf: libldap-common.install touch $@ ######################################################################## # # LDAP over nsswitch.conf recipes # ######################################################################## # LDAP/NSS lookups depend on having LDAP/NSS configured and nsswitch.conf referring to it. lookups-over-nsswitch-conf-over-ldap.fix: nss-ldap.fix nsswitch-conf-nss-ldap.fix touch $@ # Don't write nsswitch.conf until LDAP/NSS is ready to be referred to. nsswitch-conf-nss-ldap.fix: nss-ldap.fix /etc/nsswitch.conf lineinfile --replace='^passwd:.*' --text='passwd: files ldap' --file=/etc/nsswitch.conf lineinfile --replace='^group:.*' --text='group: files ldap' --file=/etc/nsswitch.conf lineinfile --replace='^shadow:.*' --text='shadow: files ldap' --file=/etc/nsswitch.conf touch $@ nss-ldap.fix: nss-ldap-$(LDAP_CLIENT_BASEDN)-$(LDAP_CLIENT_SERVER).fix touch $@ nss-ldap-$(LDAP_CLIENT_BASEDN)-$(LDAP_CLIENT_SERVER).fix: libnss-ldapd.install nslcd.fix touch $@ libnss-ldapd.install: nslcd.install nslcd.fix: nslcd.install /etc/nslcd.conf lineinfile --replace='^uri' --text='uri ldap://$(LDAP_CLIENT_SERVER)/' --file=/etc/nslcd.conf lineinfile --replace='^base' --text='base $(LDAP_CLIENT_BASEDN)' --file=/etc/nslcd.conf touch $@ /etc/nslcd.conf: nslcd.install ######################################################################## # # LDAP over PAM recipes # ######################################################################## # I'm not sure that LDAP/PAM refers to nsswitch.conf but I think # it might; hence second dependency. lookups-over-pam-d-over-ldap.fix: libpam-ldapd.install lookups-over-nsswitch-conf-over-ldap.fix touch $@ libpam-ldapd.install: lookups-over-nsswitch-conf-over-ldap.fix ######################################################################## # # autofs over LDAP # ######################################################################## autofs-ldap.fix: nss-ldap.fix autofs.install autofs-ldap.install nfs-common.install automaster.file $(RM) /etc/auto.{misc,net,smb} systemctl restart autofs touch $@ ######################################################################## # # Static # ######################################################################## lookups-over-nsswitch-conf-over-files.fix: static.fix nsswitch-conf-static.fix touch $@ nsswitch-conf-static.fix: static.fix /etc/nsswitch.conf lineinfile --replace='^passwd:.*' --text='passwd: files' --file=/etc/nsswitch.conf lineinfile --replace='^group:.*' --text='group: files' --file=/etc/nsswitch.conf lineinfile --replace='^shadow:.*' --text='shadow: files' --file=/etc/nsswitch.conf touch $@ static.fix: touch $@ autofs-static.fix: autofs.uninstall autofs-ldap.uninstall touch $@ nsswitch-static.fix: lookups-over-nsswitch-conf-over-files.fix /etc/nsswitch.conf touch $@ # Ordering lookups-over-nsswitch-conf-over-nis.fix: network.facility nss-ldap.fix: network.facility lookups-over-nsswitch-conf-over-files.fix: network.facility automaster.file: autofs.install # force order so our config not overwritten by default in package autofs.install: nfs-common.install libnss-ldapd.install: nslcd.install nslcd.uninstall: libnss-ldapd.uninstall endif # PCMS_PASS_NUM endif # FACILITY_NSS_MK