From e2f74c347bed962e69f61285beee4bfee11caa05 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 09:52:34 -0400 Subject: [PATCH 1/8] Add "NONEXISTENT" to "etc/login.defs" --- etc/login.defs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/etc/login.defs b/etc/login.defs index a0c3b0d1..2eef4f20 100644 --- a/etc/login.defs +++ b/etc/login.defs @@ -295,7 +295,7 @@ CHFN_AUTH yes # any combination of letters "frwh" (full name, room number, work # phone, home phone). If not defined, no changes are allowed. # For backward compatibility, "yes" = "rwh" and "no" = "frwh". -# +# CHFN_RESTRICT rwh # @@ -384,6 +384,14 @@ CHFN_RESTRICT rwh # DEFAULT_HOME yes +# +# The pwck(8) utility emits a warning for any system account with a home +# directory that does not exist. Some system accounts intentionally do +# not have a home directory. Such accounts may have this string as +# their home directory in /etc/passwd to avoid a spurious warning. +# +NONEXISTENT /nonexistent + # # If this file exists and is readable, login environment will be # read from it. Every line should be in the form name=value. From c56fe7117b6bfe5067717ed6264d06277f056853 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 10:42:52 -0400 Subject: [PATCH 2/8] Add "NONEXISTENT" to def_table --- lib/getdef.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/getdef.c b/lib/getdef.c index 00f6abfe..54c31303 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -105,6 +105,7 @@ static struct itemdef def_table[] = { {"MAIL_FILE", NULL}, {"MAX_MEMBERS_PER_GROUP", NULL}, {"MD5_CRYPT_ENAB", NULL}, + {"NONEXISTENT", NULL}, {"PASS_MAX_DAYS", NULL}, {"PASS_MIN_DAYS", NULL}, {"PASS_WARN_AGE", NULL}, From c040058fe3828fd48b01f3410b8095145fcd7f37 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 13:20:14 -0400 Subject: [PATCH 3/8] Check for "NONEXISTENT" in "src/pwck.c" --- src/pwck.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pwck.c b/src/pwck.c index be404c37..3d494a69 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -527,12 +527,16 @@ static void check_pw_file (int *errors, bool *changed) * Make sure the home directory exists */ if (!quiet && (access (pwd->pw_dir, F_OK) != 0)) { + const char *nonexistent = getdef_str("NONEXISTENT"); + /* - * Home directory doesn't exist, give a warning + * Home directory does not exist, give a warning (unless intentional) */ - printf (_("user '%s': directory '%s' does not exist\n"), - pwd->pw_name, pwd->pw_dir); - *errors += 1; + if (NULL == nonexistent || strcmp (pwd->pw_dir, nonexistent) != 0) { + printf (_("user '%s': directory '%s' does not exist\n"), + pwd->pw_name, pwd->pw_dir); + *errors += 1; + } } } From 04062cda11ea62d731e3d7d1994b2fcb6258f73b Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 14:58:31 -0400 Subject: [PATCH 4/8] Add "NONEXISTENT" to the "login.defs" man page --- man/login.defs.5.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/login.defs.5.xml b/man/login.defs.5.xml index 9e95da20..bf6c976f 100644 --- a/man/login.defs.5.xml +++ b/man/login.defs.5.xml @@ -67,6 +67,7 @@ + @@ -203,6 +204,7 @@ &MD5_CRYPT_ENAB; &MOTD_FILE; &NOLOGINS_FILE; + &NONEXISTENT; &OBSCURE_CHECKS_ENAB; &PASS_ALWAYS_WARN; &PASS_CHANGE_TRIES; From 1566921dd89b2537372d153770cb26731e528194 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 15:14:44 -0400 Subject: [PATCH 5/8] Add detailed documentation for "NONEXISTENT" --- man/login.defs.d/NONEXISTENT.xml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 man/login.defs.d/NONEXISTENT.xml diff --git a/man/login.defs.d/NONEXISTENT.xml b/man/login.defs.d/NONEXISTENT.xml new file mode 100644 index 00000000..2b1f6e47 --- /dev/null +++ b/man/login.defs.d/NONEXISTENT.xml @@ -0,0 +1,41 @@ + + + (string) + + + If a system account intentionally does not have a home directory + that exists, this string can be provided in the /etc/passwd + entry for the account to indicate this. The result is that pwck + will not emit a spurious warning for this account. + + + From 4772689d276af992f6fa7d78aa625d88f22bd9dd Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 15:17:43 -0400 Subject: [PATCH 6/8] Name "NONEXISTENT" in the man page for "pwck" --- man/pwck.8.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/pwck.8.xml b/man/pwck.8.xml index bc99605f..a196a458 100644 --- a/man/pwck.8.xml +++ b/man/pwck.8.xml @@ -30,6 +30,7 @@ --> @@ -266,6 +267,7 @@ tool: + &NONEXISTENT; &PASS_MAX_DAYS; &PASS_MIN_DAYS; &PASS_WARN_AGE; From 096dad6305cc262e8c7281572603af12d9dcd956 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 15:26:09 -0400 Subject: [PATCH 7/8] Add "NONEXISTENT.xml" to "man/Makefile.am" --- man/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/man/Makefile.am b/man/Makefile.am index 5d7cc2a4..952a4f8b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -153,6 +153,7 @@ login_defs_v = \ MD5_CRYPT_ENAB.xml \ MOTD_FILE.xml \ NOLOGINS_FILE.xml \ + NONEXISTENT.xml \ OBSCURE_CHECKS_ENAB.xml \ PASS_ALWAYS_WARN.xml \ PASS_CHANGE_TRIES.xml \ From 4086aed1ed9babf302b7cb72e07d807c699d3962 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Fri, 8 May 2020 16:21:09 -0400 Subject: [PATCH 8/8] Update the "README" file --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index cf54ca8e..f3b734d3 100644 --- a/README +++ b/README @@ -70,6 +70,7 @@ Guy Maor Hrvoje Dogan Jakub Hrozek Janos Farkas +Jason Franklin Jay Soffian Jesse Thilo Joey Hess