Follow these steps. It worked for me on debian
· Create a CA with a key and generate a certificate request
Openssl req -new -config openssl.cnf -keyout private/cakey.pem -out careq.pem
· Now create a certificate for the CA by using the above key and self sign it.
Openssl ca -config openssl.cnf -create_serial -out external-ca.csr -batch -keyfile private/cakey.pem -selfsign -extensions v3_ca -infiles careq.pem
· Now copy external-ca.csr to cacert.pem because the next command will by default look for the CA certificate with the name cacert.pem
Cp external-ca.csr cacert.pem
· Now create server keys and generate a server certificate request
Openssl req -nodes -new -keyout external-server.key -out cert-req.pem -config openssl.cnf
· Now create a certificate for the server by using the above key and sign it with the CA certificate
Openssl ca -config openssl.cnf -out external-server.csr -batch -infiles cert-req.pem
Now we have the following with us
External-ca.csr: CA certificate
External-server.csr: Server certificate which contains the public key
External-server.key: Server private key
· Now copy the CA certificate to the syslog-ng client and do the following
Openssl x509 –noout –hash –in external-ca.csr
· The output of the above command is a hash value and will be of the format fa6084d0. Now create a symbolic link for the certificate for debugging purposes.
Ln –s external-ca.csr fa6084d0.0
(please note the .0 suffix)
· Now look for following line in the syslog-ng.conf file in client
Destination d_logserver { tcp(); };
# Modify the above line to
Destination d_logserver { tcp(“external.badari.com”
port(514)
tls (ca_dir(“/opt/syslog-ng/etc/ca.d”))
);
};
Where external.badari.com is the FQDN of the server and 514 is the port where syslog listens and ca_dir is the place where we have copied the CA certificate
· Now open the syslog-ng.conf file on the server and look for the following
Source s_net {
Udp();
Tcp(); => Modify this line
Syslog();
};
To
Source s_net {
Udp();
Tcp(
Tls
(
Key_file(“/opt/syslog-ng/etc/external-server.key”)
Cert_file(“/opt/syslog-ng/etc/external-server.csr”)
Peer_verify(optional-untrusted)
)
);
Syslog();
};
* Where /opt/syslog-ng/etc/external-server.key is the location of private key of the server to decrypt the messages sent by the client.
* /opt/syslog-ng/etc/external-server.csr is the location of the certificate.
* Peer_verify(optional-untrusted) is to disable the mutual authentication so that the client doesn’t have to verify the server’s identity.
· Now restart the syslog-ng on both the machines and the user can see the logs going encrypted, from client to server, in the network captures.