Skip to content

Commit 6a1fe42

Browse files
committed
Disable log_passwords by default in sudoers and sudo_logsrvd.conf.
Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 942efe6 commit 6a1fe42

File tree

10 files changed

+28
-21
lines changed

10 files changed

+28
-21
lines changed

docs/sudo_logsrvd.conf.man.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ when the
629629
option is set), only the
630630
first character of the password will be replaced in the I/O log.
631631
The default value is
632-
\fItrue\fR.
632+
\fIfalse\fR.
633633
.TP 6n
634634
maxseq = number
635635
The maximum sequence number that will be substituted for the
@@ -1049,9 +1049,10 @@ Sudo log server configuration file
10491049
# specified by iolog_mode.
10501050
#iolog_mode = 0600
10511051

1052-
# If disabled, sudo_logsrvd will attempt to avoid logging plaintext
1052+
# By default, sudo_logsrvd will attempt to avoid logging plaintext
10531053
# password in the terminal input using passprompt_regex.
1054-
#log_passwords = true
1054+
# If log_passwords is enabled, these checks are not performed.
1055+
#log_passwords = false
10551056

10561057
# The maximum sequence number that will be substituted for the "%{seq}"
10571058
# escape in the I/O log file. While the value substituted for "%{seq}"

docs/sudo_logsrvd.conf.mdoc.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ when the
561561
option is set), only the
562562
first character of the password will be replaced in the I/O log.
563563
The default value is
564-
.Em true .
564+
.Em false .
565565
.It maxseq = number
566566
The maximum sequence number that will be substituted for the
567567
.Dq %{seq}
@@ -968,9 +968,10 @@ Sudo log server configuration file
968968
# specified by iolog_mode.
969969
#iolog_mode = 0600
970970

971-
# If disabled, sudo_logsrvd will attempt to avoid logging plaintext
971+
# By default, sudo_logsrvd will attempt to avoid logging plaintext
972972
# password in the terminal input using passprompt_regex.
973-
#log_passwords = true
973+
# If log_passwords is enabled, these checks are not performed.
974+
#log_passwords = false
974975

975976
# The maximum sequence number that will be substituted for the "%{seq}"
976977
# escape in the I/O log file. While the value substituted for "%{seq}"

docs/sudo_logsrvd.man.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1717
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818
.\"
19-
.TH "SUDO_LOGSRVD" "@mansectsu@" "October 17, 2025" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
19+
.TH "SUDO_LOGSRVD" "@mansectsu@" "October 25, 2025" "Sudo @PACKAGE_VERSION@" "System Manager's Manual"
2020
.nh
2121
.if n .ad l
2222
.SH "NAME"

docs/sudo_logsrvd.mdoc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1616
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
.\"
18-
.Dd October 17, 2025
18+
.Dd October 25, 2025
1919
.Dt SUDO_LOGSRVD @mansectsu@
2020
.Os Sudo @PACKAGE_VERSION@
2121
.Sh NAME

docs/sudoers.man.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
.nr BA @BAMAN@
2727
.nr LC @LCMAN@
2828
.nr PS @PSMAN@
29-
.TH "SUDOERS" "@mansectform@" "September 26, 2025" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
29+
.TH "SUDOERS" "@mansectform@" "October 25, 2025" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
3030
.nh
3131
.if n .ad l
3232
.SH "NAME"
@@ -3025,7 +3025,7 @@ or
30253025
\fIlog_ttyin\fR
30263026
are also set.
30273027
This flag is
3028-
\fIon\fR
3028+
\fIoff\fR
30293029
by default.
30303030
.sp
30313031
This setting is only supported by version 1.9.10 or higher.
@@ -6865,9 +6865,11 @@ In most cases, logging the command output via
68656865
or
68666866
\fRLOG_OUTPUT\fR
68676867
is all that is required.
6868-
When logging input, consider disabling the
6868+
When logging input, avoid enabling the
68696869
\fIlog_passwords\fR
6870-
flag.
6870+
flag unless absolutely necessary and extend the
6871+
\fIpassprompt_regex\fR
6872+
setting with additional password prompt patterns used on your system.
68716873
.PP
68726874
Since each session's I/O logs are stored in a separate directory,
68736875
traditional log rotation utilities cannot be used to limit the

docs/sudoers.mdoc.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
.nr BA @BAMAN@
2626
.nr LC @LCMAN@
2727
.nr PS @PSMAN@
28-
.Dd September 26, 2025
28+
.Dd October 25, 2025
2929
.Dt SUDOERS @mansectform@
3030
.Os Sudo @PACKAGE_VERSION@
3131
.Sh NAME
@@ -2860,7 +2860,7 @@ or
28602860
.Em log_ttyin
28612861
are also set.
28622862
This flag is
2863-
.Em on
2863+
.Em off
28642864
by default.
28652865
.Pp
28662866
This setting is only supported by version 1.9.10 or higher.
@@ -6369,9 +6369,11 @@ In most cases, logging the command output via
63696369
or
63706370
.Dv LOG_OUTPUT
63716371
is all that is required.
6372-
When logging input, consider disabling the
6372+
When logging input, avoid enabling the
63736373
.Em log_passwords
6374-
flag.
6374+
flag unless absolutely necessary and extend the
6375+
.Em passprompt_regex
6376+
setting with additional password prompt patterns used on your system.
63756377
.Pp
63766378
Since each session's I/O logs are stored in a separate directory,
63776379
traditional log rotation utilities cannot be used to limit the

examples/sudo_logsrvd.conf.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@
177177
# specified by iolog_mode.
178178
#iolog_mode = 0600
179179

180-
# If disabled, sudo_logsrvd will attempt to avoid logging plaintext
180+
# By default, sudo_logsrvd will attempt to avoid logging plaintext
181181
# password in the terminal input using passprompt_regex.
182-
#log_passwords = true
182+
# If log_passwords is enabled, these checks are not performed.
183+
#log_passwords = false
183184

184185
# The maximum sequence number that will be substituted for the "%{seq}"
185186
# escape in the I/O log file. While the value substituted for "%{seq}"

logsrvd/logsrvd_conf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ logsrvd_conf_alloc(void)
16861686
config->iolog.uid = ROOT_UID;
16871687
config->iolog.gid = ROOT_GID;
16881688
config->iolog.gid_set = false;
1689-
config->iolog.log_passwords = true;
1689+
config->iolog.log_passwords = false;
16901690

16911691
/* Event log defaults */
16921692
config->eventlog.log_type = EVLOG_SYSLOG;

plugins/sudoers/defaults.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ init_defaults(void)
609609
def_ignore_audit_errors = true;
610610
def_ignore_iolog_errors = false;
611611
def_ignore_logfile_errors = true;
612-
def_log_passwords = true;
612+
def_log_passwords = false;
613613
#ifdef SUDOERS_LOG_CLIENT
614614
def_log_server_timeout = 30;
615615
def_log_server_verify = true;

plugins/sudoers/iolog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static struct sudoers_io_operations {
6464

6565
static struct log_details iolog_details;
6666
static bool warned = false;
67-
static bool log_passwords = true;
67+
static bool log_passwords = false;
6868
static int iolog_dir_fd = -1;
6969
static struct timespec last_time;
7070
static void *passprompt_regex_handle;

0 commit comments

Comments
 (0)