Skip to content

Commit c5b2a0c

Browse files
committed
pam_openrc: add rc_autostart_users to rc.conf
allows system administrators to disable autostarting without changing pam configuration files.
1 parent 843dc4a commit c5b2a0c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

etc/rc.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
# set to YES.
1616
#rc_interactive="YES"
1717

18+
# Set to "NO" if you don't want pam_openrc autostarting user services. This
19+
# effetively disables the pam module, without the need of removing it from
20+
# the pam configuration files.
21+
#rc_autostart_users="YES"
22+
1823
# If we need to drop to a shell, you can specify it here.
1924
# If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
2025
# otherwise /bin/sh

src/pam_openrc/pam_openrc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ exec_openrc(pam_handle_t *pamh, bool opening)
2323
struct passwd *user;
2424
pid_t pid = -1;
2525

26+
errno = 0;
27+
if (!rc_yesno(rc_conf_value("rc_autostart_users")) && errno == 0)
28+
return PAM_SUCCESS;
29+
2630
setenv("EINFO_LOG", "pam_openrc", true);
2731

2832
if (pam_get_item(pamh, PAM_SERVICE, (const void **)&session) != PAM_SUCCESS) {

0 commit comments

Comments
 (0)