Chat now with support
Chat mit Support

syslog-ng Premium Edition 7.0.32 - Administration Guide

Preface Introduction to syslog-ng The concepts of syslog-ng Installing syslog-ng PE The syslog-ng PE quick-start guide The syslog-ng PE configuration file Collecting log messages — sources and source drivers
How sources work default-network-drivers: Receive and parse common syslog messages internal: Collecting internal messages file: Collecting messages from text files google-pubsub: collecting messages from the Google Pub/Sub messaging service wildcard-file: Collecting messages from multiple text files linux-audit: Collecting messages from Linux audit logs mssql, oracle, sql: collecting messages from an SQL database network: Collecting messages using the RFC3164 protocol (network() driver) office365: Fetching logs from Office 365 osquery: Collect and parse osquery result logs pipe: Collecting messages from named pipes program: Receiving messages from external applications python: writing server-style Python sources python-fetcher: writing fetcher-style Python sources snmptrap: Read Net-SNMP traps syslog: Collecting messages using the IETF syslog protocol (syslog() driver) system: Collecting the system-specific log messages of a platform systemd-journal: Collecting messages from the systemd-journal system log storage systemd-syslog: Collecting systemd messages using a socket tcp, tcp6,udp, udp6: Collecting messages from remote hosts using the BSD syslog protocol udp-balancer: Receiving UDP messages at very high rate unix-stream, unix-dgram: Collecting messages from UNIX domain sockets windowsevent: Collecting Windows event logs
Sending and storing log messages — destinations and destination drivers
elasticsearch2>: Sending messages directly to Elasticsearch version 2.0 or higher (DEPRECATED) elasticsearch-http: Sending messages to Elasticsearch HTTP Event Collector file: Storing messages in plain-text files google_pubsub(): Sending logs to the Google Cloud Pub/Sub messaging service google_pubsub-managedaccount(): Sending logs to the Google Cloud Pub/Sub messaging service authenticated by Google Cloud managed service account hdfs: Storing messages on the Hadoop Distributed File System (HDFS) http: Posting messages over HTTP kafka(): Publishing messages to Apache Kafka (Java implementation) (DEPRECATED) kafka-c(): Publishing messages to Apache Kafka using the librdkafka client (C implementation) logstore: Storing messages in encrypted files mongodb: Storing messages in a MongoDB database network: Sending messages to a remote log server using the RFC3164 protocol (network() driver) pipe: Sending messages to named pipes program: Sending messages to external applications python: writing custom Python destinations sentinel(): Sending logs to the Microsoft Azure Sentinel cloud snmp: Sending SNMP traps smtp: Generating SMTP messages (email) from logs splunk-hec: Sending messages to Splunk HTTP Event Collector sql(): Storing messages in an SQL database stackdriver: Sending logs to the Google Stackdriver cloud syslog: Sending messages to a remote logserver using the IETF-syslog protocol syslog-ng(): Forward logs to another syslog-ng node tcp, tcp6, udp, udp6: Sending messages to a remote log server using the legacy BSD-syslog protocol (tcp(), udp() drivers) unix-stream, unix-dgram: Sending messages to UNIX domain sockets usertty: Sending messages to a user terminal — usertty() destination Client-side failover
Routing messages: log paths, flags, and filters Global options of syslog-ng PE TLS-encrypted message transfer Advanced Log Transport Protocol Reliability and minimizing the loss of log messages Manipulating messages parser: Parse and segment structured messages Processing message content with a pattern database Correlating log messages Enriching log messages with external data Monitoring statistics and metrics of syslog-ng Multithreading and scaling in syslog-ng PE Troubleshooting syslog-ng Best practices and examples The syslog-ng manual pages Glossary

Secure logging using TLS

The syslog-ng application can send and receive log messages securely over the network using the Transport Layer Security (TLS) protocol using the network() and syslog() drivers.

NOTE: This chapter describes how to use TLS encryption when using the standard syslog protocols, that is, the network() and syslog() drivers, for example, to forward log messages between two syslog-ng nodes, or to send log data to syslog-ng Store Box or another log server. Other destinations that support TLS-encryption are not discussed in this chapter (for example, http()).

TLS uses certificates to authenticate and encrypt the communication, as illustrated on the following figure:

Figure 37: Certificate-based authentication

The client authenticates the server by requesting its certificate and public key. Optionally, the server can also request a certificate from the client, thus mutual authentication is also possible.

