Skip to content

Commit 0c991a9

Browse files
committed
Reorganize README
1 parent b7f9f1c commit 0c991a9

2 files changed

Lines changed: 25 additions & 49 deletions

File tree

README.md

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,11 @@ PoC to secure HEC using Let's Encrypt certificates.
66

77
### Steps
88

9-
<https://github.com/dd-Splunk/splunk-hec-secure/blob/8c8b2f22d379c7365dea59b1fa28fd38680cde14/scripts/create-certs.sh#L1-L31>
9+
- Create the certificates
1010

11-
```bash
12-
# Must be run as root
13-
14-
APP_DIR=$PWD/configs/mycerts
15-
DOMAIN=dessy.one
16-
SPLUNK_HOST=splunk
17-
FQDN=s${SPLUNK_HOST}.${DOMAIN}
18-
19-
# Standalone as no server exists yet.
20-
certbot certonly --standalone -d $FQDN
21-
cd /etc/letsencrypt/live/$FQDN
22-
23-
cp fullchain.pem prickey.pem $APP_DIR
24-
25-
# Get Let's Encrypt Root CA
26-
wget https://letsencrypt.org/certs/isrgrootx1.pem -P $APP_DIR
27-
28-
cat cert.pem privkey.pem chain.pem > $APP_DIR/hec.pem
29-
30-
chown splunk:splunk $APP_DIR/*.pem
31-
32-
```
11+
<https://github.com/dd-Splunk/splunk-hec-secure/blob/8c8b2f22d379c7365dea59b1fa28fd38680cde14/scripts/create-certs.sh#L3-L31>
3312

13+
At the end of the script the following should be
3414
in `$SPLUNK_HOME/etc/auth/mycerts`
3515

3616
```
@@ -41,25 +21,6 @@ in `$SPLUNK_HOME/etc/auth/mycerts`
4121
4222
```
4323

44-
To check for cert chain:
45-
46-
```bash
47-
openssl s_client -connect localhost:8000
48-
```
49-
50-
From: <https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-secure-the-event-collector-port-8088-with-an-ssl/m-p/243885>
51-
52-
This answer was the most helpful for me.
53-
I am adding a few things I found helpful for anyone using Certbot/LetsEncrypt
54-
55-
- Generate the pem key using the letsencrypt certs
56-
57-
```bash
58-
cd /etc/letsencrypt/live/your-server-hostname/
59-
cat cert.pem privkey.pem chain.pem > hec.pem
60-
chmod 644 hec.pem
61-
```
62-
6324
- Use the following for `inputs.conf`
6425

6526
```ìni
@@ -72,14 +33,27 @@ sslPassword =
7233
crossOriginSharingPolicy = *
7334
```
7435

75-
- Troubleshoot the connection
76-
77-
This comes from this forum post <https://community.splunk.com/t5/Security/Cna-t-Connect-to-HTTP-Event-Collector-Endpoint-with-My/m-p/308377>
78-
7936
### Test HEC
8037

38+
Send a test event:
39+
8140
```bash
82-
curl -k https://splunk.dessy.one:8088/services/collector/event \
41+
DOMAIN=dessy.one
42+
SPLUNK_HOST=splunk
43+
FQDN=${SPLUNK_HOST}.${DOMAIN}
44+
curl -k https://$FQDN:8088/services/collector/event \
8345
-H "Authorization: Splunk abcd-1234-efgh-5678" \
8446
-d '{"event":"hello world"}' -v
8547
```
48+
49+
### Troubleshooting
50+
51+
Check for cert chain integrity:
52+
53+
```bash
54+
DOMAIN=dessy.one
55+
SPLUNK_HOST=splunk
56+
FQDN=${SPLUNK_HOST}.${DOMAIN}
57+
openssl s_client -connect $FQDN:8000
58+
openssl s_client -connect $FQDN:8000
59+
```

scripts/create-certs.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ FQDN=${SPLUNK_HOST}.${DOMAIN}
1515
ROOT_CA=isrgrootx1.pem
1616

1717
# Create cert
18-
# certbot certonly --standalone -d $FQDN
18+
# Use standalone mode as no Web server exists yet.
19+
certbot certonly --standalone -d $FQDN
1920
cd /etc/letsencrypt/live/$FQDN
2021

2122
# Get Let's Encrypt Root CA
@@ -24,7 +25,8 @@ wget -q https://letsencrypt.org/certs/$ROOT_CA -O $APP_DIR/$ROOT_CA
2425
# Add Certs to the Splunk cert store
2526
cp fullchain.pem privkey.pem $APP_DIR
2627

27-
# Create chain of certs for HEC
28+
# Create chain of certs for HEC:
29+
# https://community.splunk.com/t5/All-Apps-and-Add-ons/How-do-I-secure-the-event-collector-port-8088-with-an-ssl/m-p/571431/highlight/true#M75360
2830
cat cert.pem privkey.pem chain.pem > $APP_DIR/hec.pem
2931

3032
# Ensure proper ownership

0 commit comments

Comments
 (0)