package/linux-pam: adjust login pam file for lastlog

when pam_lastlog.so is not installed login issues an error
that it is not able to load it.

Hence only enable the entry when pam_lastlog.so is installed.

Fixes:
 login[649]: PAM unable to dlopen(/lib/security/pam_lastlog.so): /lib/security/pam_lastlog.so: cannot open shared object file: No such file or directory
 login[649]: PAM adding faulty module: /lib/security/pam_lastlog.so

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit ee5c08aa88)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Michael Nosthoff
2024-10-01 11:20:55 +02:00
committed by Peter Korsgaard
parent 9ffb14ced9
commit d184ae6720
2 changed files with 6 additions and 1 deletions

View File

@@ -56,6 +56,10 @@ endif
ifeq ($(BR2_PACKAGE_LINUX_PAM_LASTLOG),y)
LINUX_PAM_CONF_OPTS += --enable-lastlog
define LINUX_PAM_LASTLOG_PAMFILE_TWEAK
$(SED) 's/^# \(.*pam_lastlog.so.*\)$$/\1/' \
$(TARGET_DIR)/etc/pam.d/login
endef
else
LINUX_PAM_CONF_OPTS += --disable-lastlog
endif
@@ -66,6 +70,7 @@ define LINUX_PAM_INSTALL_CONFIG
$(TARGET_DIR)/etc/pam.d/login
$(INSTALL) -m 0644 -D package/linux-pam/other.pam \
$(TARGET_DIR)/etc/pam.d/other
$(LINUX_PAM_LASTLOG_PAMFILE_TWEAK)
$(LINUX_PAM_SELINUX_PAMFILE_TWEAK)
endef

View File

@@ -8,5 +8,5 @@ password required pam_unix.so nullok
session required pam_limits.so
session required pam_env.so
session required pam_unix.so
session optional pam_lastlog.so
# session optional pam_lastlog.so
# session required pam_selinux.so open