Skip to contentSkip to conversation

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

PATCH Applied Michael Nosthoff via buildroot 2 participants 3 messages Oct 1, 2024 – Nov 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 package/linux-pam/linux-pam.mk | 5 +++++
 package/linux-pam/login.pam    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
package/linux-pam/linux-pam.mk +5 -0
index 1433eb00b3..c5543e1f1f 100644
@@ -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
 
package/linux-pam/login.pam +1 -1
index 5df7db628c..21d2afb61e 100644
@@ -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
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 9 lines · On Tue, 1 Oct 2024 11:20:55 +0200 Michael Nosthoff via buildroot…

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

Quoted 5 lines
---
 package/linux-pam/linux-pam.mk | 5 +++++
 package/linux-pam/login.pam    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Applied to master, thanks. It would be really good to have runtime tests to test this kind of packages, with its different features/options.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Michael Nosthoff via buildroot
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Michael" == Michael Nosthoff via buildroot <[email protected]> writes:

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.

Quoted 7 lines

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

Committed to 2024.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot