This section discuss securing the link between the agents and the backend(s).
This document will be using the xca front-end to openssl to make things easy to do. You're free to use any other tools or even a distant CA as long as you get the requiered files.
The main point in securing the backend infrastructure is to authentify the backend on the agent. Once the agent allow the backend to push request and commands (planned feature) it will be mandatory to know if the requestor is actually allowed to run this command on the host. This feature will be only enabled using a secure connection.
This mean the quality and security of the signature is the most important thing. Obviously beside having your CA (or xca database) secured and out of reach of hackers.
On a debian-based system :
# aptitude install xca
Start xca :
$ xca
Click on "File" > "New"
Select a previously secured directory (chmod 0700) and give a name to the file
Use a strong passphase, you dont want someone else accessing this file.
Click on the "New Certificate" button :
Click on the "New Certificate" button :
Same as the agent authority giving it an adapted commonName
Click on the "New Certificate" button :
At this point you should have the following certificates available in the database :
The following section has to be done for all the backend you're using
Select the "backend CA" and click on the "New Certificate" button :
Select your newly created backend certificate :
Click the "Export" button
Select the "Watched agent CA" certificate and click the "Export" button
Select the "Private Keys" tab
Select the key for your backend and click on the "Export" button
Copy the 3 generated files to /etc/watched/ssl on the backend node
Make sure the permissions are correct on this directory :
# chown -R root:root /etc/watched/ssl # chmod 0700 /etc/watched/ssl # chmod 0600 /etc/watched/ssl/*
Edit the configuration file to update the location of the files :
# vi /etc/watched/back.config.json
{
...
"backend" :
{
"SSL_cert" : "/etc/watched/ssl/backend.pem", /* SSL certificate file for the backend */
"SSL_key" : "/etc/watched/ssl/backend.key", /* SSL backend private key file */
"SSL_verify" : "/etc/watched/ssl/backend.verify.pem" /* SSL certificate file containing the agents keychain */
},
...
}
Restart the backend :
# systemctl restart watched.back
From now on, your backend is able to handle agents using SSL
NB: delete every other copy of the "backend.key" file
Select the "agent CA" and click on the "New Certificate" button :
Finally click on the "OK" button
Select your newly created agent certificate :
Click the "Export" button
Select the "Watched backend CA" certificate and click the "Export" button
Select the "Private Keys" tab
Select the key for your backend and click on the "Export" button
Copy the 3 generated files to /etc/watched/ssl on the agent node
Make sure the permissions are correct on this directory :
# chown -R root:root /etc/watched/ssl # chmod 0700 /etc/watched/ssl # chmod 0600 /etc/watched/ssl/*
Edit the configuration file to update the location of the files :
# vi /etc/watched/agent.config.json
{
...
"server" :
{
"SSL_cert" : "/etc/watched/ssl/agent.pem", /* SSL certificate file for the agent */
"SSL_key" : "/etc/watched/ssl/agent.key", /* SSL private key file */
"SSL_verify" : "/etc/watched/ssl/agent.verify.pem" /* SSL certificate file containing the backend keychain */
...
},
...
}
Until the frontend offer a better option, this is just an update command in the database.
$ mysql -u watched -D watcheddb -p
update agents set use_ssl=1 where host='msiseb.chez.nous';
commit;
As root on the agent node :
# systemctl restart watched.back
As root on the backend node :
# systemctl restart watched.back
Follow the procedure to create a backend certificate :
Select your newly created user certificate and click the "Export" button :
Select the "Watched agent CA" certificate and click the "Export" button
In this section, on chrome browser is documented. Firefox and Edge browser have similar options.
In the chrome setting page, lookup "ssl" :
Now you can direct your browser to your agent URL safely