Add a command-line option `-I' to disable logging from UDP.

Document `-d' and `-I'.  Add a BUGS section noting that
logging from UDP is an unauthenticated remote disk-filling service,
and probably should be disabled by default in the absence of some sort
of authentication.
This commit is contained in:
wollman 1995-10-12 17:18:39 +00:00
parent 48d6205e5f
commit 8ecfa575bd
2 changed files with 38 additions and 14 deletions

View File

@ -30,8 +30,9 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
.\" $Id$
.\" .\"
.Dd June 6, 1993 .Dd October 12, 1995
.Dt SYSLOGD 8 .Dt SYSLOGD 8
.Os BSD 4.2 .Os BSD 4.2
.Sh NAME .Sh NAME
@ -39,6 +40,7 @@
.Nd log systems messages .Nd log systems messages
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm syslogd .Nm syslogd
.Op Fl dI
.Op Fl f Ar config_file .Op Fl f Ar config_file
.Op Fl m Ar mark_interval .Op Fl m Ar mark_interval
.Op Fl p Ar log_socket .Op Fl p Ar log_socket
@ -48,10 +50,17 @@ reads and logs messages to the system console, log files, other
machines and/or users as specified by its configuration file. machines and/or users as specified by its configuration file.
The options are as follows: The options are as follows:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl d
Put
.Nm syslogd
into debugging mode. This is probably only of use to developers working on
.Nm syslogd .
.It Fl f .It Fl f
Specify the pathname of an alternate configuration file; Specify the pathname of an alternate configuration file;
the default is the default is
.Pa /etc/syslog.conf . .Pa /etc/syslog.conf .
.It Fl I
Do not log messages received in UDP packets.
.It Fl m .It Fl m
Select the number of minutes between ``mark'' messages; Select the number of minutes between ``mark'' messages;
the default is 20 minutes. the default is 20 minutes.
@ -120,3 +129,10 @@ The
.Nm .Nm
command appeared in command appeared in
.Bx 4.3 . .Bx 4.3 .
.Sh BUGS
The ability to log messages received in UDP packets is equivalent to
an unauthenticated remote disk-filling service, and should probably be
disabled by default. Some sort of
.No inter- Ns Nm syslogd
authentication mechanism ought to be worked out.

View File

@ -32,13 +32,14 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1983, 1988, 1993, 1994\n\ "@(#) Copyright (c) 1983, 1988, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ /*
#ifndef lint
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
*/
static const char rcsid[] =
"$Id$";
#endif /* not lint */ #endif /* not lint */
/* /*
@ -103,10 +104,10 @@ static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#define SYSLOG_NAMES #define SYSLOG_NAMES
#include <sys/syslog.h> #include <sys/syslog.h>
char *LogName = _PATH_LOG; const char *LogName = _PATH_LOG;
char *ConfFile = _PATH_LOGCONF; const char *ConfFile = _PATH_LOGCONF;
char *PidFile = _PATH_LOGPID; const char *PidFile = _PATH_LOGPID;
char ctty[] = _PATH_CONSOLE; const char ctty[] = _PATH_CONSOLE;
#define FDMASK(fd) (1 << (fd)) #define FDMASK(fd) (1 << (fd))
@ -213,13 +214,15 @@ main(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];
{ {
int ch, funix, i, inetm, fklog, klogm, len; int ch, funix, i, inetm, fklog, klogm, len, noudp;
struct sockaddr_un sunx, fromunix; struct sockaddr_un sunx, fromunix;
struct sockaddr_in sin, frominet; struct sockaddr_in sin, frominet;
FILE *fp; FILE *fp;
char *p, line[MSG_BSIZE + 1]; char *p, line[MSG_BSIZE + 1];
while ((ch = getopt(argc, argv, "df:m:p:")) != EOF) noudp = 0;
while ((ch = getopt(argc, argv, "df:Im:p:")) != EOF)
switch(ch) { switch(ch) {
case 'd': /* debug */ case 'd': /* debug */
Debug++; Debug++;
@ -227,6 +230,9 @@ main(argc, argv)
case 'f': /* configuration file */ case 'f': /* configuration file */
ConfFile = optarg; ConfFile = optarg;
break; break;
case 'I': /* disable logging from UDP packets */
noudp = 1;
break;
case 'm': /* mark interval */ case 'm': /* mark interval */
MarkInterval = atoi(optarg) * 60; MarkInterval = atoi(optarg) * 60;
break; break;
@ -276,7 +282,8 @@ main(argc, argv)
die(0); die(0);
} else } else
created_lsock = 1; created_lsock = 1;
finet = socket(AF_INET, SOCK_DGRAM, 0);
finet = noudp ? -1 : socket(AF_INET, SOCK_DGRAM, 0);
inetm = 0; inetm = 0;
if (finet >= 0) { if (finet >= 0) {
struct servent *sp; struct servent *sp;
@ -370,8 +377,9 @@ void
usage() usage()
{ {
(void)fprintf(stderr, fprintf(stderr,
"usage: syslogd [-f conffile] [-m markinterval] [-p logpath]\n"); "usage: syslogd [-di] [-f conffile] [-m markinterval]"
" [-p logpath]\n");
exit(1); exit(1);
} }