NXLog Docs

Timestamping (pm_ts)

This module provides support for the Time-Stamp Protocol as defined in RFC 3161. A cryptographic hash value of the log messages is sent over a HTTP or HTTPS channel to a Time-Stamp Authority server which creates a cryptographic Time-Stamp signature to prove that the message existed at that time and to be able to verify its validity at a later time. This may be mandatory for regulatory compliance, financial transactions, and legal evidence.

This module has been deprecated and will be removed in a future release.

A timestamp request is created for each log message received by this module, and the response is appended to the tsa_response field. The module does not request the certificate to be included in the response as this would greatly increase the size of the responses. The certificate used by the server for creating timestamps should be saved manually for later verification. The module establishes one HTTP connection to the server for the time-stamping by using HTTP Keep-Alive requests and will reconnect if the remote closes the connection.

Since each log message generates a HTTP(S) request to the Time-Stamp server, the message throughput can be greatly affected. It is recommended that only messages of relevant importance are time-stamped through the use of proper filtering rules applied to messages before they reach the pm_ts module instance.

Creating timestamps in batch mode (requesting one timestamp on multiple messages) is not supported at this time.

Configuration

The pm_ts module accepts the following directives in addition to the common module directives. The URL directive is required.

URL

This mandatory directive specifies the URL of the Time-Stamp Authority server. The URL must begin with either http:// for plain HTTP over TCP or https:// for HTTP over SSL.


Digest

This specifies the digest method (hash function) to be used. The SHA1 hash function is used by default. The following message digest methods can be used: md2, md5, mdc2, rmd160, sha, sha1, sha224, sha256, sha384, and sha512. Note that the Time-Stamp server must support the digest method specified.

Fields

This directive accepts a comma-separated list of fields. These fields will be used for calculating the hash value sent to the TSA server. This directive is optional, and the $raw_event field is used if it is not specified.

HTTPSAllowExpired

This boolean directive specifies whether the connection should be allowed with an expired certificate. If set to TRUE, the connection will be allowed even if the Time-Stamp Authority server presents an expired certificate. The default is FALSE: the Time-Stamp Authority server must present a certificate that is not expired.

HTTPSAllowUntrusted

This boolean directive specifies that the connection to the Time-Stamp Authority server should be allowed regardless of the certificate verification results. If set to TRUE, the connection will be allowed with any unexpired certificate provided by a server. The default value is FALSE: all Time-Stamp Authority servers must present a trusted certificate.

HTTPSCADir

This directive specifies a path to a directory containing certificate authority (CA) certificates. These certificates will be used to verify the certificate presented by the Time-Stamp Authority server. The certificate files must be named using the OpenSSL hashed format, i.e. the hash of the certificate followed by .0, .1 etc. To find the hash of a certificate using OpenSSL:

$ openssl x509 -hash -noout -in ca.crt

For example if the certificate hash is e2f14e4a, then the certificate filename should be e2f14e4a.0. If there is another certificate with the same hash then it should be named e2f14e4a.1 and so on.

A Time-Stamp Authority server’s self-signed certificate (which is not signed by a CA) can also be trusted by including a copy of the certificate in this directory.

This directive can only be specified if the URL begins with https.

HTTPSCAFile

This specifies the path of the certificate authority (CA) certificate that will be used to verify the certificate presented by the Time-Stamp Authority server. A Time-Stamp Authority server’s self-signed certificate (which is not signed by a CA) can be trusted by specifying the remote server certificate itself. In case of certificates signed by an intermediate CA, the certificate specified must contain the complete certificate chain (certificate bundle). This directive can only be specified if the URL begins with https.

HTTPSCAThumbprint

This optional directive specifies the thumbprint of the certificate authority (CA) certificate that will be used to verify the certificate presented by the Time-Stamp Authority server. The hexadecimal fingerprint string can be copied from Windows Certificate Manager (certmgr.msc). Whitespaces are automatically removed. The certificate must be added to a Windows certificate store that is accessible by NXLog. This directive is only supported on Windows and is mutually exclusive with the HTTPSCADir and HTTPSCAFile directives.

HTTPSSearchAllCertStores

This optional boolean directive, when set to TRUE, enables the loading of all available Windows certificates into NXLog, for use during remote certificate verification. Any required certificates must be added to a Windows certificate store that NXLog can access. This directive is mutually exclusive with the HTTPSCAThumbprint, HTTPSCADir and HTTPSCAFile directives.

HTTPSCertFile

This specifies the path of the certificate file that will be presented to the Time-Stamp Authority server during the HTTPS handshake. This directive can only be specified if the URL begins with https. If this directive is not specified but the URL begins with https, then an anonymous SSL connection is attempted without presenting a client-side certificate.

HTTPSCertKeyFile

