CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: gutteridge Date: Wed Aug 21 17:13:24 UTC 2024 Modified Files: src/usr.sbin/syslogd: syslogd.8 syslogd.c Log Message: syslogd.8 & syslogd.c: add -k option Provide a means of disabling the translation of (remote) messages received with facility kern to facility user. Feature equivalent to what FreeBSD added years ago, though the code is slightly different (a bit easier to follow expressively). Patches from RVP, provided in PR lib/57172 (with very minor tweaks by me). To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/syslogd/syslogd.8 cvs rdiff -u -r1.143 -r1.144 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.8 diff -u src/usr.sbin/syslogd/syslogd.8:1.59 src/usr.sbin/syslogd/syslogd.8:1.60 --- src/usr.sbin/syslogd/syslogd.8:1.59 Tue Nov 8 01:43:09 2022 +++ src/usr.sbin/syslogd/syslogd.8 Wed Aug 21 17:13:24 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslogd.8,v 1.59 2022/11/08 01:43:09 uwe Exp $ +.\" $NetBSD: syslogd.8,v 1.60 2024/08/21 17:13:24 gutteridge Exp $ .\" .\" Copyright (c) 1983, 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" -.Dd November 8, 2022 +.Dd August 21, 2024 .Dt SYSLOGD 8 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl nrSsTUvX +.Op Fl knrSsTUvX .Op Fl B Ar buffer_length .Op Fl b Ar bind_address .Op Fl d Op Oo Cm \&~ Oc Ns Ar what @@ -91,6 +91,15 @@ the default is Set GID to .Ar group after the sockets and log files have been opened. +.It Fl k +Disable the translation of (remote) messages received with facility +.Dq kern +to facility +.Dq user . +Usually the +.Dq kern +facility is reserved for messages read directly from +.Pa /dev/klog . .It Fl m Ar mark_interval Select the number of minutes between ``mark'' messages; the default is 20 minutes. Index: src/usr.sbin/syslogd/syslogd.c diff -u src/usr.sbin/syslogd/syslogd.c:1.143 src/usr.sbin/syslogd/syslogd.c:1.144 --- src/usr.sbin/syslogd/syslogd.c:1.143 Wed Aug 21 16:30:27 2024 +++ src/usr.sbin/syslogd/syslogd.c Wed Aug 21 17:13:24 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: syslogd.c,v 1.143 2024/08/21 16:30:27 gutteridge Exp $ */ +/* $NetBSD: syslogd.c,v 1.144 2024/08/21 17:13:24 gutteridge Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -__RCSID("$NetBSD: syslogd.c,v 1.143 2024/08/21 16:30:27 gutteridge Exp $"); +__RCSID("$NetBSD: syslogd.c,v 1.144 2024/08/21 17:13:24 gutteridge Exp $"); #endif #endif /* not lint */ @@ -205,6 +205,7 @@ bool BSDOutputFormat = true; /* if true * this, it will only break some syslog-sign * configurations (e.g. with SG="0"). */ +bool KernXlat = true; /* translate kern.* -> user.* */ char appname[] = "syslogd";/* the APPNAME for own messages */ char *include_pid; /* include PID in own messages */ char include_pid_buf[11]; @@ -319,7 +320,7 @@ main(int argc, char *argv[]) /* should we set LC_TIME="C" to ensure correct timestamps&parsing? */ (void)setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "b:B:d::nsSf:m:o:p:P:ru:g:t:TUvX")) != -1) + while ((ch = getopt(argc, argv, "b:B:d::knsSf:m:o:p:P:ru:g:t:TUvX")) != -1) switch(ch) { case 'b': bindhostname = optarg; @@ -360,6 +361,9 @@ main(int argc, char *argv[]) if (*group == '\0') usage(); break; + case 'k': /* pass-through (remote) kern.* */ + KernXlat = false; + break; case 'm': /* mark interval */ MarkInterval = atoi(optarg) * 60; break; @@ -686,7 +690,7 @@ usage(void) { (void)fprintf(stderr, - "usage: %s [-dnrSsTUvX] [-B buffer_length] [-b bind_address]\n" + "usage: %s [-dknrSsTUvX] [-B buffer_length] [-b bind_address]\n" "\t[-f config_file] [-g group]\n" "\t[-m mark_interval] [-P file_list] [-p log_socket\n" "\t[-p log_socket2 ...]] [-t chroot_dir] [-u user]\n", @@ -1549,11 +1553,11 @@ printline(const char *hname, char *msg, pri = DEFUPRI; /* - * Don't allow users to log kernel messages. + * Don't (usually) allow users to log kernel messages. * NOTE: Since LOG_KERN == 0, this will also match * messages with no facility specified. */ - if ((pri & LOG_FACMASK) == LOG_KERN) + if ((pri & LOG_FACMASK) == LOG_KERN && KernXlat) pri = LOG_USER | LOG_PRI(pri); if (bsdsyslog) {
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: gutteridge Date: Wed Aug 21 17:13:24 UTC 2024 Modified Files: src/usr.sbin/syslogd: syslogd.8 syslogd.c Log Message: syslogd.8 & syslogd.c: add -k option Provide a means of disabling the translation of (remote) messages received with facility kern to facility user. Feature equivalent to what FreeBSD added years ago, though the code is slightly different (a bit easier to follow expressively). Patches from RVP, provided in PR lib/57172 (with very minor tweaks by me). To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/syslogd/syslogd.8 cvs rdiff -u -r1.143 -r1.144 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: gutteridge Date: Sat Aug 3 02:43:37 UTC 2024 Modified Files: src/usr.sbin/syslogd: syslogd.c Log Message: syslogd.c: avoid use of undefined macro (NFCI) SIGN_NUM_PRIVALS isn't defined anywhere; fix the block, though it's not actually applicable in NetBSD builds. Issue noted by and patch from RVP as a peripheral item in PR lib/57172. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.c diff -u src/usr.sbin/syslogd/syslogd.c:1.141 src/usr.sbin/syslogd/syslogd.c:1.142 --- src/usr.sbin/syslogd/syslogd.c:1.141 Wed Oct 11 23:22:13 2023 +++ src/usr.sbin/syslogd/syslogd.c Sat Aug 3 02:43:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $ */ +/* $NetBSD: syslogd.c,v 1.142 2024/08/03 02:43:37 gutteridge Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -__RCSID("$NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $"); +__RCSID("$NetBSD: syslogd.c,v 1.142 2024/08/03 02:43:37 gutteridge Exp $"); #endif #endif /* not lint */ @@ -557,7 +557,7 @@ getgroup: #if (IETF_NUM_PRIVALUES != (LOG_NFACILITIES<<3)) logerror("Warning: system defines %d priority values, but " "syslog-protocol/syslog-sign specify %d values", - LOG_NFACILITIES, SIGN_NUM_PRIVALS); + LOG_NFACILITIES, IETF_NUM_PRIVALUES>>3); #endif /*
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: gutteridge Date: Sat Aug 3 02:43:37 UTC 2024 Modified Files: src/usr.sbin/syslogd: syslogd.c Log Message: syslogd.c: avoid use of undefined macro (NFCI) SIGN_NUM_PRIVALS isn't defined anywhere; fix the block, though it's not actually applicable in NetBSD builds. Issue noted by and patch from RVP as a peripheral item in PR lib/57172. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Sun Dec 31 23:39:27 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: syslog.conf(5): add back .Pp lost in previous To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslog.conf.5 diff -u src/usr.sbin/syslogd/syslog.conf.5:1.27 src/usr.sbin/syslogd/syslog.conf.5:1.28 --- src/usr.sbin/syslogd/syslog.conf.5:1.27 Sun Dec 31 19:41:22 2023 +++ src/usr.sbin/syslogd/syslog.conf.5 Sun Dec 31 23:39:27 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslog.conf.5,v 1.27 2023/12/31 19:41:22 uwe Exp $ +.\" $NetBSD: syslog.conf.5,v 1.28 2023/12/31 23:39:27 uwe Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -477,10 +477,11 @@ List of fingerprints of trusted client c .It Ic tls_allow_clientcerts List of filenames with trusted client certificates. .El +.Pp One function of TLS is mutual authentication of client and server. Unless authentication is disabled by setting .Ql tls_verify=off -the following rules are used: +the following rules are used. .Ss "Client Authentication" A client can be configured not to check a server's certificate by setting the
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Sun Dec 31 23:39:27 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: syslog.conf(5): add back .Pp lost in previous To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Sun Dec 31 19:41:22 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: syslog.conf(5): improve markup Use tagged lists, mark up literals, be consistent about options (global): vs parameters (of a TLS action), fold TLS authentication description into the TLS options section. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslog.conf.5 diff -u src/usr.sbin/syslogd/syslog.conf.5:1.26 src/usr.sbin/syslogd/syslog.conf.5:1.27 --- src/usr.sbin/syslogd/syslog.conf.5:1.26 Wed Sep 1 13:44:02 2021 +++ src/usr.sbin/syslogd/syslog.conf.5 Sun Dec 31 19:41:22 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslog.conf.5,v 1.26 2021/09/01 13:44:02 andvar Exp $ +.\" $NetBSD: syslog.conf.5,v 1.27 2023/12/31 19:41:22 uwe Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -43,7 +43,12 @@ The file is the configuration file for the .Xr syslogd 8 program. -It consists of extended options (lines with one key="value" assignment) +It consists of extended options +.Po +lines with one +.Ar key\^ Ns Li = Ns Ar value +assignment +.Pc and blocks of lines separated by .Em program and @@ -62,15 +67,22 @@ field is separated from the .Em action field by one or more tab characters. .Pp +Blank lines and lines whose first non-blank character is a hash +.Pq Ql # +character are ignored. +.\" +.Ss Selectors +.Pp The -.Em Selectors +.Em selector Ns s function are encoded as a .Em facility , a period -.Pq Sq \&. , -an optional set of comparison flags -.Pq Bo ! Bc Bq <=> , +.Pq Ql \&. , +an optional set of +.Em comparison flags +.Pq Oo Li \&! Oc Ns Op Li <=> , and a .Em level , with no intervening white-space. @@ -83,11 +95,31 @@ are case insensitive. The .Em facility describes the part of the system generating the message, and is one of -the following keywords: auth, authpriv, cron, ftp, daemon, kern, lpr, -mail, mark, news, syslog, user, uucp and local0 through local7. -These keywords (with the exception of mark) correspond to the -similar -.Dq Dv LOG_ +the following keywords: +.Ic auth , +.Ic authpriv , +.Ic cron , +.Ic daemon , +.Ic ftp , +.Ic kern , +.Ic lpr , +.Ic mail , +.Ic mark , +.Ic news , +.Ic syslog , +.Ic user , +.Ic uucp , +and +.Ic local0 +through +.Ic local7 . +These keywords +.Po +with the exception of +.Ic mark +.Pc +correspond to the similar +.Ql LOG_ values specified to the .Xr openlog 3 and @@ -98,32 +130,40 @@ The .Em comparison flags may be used to specify exactly what levels are logged. If unspecified, the default comparison is -.Sq >= +.Ql >= .Pq greater than or equal to , or, if the .Fl U option is passed to .Xr syslogd 8 , -.Sq = +.Ql = .Pq equal to . Comparison flags beginning with -.So ! Sc +.Ql \&! will have their logical sense inverted. Thus, -.Sq !=info +.Ql !=info means all levels except info and -.Sq !notice +.Ql !notice has the same meaning as -.Sq
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Sun Dec 31 19:41:22 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: syslog.conf(5): improve markup Use tagged lists, mark up literals, be consistent about options (global): vs parameters (of a TLS action), fold TLS authentication description into the TLS options section. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Wed Oct 11 23:22:14 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslogd.c Log Message: syslogd.c: fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Wed Oct 11 23:22:14 UTC 2023 Modified Files: src/usr.sbin/syslogd: syslogd.c Log Message: syslogd.c: fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.c diff -u src/usr.sbin/syslogd/syslogd.c:1.140 src/usr.sbin/syslogd/syslogd.c:1.141 --- src/usr.sbin/syslogd/syslogd.c:1.140 Tue Nov 8 01:43:09 2022 +++ src/usr.sbin/syslogd/syslogd.c Wed Oct 11 23:22:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $ */ +/* $NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -__RCSID("$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $"); +__RCSID("$NetBSD: syslogd.c,v 1.141 2023/10/11 23:22:13 uwe Exp $"); #endif #endif /* not lint */ @@ -1777,7 +1777,7 @@ check_timestamp(unsigned char *from_buf, */ *to_buf = strdup("-"); } else { -/* with BSD Syslog the field is reqired +/* with BSD Syslog the field is required * so replace it with current time */ *to_buf = make_timestamp(NULL, false, 0);
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: christos Date: Tue May 9 20:10:07 UTC 2023 Modified Files: src/usr.sbin/syslogd: Makefile Log Message: Handle OpenSSL-3.x To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/syslogd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/Makefile diff -u src/usr.sbin/syslogd/Makefile:1.31 src/usr.sbin/syslogd/Makefile:1.32 --- src/usr.sbin/syslogd/Makefile:1.31 Sun Mar 7 10:09:12 2021 +++ src/usr.sbin/syslogd/Makefile Tue May 9 16:10:07 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.31 2021/03/07 15:09:12 christos Exp $ +# $NetBSD: Makefile,v 1.32 2023/05/09 20:10:07 christos Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 .include @@ -32,5 +32,7 @@ LDADD+= -lssl -lcrypto # Overflow that appears impossible COPTS.syslogd.c+=${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION} +COPTS.tls.c+= -Wno-error=deprecated-declarations +COPTS.sign.c+= -Wno-error=deprecated-declarations .include
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: christos Date: Tue May 9 20:10:07 UTC 2023 Modified Files: src/usr.sbin/syslogd: Makefile Log Message: Handle OpenSSL-3.x To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/syslogd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: andvar Date: Mon May 1 11:57:53 UTC 2023 Modified Files: src/usr.sbin/syslogd: sign.html Log Message: s/betwen/between/ and s/singed/signed/. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/sign.html diff -u src/usr.sbin/syslogd/sign.html:1.1 src/usr.sbin/syslogd/sign.html:1.2 --- src/usr.sbin/syslogd/sign.html:1.1 Fri Oct 31 16:12:19 2008 +++ src/usr.sbin/syslogd/sign.html Mon May 1 11:57:53 2023 @@ -9,7 +9,7 @@ http://tools.ietf.org/html/draft-ietf-syslog-sign";>syslog-sign defines digital signatures for logfiles. This provides end-to-end authentication for network transports, enables the detection of lost UDP messages, and also makes it possible to check a log archive for later modifications (assuming the private key was kept safe). Signature Groups -A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were singed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB? +A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were signed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB? Thus the messages are selected into two signature groups containing all signatures for messages to serverA and serverB respectively. Then every server has its own messages and its own signatures to verify them. There are three predefined and one custom signature groups: @@ -22,7 +22,7 @@ Thus the messages are selected into two Configuration/Activation syslog-sign is enabled with the option "sign_sg" in syslog.conf. The value selects the signature group strategy, so for example the line "sign_sg=0" enables syslog-sign with one signature group. -The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries betwen the signature groups. +The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries between the signature groups. Example: With "sign_sg2_delim = 15 31" syslogd will set up three signature groups: one for all priorities x ≤ 15 (kernel.*,user.*), one for priorities 15 < x ≤ 31 (mail.*), and one for all priorities x > 31. Key, Signature, and Hash Types @@ -137,7 +137,7 @@ messages without signature: Martin Schütte-$Id: sign.html,v 1.1 2008/10/31 16:12:19 christos Exp $ +$Id: sign.html,v 1.2 2023/05/01 11:57:53 andvar Exp $
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: andvar Date: Mon May 1 11:57:53 UTC 2023 Modified Files: src/usr.sbin/syslogd: sign.html Log Message: s/betwen/between/ and s/singed/signed/. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:43:09 UTC 2022 Modified Files: src/usr.sbin/syslogd: syslogd.8 syslogd.c Log Message: syslogd: make -d accept an optional argument Make it possible to specify the debug message categories with an optional numeric argument. You'll have to read the fine source to find out what they are. The number can be specified as the usual decimal, hex (0x), or octal (0) literal with an optional ~negation. Since syslogd uses getopt(3), not getopt_long(3), do a bit of gymnastics so that both -d42 and -d 42 are accepted (I'm not inventing long names for all the existing options just to support an optional argument to -d). -d without an argument still uses the old D_DEFAULT selection just in case someone really relies on that. You can disable all debug messages with -d0 but still get syslogd not daemonized. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/syslogd/syslogd.8 cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:43:09 UTC 2022 Modified Files: src/usr.sbin/syslogd: syslogd.8 syslogd.c Log Message: syslogd: make -d accept an optional argument Make it possible to specify the debug message categories with an optional numeric argument. You'll have to read the fine source to find out what they are. The number can be specified as the usual decimal, hex (0x), or octal (0) literal with an optional ~negation. Since syslogd uses getopt(3), not getopt_long(3), do a bit of gymnastics so that both -d42 and -d 42 are accepted (I'm not inventing long names for all the existing options just to support an optional argument to -d). -d without an argument still uses the old D_DEFAULT selection just in case someone really relies on that. You can disable all debug messages with -d0 but still get syslogd not daemonized. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/syslogd/syslogd.8 cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/syslogd/syslogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.8 diff -u src/usr.sbin/syslogd/syslogd.8:1.58 src/usr.sbin/syslogd/syslogd.8:1.59 --- src/usr.sbin/syslogd/syslogd.8:1.58 Mon Nov 5 09:22:30 2018 +++ src/usr.sbin/syslogd/syslogd.8 Tue Nov 8 01:43:09 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslogd.8,v 1.58 2018/11/05 09:22:30 wiz Exp $ +.\" $NetBSD: syslogd.8,v 1.59 2022/11/08 01:43:09 uwe Exp $ .\" .\" Copyright (c) 1983, 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" -.Dd November 4, 2018 +.Dd November 8, 2022 .Dt SYSLOGD 8 .Os .Sh NAME @@ -37,9 +37,10 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl dnrSsTUvX +.Op Fl nrSsTUvX .Op Fl B Ar buffer_length .Op Fl b Ar bind_address +.Op Fl d Op Oo Cm \&~ Oc Ns Ar what .Op Fl f Ar config_file .Op Fl g Ar group .Op Fl m Ar mark_interval @@ -68,9 +69,20 @@ option. Specify one specific IP address or hostname to bind to. If a hostname is specified, the IPv4 or IPv6 address which corresponds to it is used. -.It Fl d -Enable debugging to the standard output, -and do not disassociate from the controlling terminal. +.It Fl d Op Oo Cm \&~ Oc Ns Ar what +Do not disassociate from the controlling terminal and +enable debugging to the standard output. +The optional +.Ar what +argument is a number that selects which categories of the debug +messages are to be enabled. +A tilde +.Pq Sq Cm \&~ +before +.Ar what +inverts its meaning so that all messages except those selected by +.Ar what +are enabled. .It Fl f Ar config_file Specify the pathname of an alternative configuration file; the default is Index: src/usr.sbin/syslogd/syslogd.c diff -u src/usr.sbin/syslogd/syslogd.c:1.139 src/usr.sbin/syslogd/syslogd.c:1.140 --- src/usr.sbin/syslogd/syslogd.c:1.139 Fri May 20 19:34:23 2022 +++ src/usr.sbin/syslogd/syslogd.c Tue Nov 8 01:43:09 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: syslogd.c,v 1.139 2022/05/20 19:34:23 andvar Exp $ */ +/* $NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #else -__RCSID("$NetBSD: syslogd.c,v 1.139 2022/05/20 19:34:23 andvar Exp $"); +__RCSID("$NetBSD: syslogd.c,v 1.140 2022/11/08 01:43:09 uwe Exp $"); #endif #endif /* not lint */ @@ -212,6 +212,7 @@ char include_pid_buf[11]; /* init and setup */ void usage(void) __attribute__((__noreturn__)); +void set_debug(const char *); void logpath_add(char ***, int *, int *, const char *); void logpath_fileadd(char ***, int *, int *, const char *); void init(int fd, short event, void *ev); /* SIGHUP kevent dispatch routine */ @@ -318,7 +319,7 @@ main(int argc, char *argv[]) /* should we set LC_TIME="C" to ensure correct timestamps&parsing? */ (void)setlocale(LC_ALL, ""); - while ((ch = getopt(argc, argv, "b:B:dnsSf:m:o:p:P:ru:g:t:TUvX")) != -1) + while ((ch = getopt(argc, argv, "b:B:d::nsSf:m:o:p:P:ru:g:t:TUvX")) != -1) switch(ch) { case 'b': bindhostname = optarg; @@ -329,9 +330,27 @@ main(int argc, char *argv[]) buflen = RCVBUFLEN; break; case 'd': /* debug */ - Debug = D_DEFAULT; - /* is there a way to read the integer value - * for Debug as an optional argument? */ + if (optarg != NULL) { +/* + * getopt passes as optarg everything + * after 'd' in -darg, manually accept + * -d=arg too. + */ +if (optarg[0] == '=') + ++optarg; + } else if (optind < argc) { +/* + * :: treats "-d ..." as missing + * optarg, so look ahead manually and + * pick up the next arg if it looks + * like one. + */ +if (argv[optind][0] != '-') { + optarg = argv[optind]; +
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:05:10 UTC 2022 Modified Files: src/usr.sbin/syslogd: tls.c Log Message: tls.c: wrap debug-only data in #ifndef NDEBUG To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:05:10 UTC 2022 Modified Files: src/usr.sbin/syslogd: tls.c Log Message: tls.c: wrap debug-only data in #ifndef NDEBUG To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/syslogd/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/tls.c diff -u src/usr.sbin/syslogd/tls.c:1.20 src/usr.sbin/syslogd/tls.c:1.21 --- src/usr.sbin/syslogd/tls.c:1.20 Sun May 15 20:37:51 2022 +++ src/usr.sbin/syslogd/tls.c Tue Nov 8 01:05:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tls.c,v 1.20 2022/05/15 20:37:51 andvar Exp $ */ +/* $NetBSD: tls.c,v 1.21 2022/11/08 01:05:10 uwe Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__RCSID("$NetBSD: tls.c,v 1.20 2022/05/15 20:37:51 andvar Exp $"); +__RCSID("$NetBSD: tls.c,v 1.21 2022/11/08 01:05:10 uwe Exp $"); #ifndef DISABLE_TLS #include @@ -57,6 +57,7 @@ __RCSID("$NetBSD: tls.c,v 1.20 2022/05/1 static unsigned getVerifySetting(const char *x509verifystring); +#ifndef NDEBUG /* to output SSL error codes */ static const char *SSL_ERRCODE[] = { "SSL_ERROR_NONE", @@ -81,6 +82,7 @@ static const char *TLS_CONN_STATES[] = { "ST_CLOSING0", "ST_CLOSING1", "ST_CLOSING2"}; +#endif /* !NDEBUG */ DH *get_dh1024(void); /* DH parameter precomputed with "openssl dhparam -C -2 1024" */
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:03:27 UTC 2022 Modified Files: src/usr.sbin/syslogd: sign.c Log Message: sign.c: mark a variable used only in asserts as __diagused To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/syslogd/sign.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: uwe Date: Tue Nov 8 01:03:27 UTC 2022 Modified Files: src/usr.sbin/syslogd: sign.c Log Message: sign.c: mark a variable used only in asserts as __diagused To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/syslogd/sign.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/sign.c diff -u src/usr.sbin/syslogd/sign.c:1.8 src/usr.sbin/syslogd/sign.c:1.9 --- src/usr.sbin/syslogd/sign.c:1.8 Sat Nov 27 22:30:26 2021 +++ src/usr.sbin/syslogd/sign.c Tue Nov 8 01:03:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $ */ +/* $NetBSD: sign.c,v 1.9 2022/11/08 01:03:27 uwe Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__RCSID("$NetBSD: sign.c,v 1.8 2021/11/27 22:30:26 rillig Exp $"); +__RCSID("$NetBSD: sign.c,v 1.9 2022/11/08 01:03:27 uwe Exp $"); #ifndef DISABLE_SIGN #include "syslogd.h" @@ -514,7 +514,7 @@ sign_send_certificate_block(struct signa char *tstamp; char payload[SIGN_MAX_PAYLOAD_LENGTH]; char sd[SIGN_MAX_SD_LENGTH]; - size_t payload_len, sd_len, fragment_len; + size_t payload_len, fragment_len; size_t payload_index = 0; /* do nothing if CBs already sent or if there was no message in SG */ @@ -540,6 +540,7 @@ sign_send_certificate_block(struct signa fragment_len = SIGN_MAX_FRAG_LENGTH; /* format SD */ + size_t sd_len __diagused; sd_len = snprintf(sd, sizeof(sd), "[ssign-cert " "VER=\"%s\" RSID=\"%" PRIuFAST64 "\" SG=\"%d\" " "SPRI=\"%d\" TBPL=\"%zu\" INDEX=\"%zu\" "
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: andvar Date: Wed Sep 1 13:44:02 UTC 2021 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: s/optons/options/ To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslog.conf.5 diff -u src/usr.sbin/syslogd/syslog.conf.5:1.25 src/usr.sbin/syslogd/syslog.conf.5:1.26 --- src/usr.sbin/syslogd/syslog.conf.5:1.25 Mon Jul 3 21:35:32 2017 +++ src/usr.sbin/syslogd/syslog.conf.5 Wed Sep 1 13:44:02 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslog.conf.5,v 1.25 2017/07/03 21:35:32 wiz Exp $ +.\" $NetBSD: syslog.conf.5,v 1.26 2021/09/01 13:44:02 andvar Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -477,7 +477,7 @@ On any match the client is authenticated .Sh BUFFERING .Xr syslogd 8 is able to buffer temporary not writable messages in memory. -To limit the memory consumed for this buffering the following optons may be +To limit the memory consumed for this buffering the following options may be given: .Bl -ohang .It Em file_queue_length
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: andvar Date: Wed Sep 1 13:44:02 UTC 2021 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: s/optons/options/ To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: hannken Date: Thu Oct 24 08:21:18 UTC 2019 Modified Files: src/usr.sbin/syslogd: tls.c Log Message: With TLSv1.3 a client has to receive and process metadata. Update dispatch_tls_eof() to check for metadata and rearm on success. Ok: christos@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/syslogd/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/tls.c diff -u src/usr.sbin/syslogd/tls.c:1.16 src/usr.sbin/syslogd/tls.c:1.17 --- src/usr.sbin/syslogd/tls.c:1.16 Thu Feb 8 17:45:29 2018 +++ src/usr.sbin/syslogd/tls.c Thu Oct 24 08:21:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $ */ +/* $NetBSD: tls.c,v 1.17 2019/10/24 08:21:18 hannken Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__RCSID("$NetBSD: tls.c,v 1.16 2018/02/08 17:45:29 christos Exp $"); +__RCSID("$NetBSD: tls.c,v 1.17 2019/10/24 08:21:18 hannken Exp $"); #ifndef DISABLE_TLS #include @@ -1450,7 +1450,7 @@ dispatch_socket_accept(int fd, short eve * * I do not know if libevent can tell us the difference * between available data and an EOF. But it does not matter - * because there should not be any incoming data. + * because there should not be any incoming data beside metadata. * So we close the connection either because the peer closed its * side or because the peer broke the protocol by sending us stuff ;-) */ @@ -1460,11 +1460,26 @@ dispatch_tls_eof(int fd, short event, vo struct tls_conn_settings *conn_info = (struct tls_conn_settings *) arg; sigset_t newmask, omask; struct timeval tv; + int rc; + char buf[1]; BLOCK_SIGNALS(omask, newmask); DPRINTF((D_TLS|D_EVENT|D_CALL), "dispatch_eof_tls(%d, %d, %p)\n", fd, event, arg); assert(conn_info->state == ST_TLS_EST); + + /* First check for incoming metadata. */ + ST_CHANGE(conn_info->state, ST_READING); + rc = SSL_read(conn_info->sslptr, buf, sizeof(buf)); + ST_CHANGE(conn_info->state, ST_TLS_EST); + if (rc <= 0 && tls_examine_error("SSL_read()", conn_info->sslptr, + conn_info, rc) == TLS_RETRY_READ) { + /* Connection is still alive, rearm and return. */ + EVENT_ADD(conn_info->event); + RESTORE_SIGNALS(omask); + return; + } + ST_CHANGE(conn_info->state, ST_EOF); DEL_EVENT(conn_info->event);
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: hannken Date: Thu Oct 24 08:21:18 UTC 2019 Modified Files: src/usr.sbin/syslogd: tls.c Log Message: With TLSv1.3 a client has to receive and process metadata. Update dispatch_tls_eof() to check for metadata and rearm on success. Ok: christos@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/syslogd/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/usr.sbin/syslogd
On Jun 20, 2:42am, u...@stderr.spb.ru ("Valeriy E. Ushakov") wrote: -- Subject: Re: CVS commit: src/usr.sbin/syslogd | On Tue, Jun 19, 2012 at 09:44:35 -0400, Christos Zoulas wrote: | | > Module Name:src | > Committed By: christos | > Date: Tue Jun 19 13:44:35 UTC 2012 | > | > Modified Files: | > src/usr.sbin/syslogd: syslogd.c | > | > Log Message: | > - fix writev1() to pre-decrement count. | > - always open ttys with O_NDELAY. | > | > | > To generate a diff of this commit: | > cvs rdiff -u -r1.110 -r1.111 src/usr.sbin/syslogd/syslogd.c | | Hmm... Why is this necessary: | | f->f_file = open(f->f_un.f_fname, | - O_WRONLY|O_APPEND|O_NDELAY, 0); | + O_WRONLY|O_APPEND|O_NDELAY|O_NONBLOCK, 0); | | given that O_NDELAY is a compat name for O_NONBLOCK (that is, modulo | whatever historic quirks O_NDELAY had that I totally forgot about, but | in our sys/fcntl.h it's just an alias). | | | Ditto here: | | - if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) { | + if ((f->f_file = open(p, O_WRONLY|O_APPEND|O_NDELAY, 0)) < 0) { | | given that you still call fcntl afterwards. I shouldn't... I will remove it. christos
Re: CVS commit: src/usr.sbin/syslogd
On Tue, Jun 19, 2012 at 09:44:35 -0400, Christos Zoulas wrote: > Module Name: src > Committed By: christos > Date: Tue Jun 19 13:44:35 UTC 2012 > > Modified Files: > src/usr.sbin/syslogd: syslogd.c > > Log Message: > - fix writev1() to pre-decrement count. > - always open ttys with O_NDELAY. > > > To generate a diff of this commit: > cvs rdiff -u -r1.110 -r1.111 src/usr.sbin/syslogd/syslogd.c Hmm... Why is this necessary: f->f_file = open(f->f_un.f_fname, - O_WRONLY|O_APPEND|O_NDELAY, 0); + O_WRONLY|O_APPEND|O_NDELAY|O_NONBLOCK, 0); given that O_NDELAY is a compat name for O_NONBLOCK (that is, modulo whatever historic quirks O_NDELAY had that I totally forgot about, but in our sys/fcntl.h it's just an alias). Ditto here: - if ((f->f_file = open(p, O_WRONLY|O_APPEND, 0)) < 0) { + if ((f->f_file = open(p, O_WRONLY|O_APPEND|O_NDELAY, 0)) < 0) { given that you still call fcntl afterwards. -uwe
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: wiz Date: Fri Jan 1 21:44:08 UTC 2010 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: Fix previous: Dd argument and lost Em markup. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: mbalmer Date: Fri Jan 1 21:26:18 UTC 2010 Modified Files: src/usr.sbin/syslogd: syslog.conf.5 Log Message: fold long lines. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/syslogd/syslog.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.