commit abe908923cdb8959c6f55cee510031ca9b08a79d from: Stefan Sperling date: Mon Oct 02 16:43:34 2023 UTC add commands to control syslogd Currently supported syslog commands: syslog no syslog syslog reload syslog inet4 no syslog inet4 syslog inet6 no syslog inet6 syslog socket PATH syslog custom-ca PATH syslog system-ca syslog client-cert PATH no syslog client-cert syslog client-key PATH no syslog client-key syslog loghost no syslog loghost commit - c8444142f7beed84d043687e0c6239b04bb9f522 commit + abe908923cdb8959c6f55cee510031ca9b08a79d blob - 7204cdd776c24d46383df73c5c9e70d9df04d819 blob + cedf31c73154b6303eec26ba56a2005caeb4c517 --- commands.c +++ commands.c @@ -1744,6 +1744,7 @@ static char sshhelp[] = "SSH connection to remote host", telnethelp[] = "Telnet connection to remote host", crontabhelp[] = "Configure scheduled background jobs", + sysloghelp[] = "Configure system logging", quithelp[] = "Close current connection", exithelp[] = "Leave configuration mode and return to privileged mode", verbosehelp[] = "Set verbose diagnostics", @@ -1843,6 +1844,7 @@ Command cmdtab[] = { { "motd", motdhelp, CMPL(t) (char **)ctl_motd, ssctl, ctlhandler, 1, 1, 0, 1 }, { "crontab", crontabhelp, CMPL(t) (char **)ctl_crontab, ssctl, ctlhandler, 1, 1, 0, 1 }, { "scheduler", crontabhelp, CMPL(t) (char **)ctl_crontab, ssctl, ctlhandler, 1, 1, 0, 1 }, + { "syslog", sysloghelp, CMPL0 NULL, ssctl2, ctlhandler, 1, 1, 1, 0 }, { "inet", inethelp, CMPL(t) (char **)ctl_inet, ssctl, ctlhandler, 1, 1, 0, 1 }, { "ping", pinghelp, CMPL0 0, 0, ping, 0, 0, 0, 0 }, { "ping6", ping6help, CMPL0 0, 0, ping6, 0, 0, 0, 0 }, blob - 8b7578ecc43d1ab35f18bb10d0cee8dd99f424e8 blob + 285df6427b79aa32de81c8b4a6c472ce96e25679 --- conf.c +++ conf.c @@ -296,6 +296,9 @@ conf(FILE *output) fprintf(output, "!\n"); conf_nameserver(output); + fprintf(output, "!\n"); + conf_rcctl("syslogd", "syslog", 0, output); + return(0); } blob - f37126dafbe6151b22e25e7425563a4b45b42dcf blob + 25d88b3d76d3ea1ab0e46f339d3eeaca39f0c45a --- ctl.c +++ ctl.c @@ -133,6 +133,7 @@ struct daemons ctl_daemons[] = { struct daemons2 ctl_daemons2[] = { { "dhcp", "DHCP", ctl_dhcp, DHCPCONF_TEMP, 0600, 0, RT_TABLEID_MAX }, +{ "syslog", "SYSLOG", ctl_syslog, NULL, 0, 0, 0 }, { NULL, NULL, NULL, NULL, 0, 0, 0 } }; @@ -458,6 +459,52 @@ struct ctl2 ctl_dhcp[] = { { NULL, NULL, NULL, { NULL }, { NULL }, NULL, 0, NULL, 0, 0 } }; +/* syslog */ +struct ctl2 ctl_syslog[] = { + { "", "enable syslog daemon", "disable syslog dameon", + { "syslogd", "syslog", NULL }, { NULL, }, + rcctl_enable, DB_X_ENABLE_DEFAULT, + rcctl_disable, DB_X_DISABLE_ALWAYS, T_HANDLER }, + { "reload", "reload syslog daemon", NULL, + { "syslogd", "syslog", NULL }, { NULL, }, + rcctl_reload, 0, NULL, 0, T_HANDLER }, + { "inet4", "listen on UDP IPv4 only", "disable IPv4-only mode", + { "syslogd", "inet4", "-6", "", "-4", "", NULL }, { NULL }, + rcctl_flag_replace, 0, rcctl_flag_clear6, 0, T_HANDLER }, + { "inet6", "listen on UDP IPv6 only", "disable IPv6-only mode", + { "syslogd", "inet6", "-4", "", "-6", "", NULL }, { NULL }, + rcctl_flag_replace, 0, rcctl_flag_clear6, 0, T_HANDLER }, + { "socket", "path to additional log socket", "remove log socket", + { "syslogd", "socket", "-a", REQ, NULL }, { NULL }, + rcctl_flag_set, 0, rcctl_flag_clear, 0, T_HANDLER }, + { "custom-ca", "path to custom CA certificate", NULL, + { "syslogd", "custom-ca", "-C", REQ, NULL }, { NULL }, + rcctl_flag_set, 0, NULL, 0, T_HANDLER }, + { "system-ca", "use /etc/ssl/cert.pem instead of custom CA", NULL, + { "syslogd", "system-ca", "-C", "", NULL }, { NULL }, + rcctl_flag_clear, 0, NULL, 0, T_HANDLER }, + { "client-cert", "path to client certificate", NULL, + { "syslogd", "client-cert", "-c", + OPT /* optional such that "no client-cert" will work */, + NULL }, { NULL }, + rcctl_flag_set_require_arg, 0, rcctl_flag_clear, 0, T_HANDLER }, + { "client-key", "path to client private key", NULL, + { "syslogd", "client-key", "-k", + OPT /* optional such that "no client-key" will work */, + NULL }, { NULL }, + rcctl_flag_set_require_arg, 0, rcctl_flag_clear, 0, T_HANDLER }, + { "client-ca", "path to CA for client cert verification", NULL, + { "syslogd", "client-ca", "-K", + OPT /* optional such that "no client-ca" will work */, + NULL }, { NULL }, + rcctl_flag_set_require_arg, 0, rcctl_flag_clear, 0, T_HANDLER }, + { "loghost", "send hostname in messages to remote loghost", + "do not show hostname in messages to remote loghost", + { "syslogd", "loghost", "-h", "", NULL }, { NULL }, + rcctl_flag_set, 0, rcctl_flag_clear, 0, T_HANDLER }, + { NULL, NULL, NULL, { NULL }, { NULL }, NULL, 0, NULL, 0, 0 } +}; + /* snmpd, snmpctl */ char *ctl_snmp_test[] = { SNMPD, "-nf", REQTEMP, NULL }; struct ctl ctl_snmp[] = { blob - 1e2ba7495352a561d0f854108777530ad4546c2e blob + d764bc6a40bdc214370c9ab28d60b345f09cad12 --- ctl.h +++ ctl.h @@ -192,6 +192,7 @@ extern struct ctl ctl_dvmrp[]; extern struct ctl ctl_rad[]; extern struct ctl ctl_sasync[]; extern struct ctl2 ctl_dhcp[]; +extern struct ctl2 ctl_syslog[]; extern struct ctl ctl_snmp[]; extern struct ctl ctl_smtp[]; extern struct ctl ctl_sshd[];