Configuring Remote Syslog Over TLS
Use this procedure to configure remote syslog over TLS.
Syslog provides a convenient mechanism to transfer logs from one device to another. The logs contain sensitive information. Therefore, it is important that you secure the logs during transfers. Do this by authenticating and encrypting the connection beween the client and the server. The remote feature in the syslog supports this functionality. Use this procedure to establish secure communications between the syslog clients and servers.
Prerequisites
-
Ensure that the normal or unencrypted remote syslog functionality works using TCP.
-
Complete the server side configuration. Load the
imtcpmodule and specify the listener port. -
Complete the client side configuration. Specify the remote machine to which the logs are sent.
-
Upon completion of the server side and client side configuration. Restart the syslog service.
-
Restart the syslog service in case any of the devices were added, modified, or activated.
-
Ensure the logs from the client are listed in the log file of the server. This is a confirmation and you can proceed to securing the communication channel.
To load the imtcp module and to specify the listener port, modify the /etc/rsyslog.conf file as follows:
# listen for tcp input
$ModLoad imtcp
# listening on port <port number>
$InputTCPServerRun <port number>
# Remote logs written to /var/log/messages.
*.* /var/log/messages
To specify the destination remote machine to which the logs will be sent, modify the /etc/rsyslog.conf file as follows:
# Forward messages to remotehost:port
*.* @@<Ip address of the remote host>:<port number>
Syslog contains modules, protective transport layer, and digital certificates to ensure mutual authentication. It covers many aspects. The syslog messages are encrypted in transit. The syslog sender authenticates to the syslog receiver. The receiver is able to identify and in return authenticates to the syslog sender. The receiver performs few checks to validate if it is the valid recipient of the messages. This kind of mutual authentication and hand shake prevents any kind of attacks.
The syslog mutual authentication system makes use of CA certificate and peer certificates. In case there is no signed certificate available, the user can create a self signed certificate using OpenSSL. The server must have the CA (certificate authority) certificate and it’s own digital certificate. These certificates enable SSL operation that provides the necessary crypto keys used to secure the connection.
Syslog makes use of GTLS module as the network stream driver. Syslog has TLS protected transport security feature and ensures messages are encrypted. It makes use of digital certificates to ensure mutual authentication.
Configuring the server
The server configuration involves specifying the location of the certificates, the GTLS driver to be used, and starting of the listener. The following example is applicable to Linux based remote server only. It is different for other platforms. To make any changes to the server’s syslog configuration, refer to the documentation of the specific syslog server. Modify the /etc/rsyslog.conf file as follows:
# listen for tcp input
$ModLoad imtcp
# make gtls driver the default
$DefaultNetstreamDriver gtls
# certificate files
$DefaultNetstreamDriverCAFile /path/to/cacert.pem
$DefaultNetstreamDriverCertFile /path/to/servercert.pem
$DefaultNetstreamDriverKeyFile /path/to/serverkey.pem
# Auth mode and permitted peers
$InputTCPServerStreamDriverAuthMode x509/name
$InputTCPServerStreamDriverPermittedPeer <permittedHost>
$InputTCPServerStreamDriverMode 1 # run driver in TLS-only mode
# Listening on port <port number>
$InputTCPServerRun <port number>
# Generic log file watching
$WorkDirectory /var/cache/rsyslog
# Remote logs
*.* /var/log/messages
Configuring the client
Syslog sends messages to a remote system from the client (Audit Vault Server or the Database Firewall). The client configuration involves specifying the location of the certificates, the GTLS driver to be used, and specifying the destination of the messages. Modify the /etc/rsyslog.conf as follows:
# make gtls driver the default
$DefaultNetstreamDriver gtls
# certificate files
$DefaultNetstreamDriverCAFile /usr/local/dbfw/syslog/certs/cacert.pem
$DefaultNetstreamDriverCertFile /usr/local/dbfw/syslog/certs/clientcert.pem
$DefaultNetstreamDriverKeyFile /usr/local/dbfw/syslog/certs/clientkey.pem
# Auth modes and permitted peers
$ActionSendStreamDriverAuthMode x509/name
$ActionSendStreamDriverPermittedPeer avs08002719479d
$ActionSendStreamDriverMode 1 # run driver in TLS-only mode
# Send to remote system
*.* @@<Ip address>:<port number>
Note:
The rsylog.conf is generated from the template file:
/usr/local/dbfw/templates/template-rsyslog-conf
The client settings must also be made to the template file. Any changes made to this template is persistent and preserved even after the reboot of the appliance.
Creating and Using SSL Certificates
-
Run the following command to create CA certificates:
openssl req -new -x509 -keyout private/cakey.pem -out cacert.pem -days 365 -config openssl.cnf -
Run the following commands to create server certificates using the CA certificate:
openssl req -nodes -new -x509 -keyout serverkey.pem -out serverreq.pem -days 365 -config openssl.cnfopenssl x509 -x509toreq -in serverreq.pem -signkey serverkey.pem -out tmp.pemopenssl ca -config openssl.cnf -policy policy_anything -out servercert.pem -infiles tmp.pem -
Run the following commands to create client certificates using CA certificate:
openssl req -nodes -new -x509 -keyout clientkey.pem -out clientreq.pem -days 365 -config openssl.cnfopenssl x509 -x509toreq -in clientreq.pem -signkey clientkey.pem -out tmp.pemopenssl ca -config openssl.cnf -policy policy_anything -out clientcert.pem -infiles tmp.pem -
Transfer the following certificates to the specific location on the log server.
cacerts.pem,servercert.pem,serverkey.pem -
Transfer the following certificates to the specific location on the client.
cacerts.pem,clientcert.pem,clientkey.pem