|
I would like to set up my Splunk-to-Splunk (forwarder to indexer) connections to use SSL with common-name-based authentication for my indexers, using self-signed server certificates created from a newly-created root certificate. Which steps do I need to take to configure Splunk to accomplish this task? |
|
Here is a detailed procedure to use non-default (in this case, self-signed) SSL certificates with common-name-based authentication (for the indexer(s) only) in a splunk2splunk (indexer to forwarder) connection. 1 - On a Splunk instance, create your own root certificate :(As per http://www.splunk.com/base/Documentation/latest/Admin/SecureaccesstoyourSplunkserverwithSSL#Generate_a_new_root_certificate) NOTE : For clarity's sake, it is better to generate new certificates in another directory than $SPLUNK_HOME/etc/auth in order not to overwrite those that exist there. In our example, we will create and use $SPLUNK_HOME/etc/certs. This will also ensure that you can keep using the certificates that ship with Splunk in $SPLUNK_HOME/etc/auth for other Splunk components if you wish to do so.
Point openssl to Splunk's openssl.cnf :
Generate a new root certificate :
=> This will create a new certificate authority public certificate in $SPLUNK_HOME/etc/certs/cacert.pem This public CA certificate is to be distributed to all Splunk instances (indexers and forwarders) who will be checking server certificates signed with the root certificate we just generated (ca.pem). 2 - Generate a new self-signed server certificate for your indexer, specifying your indexer's host name as the common name recorded in the certificate :(As per http://www.splunk.com/base/Documentation/latest/Admin/SecureaccesstoyourSplunkserverwithSSL#Generate_a_new_signed_certificate_and_private_key_pair) In our example, let's assume that your indexer's host name is "splunk-idx-01.example.com". Let's also assume that you want to use "changeme" as the password for your indexer's server certificate.
3 - Generate a new self-signed server certificate for your forwarders :In our example, let's assume that you want to use "changeme2" as the password for your forwarders' server certificates.
4 - Set up the indexer to use the newly created server certificate and to check the forwarders' certificates :First, copy the $SPLUNK_HOME/etc/certs/splunk-idx-01.pem and $SPLUNK_HOME/etc/certs/cacert.pem files to your indexer and put them in a newly created $SPLUNK_HOME/etc/certs directory. We will assume here that you will be using port 9997 to receive data from your forwarders. In $SPLUNK_HOME/etc/system/local/inputs.conf, set up the following stanzas :
Important note regarding Setting "requireClientCert = true" would require the following conditions to be met :
5 - Set up your forwarder(s) to use the newly created server certificates and to check the indexer's certificate with common name authentication :Copy the $SPLUNK_HOME/etc/certs/forwarder.pem and $SPLUNK_HOME/etc/certs/cacert.pem files to your forwarder(s) and put them in a newly created $SPLUNK_HOME/etc/certs directory. Then, define the following stanzas in $SPLUNK_HOME/etc/system/local/outputs.conf. Let's assume that your indexer's IP address is 192.168.1.100 :
Note that we have set "sslVerifyServerCert = true". This requires the following conditions to be met :
6 - You should now see the indexer and the forwarder establishing an SSL connection. Here's what it looks like in $SPLUNK_HOME/var/log/splunk/splunkd.log on both sides.
(During start up...)
(...then when the forwarder connects)
(During start up...)
(...then, as the forwarder keeps the connection alive about every 30 seconds...)
7 - Troubleshooting : If things don't work out right!a) First, check in $SPLUNK_HOME/var/log/splunk/splunkd.log on both ends for errors. On the indexer, check for the messages from the TCP input processor "TcpInputProc", and on the forwarder, check the messages from the TCP output processor "TcpOutputProc". b) If necessary, increase the logging level of the appropriate processors on the indexer and the forwarder in $SPLUNK_HOME/etc/log.cfg. On the forwarder, set "category.TcpOutputProc=DEBUG", on the indexer set "category.TcpInputProc=DEBUG". Restart Splunk for these to take effect. c) Check the SSL configuration as it is seen by Splunk using btool.
d) Make sure that the certificates are readable by the user that Splunk runs as. Indexer-side, two common problems are :
On *nix, you can manually test the password of the RSA key contained in the file by running the following openssl command :
The same can be done on Windows with the openssl binary that ships with Splunk :
e) More information regarding the configuration of splunk2splunk SSL connections can be found here in the online documentation : http://www.splunk.com/base/Documentation/latest/Admin/EncryptandauthenticatedatawithSSL The Splunk community wiki also has detailed tutorials on how to set up SSL for forwarding with 3 different scenarios :
link
This answer is marked "community wiki".
2
There is a mistake in your example for configuration on the forwarder side. The config option is called sslCertPath and not sslServerCertPath. Please correct that...
(06 Oct '10, 09:13)
ziegfried ♦
Hello... I am about to configure SSL for Forwarder-to-Indexer communication, so this post is a Gift from Above! I did have one question, though, regarding the following piece of information... "If you are in a distributed environment and therefore have one server certificate per indexer, set up one [tcpout-server:...] stanza per indexer with "sslServerCertPath" pointing to each individual server certificate" As has been pointed out by ziegfried above, the config option is "sslCertPath" (no "Server"). But, that's not what confuses me. What got me is... The sslCertPath option is specified on the Forwarder, and refers to the forwarder/client cert, right??? The forwarder does not reference the Indexer/Server cert, right?? Thx for any clarification for this rookie :-) mfeeny1
(20 Sep '11, 19:17)
mfeeny1
@mfeeny1 : If all of your indexers have certificates signed by the same CA (which I imagine is the case), you'll simply need to make sure that they each have their own [tcpout-server://server:port] stanza and that "sslRootCAPath" in each of these stanzas points to a file containing the public key of the CA that signed the server certificates present on the indexers. sslCertPath does indeed refer to the certificate presented by the forwarder to the indexer, but note that due to a bug, that certificate cannot currently be checked by the indexer. Regardless of that, it still needs to be present!
(28 Sep '11, 12:05)
hexx ♦
hexx, Thx for the response! Little by little, I am figuring this stuff out (I think!! ;-) Here is where I am now... I have Forwarder-Indexer SSL communication WORKING - it is using our "corporate" cert (not Splunk's), and it is also doing Authentication. BUT... (always a but, right)... Although I feel 99% sure I am using comparable settings, I can NOT get Deployment Client - Deployment Server SSL communications to work. Actually... If I do NOT request Authentication of the Client, then it DOES work, with the corporate certs. But, if I request Authentication ("requireClientCert = true", specified in Deployment Server's server.conf), it fails. When it fails, the Deployment Server's splunkd.log has an entry that says: TcpInputProc - SSL clause not found or servercert not provided - SSL ports will not be available On the Deployment Client, a packet capture shows that the Deployment Server sent the following SSL message, during the SSL handshake: Alert (Level: Fatal, Description: Bad Certificate) SO... As part of my troubleshooting, I opened up server.conf.spec, to tease out whatever info I could, regarding the "requireClientCert" attribute. Here is what it says:
(Note: The bolding of "our", above, is mine, not server.conf.spec's.) Am I reading to closely if I interpret our to mean Splunk's, and not our corporate CA??? Is it possible that this is failing because it doesn't see Splunk's CA in my client cert?? This seems illogical, but I'm running out of logic, at this point :-( It also seems illogical, because Forwarder-Indexer SSL communication is working, and I'm using the same Client cert for that traffic. Bottom line... I'll accept any ideas anyone has, on what I'm doing wrong, or how I can diagnose this problem? Thx MUCH! mfeeny1
(28 Sep '11, 13:58)
mfeeny1
@mfeeny1 : I fear that this is the same issue mentioned in the tutorial where "requireClientCert = true" in the indexer's inputs.conf causes the SSL communication to fail, regardless of how valid the certificates are. This is bug SPL-37637. Please open a support case if you want to have this assessed further and tracked.
(28 Sep '11, 14:28)
hexx ♦
requireClientCert currently does not interoperate successfully with splunkweb, the cli rest client, and possibly deployment client. Much of this is being worked on presently, not for 4.2.4 but for a bit later.
(10 Oct '11, 15:05)
jrodman ♦
showing 5 of 7
show 2 more comments ▼
|
