This article was reproduced with permission from reliancecyber.com. It outlines some of the practical steps needed to deploy Velociraptor with custom certificates and some step by step troubleshooting steps that can be used to diagnose deployment issues.
Velociraptor is a robust open-source tool designed for endpoint monitoring and digital forensics and response.
Velociraptor is a robust open-source tool designed for endpoint monitoring and digital forensics and response. Whether you deploy it on-premise or in the cloud, securing communication between the Velociraptor server and its clients is crucial. This blog post will guide you through creating and installing TLS certificates using DigiCert as your Certificate Authority (CA).
This guide has been written to provide additional guidance to the following official Velociraptor articles.
How do I use my own SSL certificates?
Velociraptor Security Configuration.
Before getting started, ensure you have the following:
You will need three key files for the Velociraptor server:
DigiCert will provide the following files:
your_domain_name.key
your_domain_name.crt
DigiCertCA.crt
TrustedRoot.crt
For details on how to request your certificates How do I Order a TLS/SSL Certificate? | DigiCert FAQ
To create the Velociraptor.pem file, you need to convert the Primary
Certificate (your_domain_name.crt
) file from CRT to PEM format.
Open a terminal and run the following command:
openssl x509 -in your_domain_name.crt -out velociraptor.pem -outform PEM
Verify the certificate details:
openssl x509 -in velociraptor.pem -text -noout
You should see the details of your certificate, such as the issuer, the subject, the validity period, and the public key.
Ensure the private key (your_domain_name.key
) is in PEM format and
decrypted. When viewed, the file should look like this:
-----BEGIN RSA PRIVATE KEY-----
{base64 encoded data}
-----END RSA PRIVATE KEY-----
To verify that the key format is valid, run the following command:
openssl rsa -in your_domain_name.key -check
You should see RSA key ok
.
To create the CA_chain.pem file, you need to combine the intermediate
certificate (DigiCertCA.crt
) and the root certificate
(TrustedRoot.crt
) into one file. This can be done by simply
concatenating the two files using a text editor or a command line
tool. For example, you can run the following command:
cat DigiCertCA.crt TrustedRoot.crt > CA_chain.pem
Ensure the order is correct: server certificate first, followed by intermediate certificates (you may have more than one), and finally the root certificate.
You should now have the following files in your cert folder:
To enable TLS encryption for the Velociraptor server and client:
./velociraptor-0.72.3-linux-amd64 config generate -i
Note: The version number may be different for the most recent release.
In this configuration I set frontend to communicate over port 443 as most firewalls in a network will allow this traffic outbound making it easier for the deployment of clients.
To use your own Certificates, you need to update the server
configuration file (server.config.yaml
)
Locate the frontend section and add the tls_certificate_filename
and tls_private_key_filename
parameters (these are not included by
default).
Enter the absolute path to these files. For testing, we placed them in /etc, but you may want to use a different location for production use.
Frontend:
tls_certificate_filename: /etc/velociraptor.pem
tls_private_key_filename: /etc/your_domain_key.key
Note: if you have already exported a client.config.yaml
, then you
need to update the client section in both server.config.yaml
configuration file and the client.config.yaml
configuration
file. Remember, the client configuration is embedded into the server
configuration file, so you need to update it there as well.
In the client section, modify use_self_signed_ssl
to be
false. This will tell the client to use the CA certificate instead
of the server certificate for verification.
Copy and paste the CA root and intermediate certificates (created
in the CA_chain.pem
file) to the root_certs
parameter. This will
allow the client to trust the CA certificate chain. For example:
use_self_signed_ssl: false
Crypto:
root_certs: |
-----BEGIN CERTIFICATE-----
The Intermediate Certificate
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
The Root Certificate
-----END CERTIFICATE-----
As discussed in the certificate section, ensure that the intermediate and root certificates are in the correct order. The server certificate should come first, followed by any intermediate certs, and finally the root trusted authority certificate (if self-signed) for more information, please see https://www.rfc-editor.org/rfc/rfc4346#section-7.4.2
To verify the TLS encryption:
GUI: Launch the Velociraptor server and connect to the GUI using your web browser. You should be able to access the GUI using the new certificate. You may need to trust the certificate in your browser or system to prevent errors.
Frontend: Launch the Velociraptor client and check the logs for any errors. The client should connect securely to the server using the trusted CA chain and the new server certificate.
No changes need to be made to the pinned certificate name, nor do any certificates need to be modified in the configuration files.
To validate that the certificates you are using are in the right format, you can use the command to diagnose issues:
openssl [x509|rsa] -in CERT_FILE -text -noout
If the certificates are in the right format and valid you should use
curl to confirm connectivity by requesting the server.pem
file from
the velociraptor server (as detailed in Troubleshooting and
Debugging).
curl https://localhost/server.pem -vvv
Reason: This command tests the server’s ability to serve the
certificate file (server.pem
) over HTTPS from the local machine. Using
the -vvv
flag enables verbose output, providing detailed information
about the connection process, including SSL/TLS handshake details. It
helps to confirm that:
curl https://localhost/server.pem -vvv -k
Reason: This command includes the -k option, which allows connections to servers using self-signed certificates. It helps to:
Bypass SSL Verification: Ensure that the server can still serve the certificate even when SSL verification is bypassed. This is useful for testing purposes when using self-signed certificates.
Debugging: Identify issues related to SSL verification failures that might not be apparent when SSL verification is enforced.
curl https://www.example.com/server.pem -vvv
Reason: Running this command from the localhost but using the domain name tests:
curl https://www.example.com/server.pem -vvv
Reason: This command tests the following from a remote client (a different machine than the server):
These steps validate the entire communication path, from local server configuration to remote client connectivity.
A proxy or SSL inspection device is a network device that inspects and modifies the traffic between the client and the server. Sometimes these devices can cause problems, especially if they are not configured properly or are incompatible with the server’s TLS version or cipher suite.
One possible error is this Server reports:
http: TLS handshake error from XX.XX.XX.XX: :22439 read tcp XX.XX.XX.XX:443-> XX.XX.XX.XX:22439: read: connection reset by peer
This means the server-client TLS connection was interrupted. This could be due to network issues, firewall settings, or expired certificates.
Another possible error reported by the client:
wsarecv: An existing connection was forcibly closed by the remote host.
This means the server or something in between closed the connection abruptly. This could be due to server overload, crash, or shutdown, or a proxy or SSL inspection device that interferes with the connection.
To check if there is a proxy or SSL inspection device that is causing the connection errors, run this command:
curl https[://]server.com/server.pem -vvv
This command tries to download the server’s certificate file using curl. If the command succeeds, there is no proxy or SSL inspection device that is blocking or altering the connection. If the command fails or idles, there is something in between that is preventing or delaying the connection.
If you suspect that there is a proxy or SSL inspection device that is causing the connection errors, try these solutions:
SSL Labs
or TestSSL
to check
the server’s TLS configuration and compare it with the proxy or SSL
inspection device.For full details on troubleshooting or for any other debugging issues, please see Troubleshooting and Debugging
Chris possesses over 10 years of experience across a series of Cyber roles within both the private public sector. As ex-military, Chris has responded to some of the largest and most high-profile cyber-attacks in addition to tracking sophisticated nation state threat actor groups.