In order to use TLS encryption in syslog-ng, the following elements are required:

  • A certificate on the syslog-ng server that identifies the syslog-ng server.

  • The certificate of the Certificate Authority that issued the certificate of the syslog-ng server (or the self-signed certificate of the syslog-ng server) must be available on the syslog-ng client.

When using mutual authentication to verify the identity of the clients, the following elements are required:

  • A certificate must be available on the syslog-ng client. This certificate identifies the syslog-ng client.

  • The certificate of the Certificate Authority that issued the certificate of the syslog-ng client must be available on the syslog-ng server.

Mutual authentication ensures that the syslog-ng server accepts log messages only from authorized clients.

For more information about configuring TLS communication in syslog-ng, see Encrypting log messages with TLS.

For more information about TLS-related error messages, see Error messages.

Supported OpenSSL versions

The following list contains information about the supported OpenSSL versions in each syslog-ng PE application version.

Linux glibc 2.11

syslog-ng PE version supported Open SSL version
7.0.1 OpenSSL 1.0.2j
7.0.2 OpenSSL 1.0.2j
7.0.3 OpenSSL 1.0.2j
7.0.4 OpenSSL 1.0.2j
7.0.5 OpenSSL 1.0.2j
7.0.6 OpenSSL 1.0.2m
7.0.7 OpenSSL 1.0.2m
7.0.8 OpenSSL 1.0.2m
7.0.9 OpenSSL 1.0.2o
7.0.10 OpenSSL 1.0.2o
7.0.11 OpenSSL 1.0.2p
7.0.12 OpenSSL 1.0.2q
7.0.13 OpenSSL 1.0.2q
7.0.14 OpenSSL 1.0.2r
7.0.15 OpenSSL 1.0.2s
7.0.16 OpenSSL 1.0.2s
7.0.17 OpenSSL 1.0.2t
7.0.18 OpenSSL 1.0.2t
7.0.19 OpenSSL 1.1.1d
7.0.20 OpenSSL 1.1.1g
7.0.21 OpenSSL 1.1.1g
7.0.22 OpenSSL 1.1.1g
7.0.23 OpenSSL 1.1.1h
7.0.24 OpenSSL 1.1.1j
7.0.25. OpenSSL 1.1.1k
7.0.26 OpenSSL 1.1.1k
7.0.27 OpenSSL 1.1.1l
7.0.29 OpenSSL 1.1.1m
7.0.30 OpenSSL 1.1.1o
7.0.31 OpenSSL 1.1.1q

Encrypting log messages with TLS

This section describes how to configure TLS encryption in syslog-ng. For the concepts of using TLS in syslog-ng, see Secure logging using TLS.

Configuring TLS on the syslog-ng clients

Purpose

Complete the following steps on every syslog-ng client host. Examples are provided using both the legacy BSD-syslog protocol (using the network() driver) and the new IETF-syslog protocol standard (using the syslog() driver):

To configure TLS on the syslog-ng clients

  1. Copy the CA certificate to the client host

    Copy the CA certificate (for example, cacert.pem) of the Certificate Authority that issued the certificate of the syslog-ng server (or the self-signed certificate of the syslog-ng server) to the syslog-ng client hosts, for example, into the /opt/syslog-ng/etc/syslog-ng/ca.d directory.

  2. Issue commands

    Issue the following command on the certificate: openssl x509 -noout -hash -in cacert.pem The result is a hash (for example, 6d2962a8), a series of alphanumeric characters based on the Distinguished Name of the certificate.

    Issue the following command to create a symbolic link to the certificate that uses the hash returned by the previous command and the .0 suffix.

    ln -s cacert.pem 6d2962a8.0

  3. Add a destination statement

    Add a destination statement to the syslog-ng configuration file that uses the tls( ca-dir(path_to_ca_directory) ) option and specify the directory using the CA certificate. The destination must use the network() or the syslog() destination driver, and the IP address and port parameters of the driver must point to the syslog-ng server.

    Example: A destination statement using TLS

    The following destination encrypts the log messages using TLS and sends them to the 6514/TCP port of the syslog-ng server having the 10.1.2.3 IP address.

    destination demo_tls_destination {
        network("10.1.2.3" port(6514)
            transport("tls")
            tls( ca-dir("/opt/syslog-ng/etc/syslog-ng/ca.d"))
        );
    };

    A similar statement using the IETF-syslog protocol and thus the syslog() driver:

    destination demo_tls_syslog_destination {
        syslog("10.1.2.3" port(6514)
                            transport("tls")
            tls(ca-dir("/opt/syslog-ng/etc/syslog-ng/ca.d"))
        );
    };
  4. Include the destination in a log statement

    Include the destination created in the Step Add a destination statement in a log statement.

    Caution:

    The encrypted connection between the server and the client fails if the Common Name or the subject_alt_name parameter of the server certificate does not contain the hostname or the IP address (as resolved from the syslog-ng clients and relays) of the server.

    Do not forget to update the certificate files when they expire.

