summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-10-01 08:15:11 -0500
committerGitHub <noreply@github.com>2025-10-01 08:15:11 -0500
commit31f8bd8e762ddd999e8cefd52786353f43ea4c1c (patch)
tree7c73c42d0fed9f653017931b9304f27c74e12b2b /data
parentebf27d5fb3d9203256d2cd49e0f4cf810bae03b1 (diff)
parent68f2cec785b6705c71d17b30114355569c489d66 (diff)
downloadvyos-1x-31f8bd8e762ddd999e8cefd52786353f43ea4c1c.tar.gz
vyos-1x-31f8bd8e762ddd999e8cefd52786353f43ea4c1c.zip
Merge pull request #4734 from alexandr-san4ez/T4251-current
syslog: T4251: Add TLS support to syslog
Diffstat (limited to 'data')
-rw-r--r--data/templates/rsyslog/rsyslog.conf.j228
1 files changed, 27 insertions, 1 deletions
diff --git a/data/templates/rsyslog/rsyslog.conf.j2 b/data/templates/rsyslog/rsyslog.conf.j2
index 6ef2afcaf..07dbc603d 100644
--- a/data/templates/rsyslog/rsyslog.conf.j2
+++ b/data/templates/rsyslog/rsyslog.conf.j2
@@ -92,6 +92,7 @@ if prifilt("{{ tmp | join(',') }}") then {
{% set _ = tmp.append(facility.replace('all', '*') ~ "." ~ facility_options.level.replace('all', 'debug')) %}
{% endfor %}
{% set _ = tmp.sort() %}
+{% set tls = remote_options.tls %}
# Remote syslog to {{ remote_name }}
if prifilt("{{ tmp | join(',') }}") then {
action(
@@ -100,7 +101,7 @@ if prifilt("{{ tmp | join(',') }}") then {
target="{{ remote_name }}"
# Port on the remote syslog server
port="{{ remote_options.port }}"
- protocol="{{ remote_options.protocol }}"
+ protocol="{{ 'tcp' if tls.enable is vyos_defined else remote_options.protocol }}"
{% if remote_options.format.include_timezone is vyos_defined %}
template="RSYSLOG_SyslogProtocol23Format"
{% endif %}
@@ -111,6 +112,31 @@ if prifilt("{{ tmp | join(',') }}") then {
{% if remote_options.vrf is vyos_defined %}
Device="{{ remote_options.vrf }}"
{% endif %}
+{% if tls.enable is vyos_defined %}
+{% set auth_mode = tls.auth_mode %}
+ # Specify the use of the OpenSSL TLS driver for this action
+ StreamDriver="ossl"
+ # Set mode to TLS-only connections (do not accept plain TCP)
+ StreamDriverMode="1"
+ # Select the authentication mode
+ StreamDriverAuthMode="{{ auth_mode if auth_mode == 'anon' else 'x509/' + auth_mode }}"
+{% if tls.permitted_peers is vyos_defined and auth_mode in ('fingerprint', 'name') %}
+ # Only include permitted peers (list of allowed fingerprints or names)
+ StreamDriverPermittedPeers="{{ tls.permitted_peers }}"
+{% endif %}
+{% if tls.ca_certificate_path is vyos_defined %}
+ # Include the path to the CA certificate file
+ StreamDriver.CAFile="{{ tls.ca_certificate_path }}"
+{% endif %}
+{% if tls.certificate_path is vyos_defined %}
+ # Include the path to the client's certificate
+ StreamDriver.CertFile="{{ tls.certificate_path }}"
+{% endif %}
+{% if tls.certificate_key_path is vyos_defined %}
+ # Include the path to the client's private key
+ StreamDriver.KeyFile="{{ tls.certificate_key_path }}"
+{% endif %}
+{% endif %}
)
}
{% endif %}