Make syslog secure (allow-list, VPN or TLS)
When to use this: Logs cross an untrusted network (internet, shared network) and must not be readable or forgeable.
git status before you run it. Before you start
Steps
-
Level 1: restrict who can send
Firewall rule allowing only the sender IPs on port 514 (see the ports scenario). This stops casual spoofing from outside but does not encrypt anything.
-
Level 2: send over a VPN
Put the syslog server on the VPN subnet. On the FortiGate set the syslog destination to the server's private address and send through the tunnel interface (
interface-select-method specify). Traffic is encrypted inside the tunnel, and port 514 is never exposed. -
Level 3: syslog over TLS with rsyslog
terminalsudo apt install -y rsyslog-gnutls sudo tee /etc/rsyslog.d/20-tls.conf > /dev/null <<'EOF' global( DefaultNetstreamDriver="gtls" DefaultNetstreamDriverCAFile="/etc/rsyslog-tls/ca.pem" DefaultNetstreamDriverCertFile="/etc/rsyslog-tls/server.pem" DefaultNetstreamDriverKeyFile="/etc/rsyslog-tls/server.key" ) module(load="imtcp" StreamDriver.Name="gtls" StreamDriver.Mode="1" StreamDriver.AuthMode="x509/name") input(type="imtcp" port="6514") EOFListens for TLS on 6514. You need a certificate authority, a server certificate and key in
/etc/rsyslog-tls/.AuthModeoptions range fromanon(encrypt only) tox509/name(verify the client certificate name). Test with a client before relying on it. -
Configure the sender for encryption
On a FortiGate use
mode reliableand checkset enc-algorithm ?for the encryption option on your FortiOS version, plus Fortinet's documentation for importing the CA certificate. Other devices have their own TLS settings.
How to verify it worked
- A packet capture of the link shows no readable log text (TLS or VPN), and an unknown source cannot inject messages.
Common errors and fixes
Q&A
Is UDP syslog encrypted?
No. It is plain text and unauthenticated. Protect it with a VPN or use TLS.
What is the standard TLS syslog port?
TCP 6514 (RFC 5425).
VPN or TLS?
VPN is simpler when the firewall already terminates tunnels. TLS is better when the device supports it and you want per-device authentication without a tunnel.