Configuring TLS on the syslog-ng server

Complete the following steps on the syslog-ng server:

To configure TLS on the syslog-ng server

  1. Create an X.509 certificate for the syslog-ng server.

    NOTE: The subject_alt_name parameter (or the Common Name parameter if the subject_alt_name parameter is empty) of the server's certificate must contain the hostname or the IP address (as resolved from the syslog-ng clients and relays) of the server (for example, syslog-ng.example.com).

    Alternatively, the Common Name or the subject_alt_name parameter can contain a generic hostname, for example, *.example.com.

    Note that if the Common Name of the certificate contains a generic hostname, do not specify a specific hostname or an IP address in the subject_alt_name parameter.

  2. Copy the certificate (for example, syslog-ng.cert) of the syslog-ng server to the syslog-ng server host, for example, into the /opt/syslog-ng/etc/syslog-ng/cert.d directory. The certificate must be a valid X.509 certificate in PEM format.

  3. Copy the private key (for example, syslog-ng.key) matching the certificate of the syslog-ng server to the syslog-ng server host, for example, into the /opt/syslog-ng/etc/syslog-ng/key.d directory. The key must be in PEM format. If you want to use a password-protected key, see Password-protected keys.

  4. Add a source statement to the syslog-ng configuration file that uses the tls( key-file(key_file_fullpathname) cert-file(cert_file_fullpathname) ) option and specify the key and certificate files. The source must use the source driver (network() or syslog()) matching the destination driver used by the syslog-ng client.

    Example: A source statement using TLS

    The following source receives log messages encrypted using TLS, arriving to the 1999/TCP port of any interface of the syslog-ng server.

    source demo_tls_source {
        network(ip(0.0.0.0) port(1999)
            transport("tls")
            tls( 
                key-file("/opt/syslog-ng/etc/syslog-ng/key.d/syslog-ng.key")
                cert-file("/opt/syslog-ng/etc/syslog-ng/cert.d/syslog-ng.cert")
            )
        );
    };

    A similar source for receiving messages using the IETF-syslog protocol:

    source demo_tls_syslog_source {
        syslog(ip(0.0.0.0) port(1999)
        transport("tls")
        tls(
            key-file("/opt/syslog-ng/etc/syslog-ng/key.d/syslog-ng.key")
            cert-file("/opt/syslog-ng/etc/syslog-ng/cert.d/syslog-ng.cert")
            )
        );
    };
  5. Disable mutual authentication for the source by setting the following TLS option in the source statement: tls( peer-verify(optional-untrusted);

    If you want to authenticate the clients, you have to configure mutual authentication. For details, see Mutual authentication using TLS.

    For the details of the available tls() options, see TLS options.

    Example: Disabling mutual authentication

    The following source receives log messages encrypted using TLS, arriving to the 1999/TCP port of any interface of the syslog-ng server. The identity of the syslog-ng client is not verified.

    source demo_tls_source {
        network(
            ip(0.0.0.0) port(1999)
            transport("tls")
            tls(
                key-file("/opt/syslog-ng/etc/syslog-ng/key.d/syslog-ng.key")
                cert-file("/opt/syslog-ng/etc/syslog-ng/cert.d/syslog-ng.cert")
                peer-verify(optional-untrusted)
            )
        );
    };

    A similar source for receiving messages using the IETF-syslog protocol:

    source demo_tls_syslog_source {
        syslog(
            ip(0.0.0.0) port(1999)
            transport("tls")
            tls(
                key-file("/opt/syslog-ng/etc/syslog-ng/key.d/syslog-ng.key")
                cert-file("/opt/syslog-ng/etc/syslog-ng/cert.d/syslog-ng.cert")
                peer-verify(optional-untrusted)
            )
        );
    };

    Caution:

    Do not forget to update the certificate and key files when they expire.

Verwandte Dokumente

The document was helpful.

Bewertung auswählen

I easily found the information I needed.

Bewertung auswählen