Secure log transfer using Rsyslog

Prev Next

You can transfer logs from AppGate ZTNA appliances to an external SIEM system. By default, AppGate ZTNA uses Rsyslog for log transfer, which does not provide transport security on its own. You can secure the transmission by configuring both systems to use TLS.


Prerequisites

Before you begin, confirm the following:

  • The remote Rsyslog server runs Rsyslog version 8.16.0 or later.

  • The rsyslog-gnutls plugin is installed on the remote server.

  • TLS certificates have been generated for the transport. For information on generating a CA, see Generating the machine certificate.

The remote Rsyslog server requires ca.pem, cert.pem, and key.pem. The AppGate ZTNA appliance requires only ca.pem. On the AppGate ZTNA appliance, the key must be stored in the /opt directory. The examples in this article use /opt/Keys on the AppGate ZTNA appliance and /home/ubuntu/Keys on the remote Rsyslog server. Create these directories before proceeding.


Configure the remote Rsyslog server

The following steps were tested on Ubuntu 16.04 with Rsyslog v8.16.0 and rsyslog-gnutls installed.

On the Rsyslog server, open etc/rsyslog.conf:

sudo nano /etc/rsyslog.conf

Add the following lines:

# make gtls driver the default
$DefaultNetstreamDriver gtls
# certificate files
$DefaultNetstreamDriverCAFile /home/ubuntu/Keys/ca.pem
$DefaultNetstreamDriverCertFile /home/ubuntu/Keys/cert.pem
$DefaultNetstreamDriverKeyFile /home/ubuntu/Keys/key.pem
# load TCP listener
$ModLoad imtcp 
# run driver in TLS-only mode
$InputTCPServerStreamDriverMode 1  
# client is NOT authenticated
$InputTCPServerStreamDriverAuthMode anon
# start up listener at port 10514
$InputTCPServerRun 10514 

Configure the AppGate ZTNA appliance

  1. Create the /opt/Keys directory on the appliance:

sudo mkdir /opt/Keys 
  1. Copy ca.pem into the /opt/Keys directory.

  2. In the admin UI, go to System > Appliances > Edit Appliance > Networking > Advanced > Rsyslog Destinations and select +Add.

    Configuration settings for Rsyslog Destination including selector, template, and destination IP.

  3. In the Selector field, paste the following:

    # certificate files - just CA for a client
    $DefaultNetstreamDriverCAFile /opt/Keys/ca.pem
    # set up the action
    $DefaultNetstreamDriver gtls # use gtls netstream driver
    $ActionSendStreamDriverMode 1 
    $ActionSendStreamDriverAuthMode anon # server is NOT authenticated
    :msg, contains, "[AUDIT]"

    NOTE

    The last line :msg, contains, "[AUDIT]" sends only logs marked with [AUDIT], which all audit logs include. Because audit logs and syslogs are stored in the same file, replace the last line with *.* to forward all logs.

  4. In the Template field, enter the following:

%msg:9:$%\n
  1. In the Destination field, enter the destination of the remote Rsyslog server you are sending logs to:

@@(o)ec2-18-218-62-238.us-east-2.compute.amazonaws.com:10514

This example sends logs to ec2-18-218-62-238.us-east-2.compute.amazonaws.com on port 10514.

  1. Select Save at the bottom of the Edit Appliance page.

  2. Confirm that port 10514 is open between the AppGate ZTNA appliance and the remote Rsyslog server.

After the configuration is saved, logs are forwarded to the remote server and stored in /var/log/syslog.

Verify the configuration

To confirm that logs are being sent, use one of the following methods:

  • Check /var/log/syslog on the remote Rsyslog server and confirm that logs are being written.

  • Run a tcpdump on the remote Rsyslog server:

sudo tcpdump -i <interface> port 10514

For more information about logs, see Audit logs. For information about audit log record details, see Audit log detail.