summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/syslogd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Document certificate handling in syslogd(8) man page.bluhm2016-09-231-4/+4
| | | | Written together with jmc@
* With the new large socket buffer sizes, syslogd could use more mbufsbluhm2016-09-231-3/+18
| | | | | | | | for TCP or TLS connections than before. It makes no sense to buffer messages in kernel, the dynamic limit there makes testing the dropped message statistics unreliable. Syslog has no high performance requirements, so limit all TCP socket buffers to 64 KB. OK henning@ deraadt@
* Add an option to give syslogd a server CA that is used to validatebluhm2016-09-211-7/+22
| | | | | | client certificates. This prevent that malicious clients can send fake messages. OK deraadt@
* Add more information to syslogd tls config error messages.bluhm2016-08-291-9/+23
| | | | OK millert@
* By using the new tls_config_load_file() feature, syslogd(8) certificatebluhm2016-08-171-111/+38
| | | | | and key loading can be simplified. OK jsing@
* Adjust existing tls_config_set_cipher() callers for TLS cipher groupjsing2016-07-131-2/+2
| | | | | | | changes - map the previous configuration to the equivalent in the new groups. This will be revisited post release. Discussed with beck@
* Add support for TLS client certificates in syslogd. This allows abluhm2016-07-121-5/+40
| | | | | | remote server to verify that the log messages from our syslogd are authentic. From Kapetanakis Giannis; man page input jmc@; OK jung@ deraadt@
* Allow space-deliminated fields in syslog.conf in addition tomillert2016-07-061-8/+8
| | | | | traditional tabs-deliminated fields. This is consistent with what FreeBSD, NetBSD and Linux do. Adapted from FreeBSD.
* Avoid printing f->f_lasttime and/or f->f_prevhost if they are empty.millert2016-07-011-8/+24
| | | | | | This fixes a long-standing issue where syslogd would print 15 NUL bytes followed by two blank spaces before the log message for warnings generated while parsing syslog.conf. OK bluhm@
* Include errno string in log message when we fail to open a file.millert2016-07-011-5/+5
| | | | | The privileged process sends the errno value back when it cannot open a file. OK gilles@
* Eliminate superfluous 3rd params in fcntl(F_GETFL) calls.krw2016-04-021-5/+7
| | | | | | | | | | | | ttymsg.c doesn't need to include fcntl.h. Tweak standard fd sanitising to be more like the sanitise_stdfd() used elsewhere, though other uses of 'nullfd' make importing sanitise_stdfd() itself unappetizing. Add a die(0) if dup2() fails. suggestions & ok bluhm@
* Prevent an integer overflow in syslogd when parsing the priority.bluhm2016-02-171-15/+34
| | | | From Michael Savage; input and OK mmcc@
* When running syslogd in debug mode, use a callback to print thebluhm2015-12-291-1/+10
| | | | | | libevent messages. Before the code was removed from libevent, the library itself printed that to stderr. OK nicm@
* Adding mark messages to log files was broken since OpenBSD 5.7.bluhm2015-12-161-1/+8
| | | | | | The mark timeout event is not persistent, add the timer intervall everytime it fires. Bug report, analysis and fix from Einfach Jemand rru.142 at gmail.com
* If loading the CA certificates at startup had failed, the syslogdbluhm2015-10-241-2/+7
| | | | | | | | child tried to load the default CA file when it was connecting to a TLS server. The latter has never worked as the child is chrooted to /var/empty. Set the CA storage to an empty string to avoid this behavior. As a benefit pledge "rpath" can be removed. OK benno@
* If writing to a tty blocks, syslogd forked and tried to write againbluhm2015-10-231-5/+3
| | | | | | | | in a background process. A potential fork(2) at every message is bad, so replace this with an event. As a bonus the syslogd child process does not need to pledge "proc" anymore. Also limit the number of delayed write events. OK deraadt@
* Do some cleanup in syslogd ttymsg(). Add a debug message when thebluhm2015-10-211-9/+6
| | | | | syslogd child calls fork(2) to delay blocked output. OK benno@
* In syslogd replace the dprintf() macro with a logdebug() functionbluhm2015-10-151-73/+84
| | | | | as dprintf(3) is in libc now and does something different. OK guenther@
* Pass unsigned char to isdigit(3).bluhm2015-10-111-3/+3
| | | | From Michael McConville; OK guenther@
* Userspace doesn't need to use SUN_LEN(): connect() and bind() must acceptguenther2015-10-111-5/+2
| | | | | | | sizeof(struct sockaddr_un), so do the simple, portable thing. Also convert some strncpy() to strlcpy() ok deraadt@
* normalize a few more tame request orderings, to help reviewderaadt2015-10-101-2/+2
|
* If syslogd is started with -S, it accepts TLS connections to receivebluhm2015-10-091-43/+181
| | | | | | encrypted messages. The server certificates are taken from /etc/ssl like relayd does. OK benno@ beck@ deraadt@
* A fork(2) is used in ttymsg() to delay the message to a tty if itbluhm2015-10-091-2/+2
| | | | | blocks. Fix the potential syslogd's death, add "proc" to pledge. OK deraadt@
* catch up to tame() -> pledge() renamederaadt2015-10-091-3/+3
|
* Tame syslogd privsep child with "stdio rpath unix inet recvfd".bluhm2015-10-091-1/+4
| | | | With and OK deraadt@
* Delete the final, inscrutable NOSTRICT and VARARGS lint commentsguenther2015-09-291-3/+2
| | | | ok millert@
* It is not necessary to reset errno to 0 since we use logerrorx().bluhm2015-09-121-5/+1
| | | | Spotted by jung@
* Instead of printing errno strings here and there, add a logerrorx()bluhm2015-09-111-52/+66
| | | | | | | | to syslogd that does not do that. Use it for anything that does not look like a system call or library call around it. Also add logerrorctx() that prints the TLS error instead. Reduce the maximum CAfile limit to 50MB, requested by Bob. OK beck@
* Syslog does not need the global list of TCP clients, libevent handlesbluhm2015-09-111-8/+1
| | | | | everything. OK benno@
* Instead of having global variables containing the libevent structures,bluhm2015-09-101-46/+64
| | | | | | allocate them with malloc. This makes the address space layout more random. OK deraadt@ benno@
* Convert syslogd TLS connect to use handshake callback. The bt_hostnamebluhm2015-09-101-37/+36
| | | | | | | | | | can go away as the callback does not need the hostname anymore. Call tls_handshake() until successful. Remove the function tls_socket() as it has a bad prefix. Just call tls_client(), tls_configure() and tls_connect_socket() after the TCP socket has been created. There is no need to wait until TCP connect has finished. OK beck@ jsing@
* To double the receive buffer of a socketpair does not help as sendingbluhm2015-09-091-14/+25
| | | | | | | | | | | | | checks the send buffer size. So double both buffer sizes. Moreover the default for sending is 2048 and for receiving is 4096. This makes the existing double buffer algorithm inconsistent. It is better to make the buffers large enough to hold 8 full length messages. Just make sure that it does not shrink. Keep the approach that doubles the buffer sizes. When we are low on buffers and cannot reach the full size, increase it as much as possible. While there, add consistent error messages. OK benno@
* In sendsyslog(2) I got the plural s of messages right. The messagesbluhm2015-09-031-7/+9
| | | | | of syslogd(8) should be alike. syslogd: dropped 1 message OK lteo@ millert@
* Instead of creating a line buffer on the stack, tcp_readcb() canbluhm2015-09-031-7/+5
| | | | | use the global linebuf like the other libevent read callbacks. OK jung@
* Bind the *:514 UDP socket of syslogd with SO_REUSEADDR. This avoidsbluhm2015-09-011-7/+8
| | | | | | | conflicts with other processes bound to a specific address with the same port. Syslogd uses this socket basically for outgoing traffic to remote UDP log servers, so increase the chance that it works. OK jung@ benno@
* The !prog and +host features allow to select log messages from abluhm2015-08-311-27/+9
| | | | | | | | | specific programm or host. It does not make sense to truncate the string from the config at some character from a list. Just take whatever the user specified as progname or hostname. If it contains funky charactes it will not match and the action is not taken. This fixes matching with IP addresses if syslogd is started with -n. OK semarie@
* When syslogd is reloading a modified config, it does a reexec onbluhm2015-08-271-4/+8
| | | | | | | | itself. For this it uses the original arguments of main(). The function loghost_parse() modifies the optarg memory it is operating on. To prevent that the exec arguments have been tampered, pass a copy of optarg to loghost_parse(). OK deraadt@
* strlcpy() accesses the source string until it finds NUL, even ifbluhm2015-08-251-3/+5
| | | | | | | it is behind the size limit. As msg is not NUL-terminated in this case, it depended on memory content wether syslogd will crash. So using memcpy() and setting the NUL explicitly is the correct way. OK deraadt@
* Do not reconnect outgoing TCP connections too aggressively. Inbluhm2015-07-201-18/+19
| | | | | | case the receiver closes the connection, wait for a second to give him a chance to recover. OK benno@
* Do not accept sockets when syslogd reaches the file descriptorbluhm2015-07-201-19/+58
| | | | | | limit. Instead disable the listen event and wait for a second. Keep a reserve of 5 file descriptors. OK benno@
* For incoming TCP message streams autodetect wether the method isbluhm2015-07-191-28/+114
| | | | | octet counting or non transparent framing. OK benno@
* As libtls previously did not set SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER,bluhm2015-07-181-16/+2
| | | | | | | | syslogd had to drop messages after tls_write() returned TLS_{READ,WRITE}_AGAIN. Now after libtls has been fixed, remove the workaround. Messages are stored in the libevent write buffer as we can safely do a realloc(3) now. OK reyk@
* When incrementing msg, decrement msglen. Otherwise too much databluhm2015-07-161-2/+4
| | | | | could be written into the log file. OK benno@
* Set f_hostname to NULL after free() to avoid a double free whenbluhm2015-07-091-1/+2
| | | | | both !host and memory buffer are used. OK jung@
* When syslogd is invoked with -T listen_address, it creates a TCPbluhm2015-07-071-12/+180
| | | | | | | | | socket and accepts incomming messages. At the moment, only RFC 6587 3.4.2. Non-Transparent-Framing format with new-line separator is supprted for incomming messsages. Outgoing messages are encoded as 3.4.1. Octet Counting. Autodetection of incomming format will be implemented later. OK deraadt@ jmc@ millert@
* Remove some unneeded includes. OK deraadt@millert2015-07-061-5/+1
|
* Let syslogd run with non-blocking sockets. Replace the existingbluhm2015-07-051-26/+14
| | | | | | | fcntl(O_NONBLOCK) with the simpler SOCK_NONBLOCK and add this flag to the UDP sockets. React to EWOULDBLOCK although it should not happen. OK benno@
* To avoid copying the socket creation code for upcoming TCP listenbluhm2015-07-021-117/+114
| | | | | again, move it to the common function socket_bind(). OK millert@
* Sort the syslogd getopt string and switch cases according to thebluhm2015-06-301-13/+13
| | | | | man page. This makes it easier to check wether both are consistent. OK jung@
* Add a -U command line switch for syslogd to specify an explict bindbluhm2015-06-301-12/+86
| | | | | | | address to receive UDP packets. One advantge over -u and the * sockets is that you can bind to localhost and divert the packets with pf. It is also possible to use a non standard port. OK jung@ jmc@