This specifies the path of the private key file that was used to generate the certificate specified by the HTTPSCertFile directive. This is used for the HTTPS handshake. This directive can only be specified if the URL begins with https. If this directive is not specified but the URL begins with https, then an anonymous SSL connection is attempted without presenting a client-side certificate.

HTTPSCertThumbprint

This optional directive specifies the thumbprint of the certificate that will be presented to the Time-Stamp Authority server during the HTTPS handshake. The hexadecimal fingerprint string can be copied from Windows Certificate Manager (certmgr.msc). Whitespaces are automatically removed. The certificate must be imported to the Local Computer\Personal certificate store in PFX format for NXLog to find it. To create a PFX file from the certificate and private key using OpenSSL:

$ openssl pkcs12 -export -out server.pfx -inkey server.key -in server.pem

This directive is only supported on Windows and is mutually exclusive with the HTTPSCertFile and HTTPSCertKeyFile directives.

HTTPSCRLDir

This directive specifies a path to a directory containing certificate revocation list (CRL) files. These CRL files will be used to check for certificates that were revoked and should no longer be accepted. The files must be named using the OpenSSL hashed format, i.e. the hash of the issuer followed by .r0, .r1 etc. To find the hash of the issuer of a CRL file using OpenSSL:

$ openssl crl -hash -noout -in crl.pem

For example if the hash is e2f14e4a, then the filename should be e2f14e4a.r0. If there is another file with the same hash then it should be named e2f14e4a.r1 and so on.

This directive can only be specified if the URL begins with https.

HTTPSCRLFile

This specifies the path of the certificate revocation list (CRL) which will be used to check for certificates that have been revoked and should no longer be accepted. Example to generate a CRL file using OpenSSL:

$ openssl ca -gencrl -out crl.pem

This directive can only be specified if the URL begins with https.

HTTPSDHFile

This optional directive specifies file with dh-parameters for Diffie-Hellman key exchange. These parameters can be generated with dhparam(1ssl). If no directive is specified, default parameters will be used. See OpenSSL Wiki for further details.

HTTPSKeyPass

This directive specifies the passphrase of the private key specified by the HTTPSCertKeyFile directive. A passphrase is required when the private key is encrypted. Example to generate a private key with Triple DES encryption using OpenSSL:

$ openssl genrsa -des3 -out server.key 2048

This directive is not needed for passwordless private keys.

HTTPSSSLCipher

This optional directive can be used to set the permitted SSL cipher list, overriding the default. Use the format described in the ciphers(1ssl) man page. For example specify RSA:!COMPLEMENTOFALL to include all ciphers with RSA authentication but leave out ciphers without encryption.

If RSA or DSA ciphers with Diffie-Hellman key exchange are used, DHFile can be set for specifying custom dh-parameters.
HTTPSSSLCiphersuites

This optional directive can be used to set the permitted cipher list for TLSv1.3. Use the same format as in the HTTPSSSLCipher directive. Refer to the OpenSSL documentation for a list of valid TLS v1.3 cipher suites. The default value is:

TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
HTTPSSSLCompression

This boolean directive allows you to enable data compression when sending data over the network. The compression mechanism is based on the zlib compression library. If the directive is not specified, it defaults to FALSE: compression is disabled.

Some Linux packages (for example, Debian) use the OpenSSL library provided by the OS and may not support the zlib compression mechanism. The module will emit a warning on startup if the compression support is missing. The generic deb/rpm packages are bundled with a zlib-enabled libssl library.
HTTPSSSLProtocol

This directive can be used to set the allowed SSL/TLS protocol(s). It takes a comma-separated list of values which can be any of the following: SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2 and TLSv1.3. By default, the TLSv1.2 and TLSv1.3 protocols are allowed. Note that the OpenSSL library shipped by Linux distributions may not support SSLv2 and SSLv3, and these will not work even if enabled with this directive.

Fields

The following fields are used by pm_ts.

$TSAResponse (type: binary)

The response for the Time-Stamp request from the server. This does not include the certificate.

Examples

Example 1. Storing Requested Timestamps in a CSV File

With this configuration, NXLog will read BSD Syslog messages from the socket, add timestamps, and then save the messages to file in CSV format.

nxlog.conf
<Extension syslog>
    Module          xm_syslog
</Extension>

<Input uds>
    Module          im_uds
    UDS             /dev/log
    Exec            parse_syslog_bsd();
</Input>

<Processor ts>
    Module          pm_ts
    URL             https://tsa-server.com:8080/tsa
    Digest          md5
</Processor>

<Processor csv>
    Module          pm_transformer
    OutputFormat    csv
    CSVOutputFields $facility, $severity, $timestamp, $hostname, \
                    $application, $pid, $message, $tsa_response
</Processor>

<Output file>
    Module          om_file
    File            "/dev/stdout"
</Output>

<Route uds_to_file>
    Path            uds => ts => csv => file
</Route>