From: Paul Hänsch Date: Sun, 21 Jul 2019 18:11:39 +0000 (+0200) Subject: module for smb and nis login setup X-Git-Url: http://git.plutz.net/?a=commitdiff_plain;ds=inline;h=f9427bc88f337f8a43983326293ec391a136200d;p=blast module for smb and nis login setup --- diff --git a/config.example b/config.example index 6574d0c..95d1485 100644 --- a/config.example +++ b/config.example @@ -49,6 +49,9 @@ ## Rotation for some Raspberry Displays # display_rotate=0 +## When using NIS modules the directory server should be given +# nis_server=nismaster + ## If the approxmodule is enabled, then one (and only one) apt-source ## can be choosen to install packages from ## See modules/approx.mk if you need more flexibility diff --git a/modules/smb_nis.mk b/modules/smb_nis.mk new file mode 100644 index 0000000..a940d1d --- /dev/null +++ b/modules/smb_nis.mk @@ -0,0 +1,61 @@ +PACKAGES += cifs-utils libpam-mount libpam-script lxdm nis nscd samba-common-bin usermode + +ifndef nis_server + nis_server := nismaster +endif + +define DEBCONF += + +nis nis/domain string .${nis_server} +endef + +export smb_nis_pamscript smb_nis_pammount + +define smb_nis_pamscript := +#!/bin/sh + +/bin/bash -c ' + printf "%s\n" "$$PAM_OLDAUTHTOK" "$$PAM_AUTHTOK" "$$PAM_AUTHTOK" \ + | smbpasswd -sr ${nis_server} -U "$$PAM_USER" +' + +exit $? + +endef + +define smb_nis_pammount := + + + + + + + + +endef + +.PHONY: _smb_nis +_config: _smb_nis + +_smb_nis: ${CFGROOT}/opt/pam_script/pam_script_passwd ${CFGROOT}/etc/security/pam_mount.conf.xml +_smb_nis: ${CFGROOT}/etc/yp.conf ${CFGROOT}/etc/defaultdomain + +_smb_nis: ${CFGROOT} + sed -Ei 's;^(passwd:|group:|shadow:|gshadow:) *;\1 nis ;' $${CFGROOT}/etc/nsswitch.conf + printf '\nauth optional pam_mount.so\n' >>$${CFGROOT}/etc/pam.d/common-auth + printf '\nsession optional pam_mount.so\n' >>$${CFGROOT}/etc/pam.d/common-session + printf '\npassword required pam_script.so dir=/opt/pam_script\n' >$${CFGROOT}/etc/pam.d/common-password + +${CFGROOT}/opt/pam_script/pam_script_passwd: ${CFGROOT} + mkdir -p "$(dir $@)" + printf '%s' "$${smb_nis_pamscript}" >"$@" + +${CFGROOT}/etc/security/pam_mount.conf.xml: ${CFGROOT} + mkdir -p "$(dir $@)" + printf '%s' "$${smb_nis_pammount}" >"$@" + +${CFGROOT}/etc/yp.conf: ${CFGROOT} + printf 'ypserver %s\n' "${nis_server}" >"$@" + +${CFGROOT}/etc/defaultdomain: ${CFGROOT} + printf '.%s\n' "${nis_server}" >"$@"