splunksecrets 1.1.0__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/.github/workflows/tests.yml +11 -6
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/Justfile +9 -0
- splunksecrets-1.2.0/PKG-INFO +337 -0
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/README.rst +55 -9
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/pyproject.toml +3 -2
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/splunksecrets/__init__.py +6 -9
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/splunksecrets/cli.py +75 -12
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/splunksecrets/dbconnect.py +30 -2
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/splunksecrets/phantom.py +1 -1
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/splunksecrets/splunk.py +104 -11
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/tests/test_splunksecrets.py +297 -4
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/uv.lock +25 -25
- splunksecrets-1.1.0/PKG-INFO +0 -10
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/.github/workflows/publish.yml +0 -0
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/.gitignore +0 -0
- {splunksecrets-1.1.0 → splunksecrets-1.2.0}/tests/__init__.py +0 -0
|
@@ -3,7 +3,7 @@ name: Tests
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
- "*"
|
|
6
|
+
- "**" # "*" skips branch names with a /
|
|
7
7
|
pull_request:
|
|
8
8
|
branches:
|
|
9
9
|
- master
|
|
@@ -12,6 +12,10 @@ on:
|
|
|
12
12
|
jobs:
|
|
13
13
|
main-lint-test:
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
|
+
env:
|
|
16
|
+
# uv downloads this version if the runner lacks it; without it uv uses the
|
|
17
|
+
# runner's /usr/bin/python3. Not setup-python: it has no 3.9 for Ubuntu 26.04
|
|
18
|
+
UV_PYTHON: ${{ matrix.python-version }}
|
|
15
19
|
strategy:
|
|
16
20
|
matrix:
|
|
17
21
|
python-version:
|
|
@@ -20,6 +24,7 @@ jobs:
|
|
|
20
24
|
- "3.11"
|
|
21
25
|
- "3.12"
|
|
22
26
|
- "3.13"
|
|
27
|
+
- "3.14"
|
|
23
28
|
|
|
24
29
|
steps:
|
|
25
30
|
- name: 🛎️ Checkout
|
|
@@ -28,14 +33,14 @@ jobs:
|
|
|
28
33
|
- name: 📦 Install uv
|
|
29
34
|
uses: astral-sh/setup-uv@v5
|
|
30
35
|
|
|
31
|
-
- name: 🐍 Set up Python
|
|
32
|
-
uses: actions/setup-python@v5
|
|
33
|
-
|
|
34
36
|
- name: 🚀 Install just
|
|
35
37
|
uses: extractions/setup-just@v2
|
|
36
38
|
|
|
37
39
|
- name: 🦾 Install the project
|
|
38
40
|
run: just dev-sync
|
|
39
41
|
|
|
40
|
-
- name:
|
|
41
|
-
run:
|
|
42
|
+
- name: 🐍 Check the matrix Python is the one in use
|
|
43
|
+
run: uv run python -c "import sys; v = '${{ matrix.python-version }}'; assert sys.version.startswith(v + '.'), sys.version"
|
|
44
|
+
|
|
45
|
+
- name: 💅 🧪 Check format and lint, then test
|
|
46
|
+
run: just check
|
|
@@ -19,6 +19,15 @@ test:
|
|
|
19
19
|
|
|
20
20
|
validate: format lint test
|
|
21
21
|
|
|
22
|
+
format-check:
|
|
23
|
+
uv run ruff format --check
|
|
24
|
+
|
|
25
|
+
lint-check:
|
|
26
|
+
uv run ruff check
|
|
27
|
+
|
|
28
|
+
# CI runs this: it fails on format and lint problems instead of fixing them
|
|
29
|
+
check: format-check lint-check test
|
|
30
|
+
|
|
22
31
|
dockerize:
|
|
23
32
|
docker build -t python-repo-template .
|
|
24
33
|
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: splunksecrets
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Command-line tools for working with secrets for Splunk products
|
|
5
|
+
Author: Steve McMaster, Cameron Schmidt
|
|
6
|
+
Maintainer: Cameron Schmidt
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: click>=8.0.0
|
|
9
|
+
Requires-Dist: cryptography>=43
|
|
10
|
+
Requires-Dist: pcrypt
|
|
11
|
+
Description-Content-Type: text/x-rst
|
|
12
|
+
|
|
13
|
+
splunksecrets - Encrypt and Decrypt Splunk Passwords
|
|
14
|
+
====================================================
|
|
15
|
+
|
|
16
|
+
|Build Status|
|
|
17
|
+
|
|
18
|
+
``splunksecrets`` is a tool for working with Splunk secrets offline. It
|
|
19
|
+
currently supports encryption and decryption of passwords, but in the
|
|
20
|
+
future will support offline recursive conversion of a Splunk
|
|
21
|
+
installation from one splunk.secret file to another (e.g. for
|
|
22
|
+
synchronizing splunk.secret across your entire distributed
|
|
23
|
+
infrastructure).
|
|
24
|
+
|
|
25
|
+
Installation
|
|
26
|
+
------------
|
|
27
|
+
|
|
28
|
+
You can install ``splunksecrets`` using ``uv``:
|
|
29
|
+
|
|
30
|
+
::
|
|
31
|
+
|
|
32
|
+
uv tool install splunksecrets
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Or with pip:
|
|
36
|
+
|
|
37
|
+
::
|
|
38
|
+
|
|
39
|
+
python -m pip install splunksecrets
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Usage
|
|
43
|
+
-----
|
|
44
|
+
|
|
45
|
+
As of version 1.0.0, splunksecrets is broken into subcommands for each
|
|
46
|
+
operaton
|
|
47
|
+
|
|
48
|
+
::
|
|
49
|
+
|
|
50
|
+
Usage: splunksecrets [OPTIONS] COMMAND [ARGS]...
|
|
51
|
+
|
|
52
|
+
Options:
|
|
53
|
+
--help Show this message and exit.
|
|
54
|
+
|
|
55
|
+
Commands:
|
|
56
|
+
dbconnect-decrypt Decrypt password used for dbconnect identity
|
|
57
|
+
dbconnect-decrypt-fips Decrypt DB Connect password encrypted in FIPS mode
|
|
58
|
+
dbconnect-encrypt Encrypt password used for dbconnect identity
|
|
59
|
+
dbconnect-legacy-encrypt Encrypt password used for dbconnect identity using legacy algorithm
|
|
60
|
+
phantom-decrypt Decrypt password used for Phantom asset
|
|
61
|
+
phantom-encrypt Encrypt password used for Phantom asset
|
|
62
|
+
splunk-decrypt Decrypt password using Splunk 7.2 or 10.6 algorithm
|
|
63
|
+
splunk-encrypt Encrypt password using Splunk 7.2 or 10.6 algorithm
|
|
64
|
+
splunk-hash-passwd Generate password hash for use in...
|
|
65
|
+
splunk-legacy-decrypt Decrypt password using legacy Splunk algorithm...
|
|
66
|
+
splunk-legacy-encrypt Encrypt password using legacy Splunk algorithm...
|
|
67
|
+
|
|
68
|
+
You can find details of the usage of each subcommand by running the command
|
|
69
|
+
followed by ``--help``.
|
|
70
|
+
|
|
71
|
+
- **dbconnect-encrypt** and **dbconnect-decrypt** are for interacting with
|
|
72
|
+
credentials stored in ``identities.conf`` in splunk_app_db_connect
|
|
73
|
+
- **dbconnect-decrypt-fips** is for the same credentials when DB Connect runs
|
|
74
|
+
in FIPS mode
|
|
75
|
+
- **phantom-encrypt** and **phantom-decrypt** are for interacting with
|
|
76
|
+
credentials stored in the Phantom database
|
|
77
|
+
- **splunk-encrypt** and **splunk-decrypt** are for interacting with
|
|
78
|
+
credentials from Splunk 7.2 or newer. ``splunk-decrypt`` reads both ``$7$``
|
|
79
|
+
and ``$8$`` values. ``splunk-encrypt`` writes ``$7$`` by default; pass
|
|
80
|
+
``--v8`` to write ``$8$``, which only Splunk 10.6 or newer can read
|
|
81
|
+
- **splunk-legacy-encrypt** and **splunk-legacy-decrypt** are for interacting
|
|
82
|
+
with credentials from Splunk versions below 7.2
|
|
83
|
+
- **splunk-hash-passwd** is for generating Splunk local user password hashes
|
|
84
|
+
for use in ``$SPLUNK_HOME/etc/passwd``
|
|
85
|
+
|
|
86
|
+
Encryption Schemes
|
|
87
|
+
------------------
|
|
88
|
+
|
|
89
|
+
Splunk passwd hashes
|
|
90
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
91
|
+
|
|
92
|
+
Splunk password hashes are not, strictly speaking, encrypted. They're
|
|
93
|
+
hashed using the standard Unix ``crypt`` function. The ``$6$`` indicates
|
|
94
|
+
that SHA-512 hashing algorithm is used. Details on SHA-crypt can be
|
|
95
|
+
found `here <https://akkadia.org/drepper/SHA-crypt.txt>`__.
|
|
96
|
+
|
|
97
|
+
Splunk pre-7.2
|
|
98
|
+
~~~~~~~~~~~~~~
|
|
99
|
+
|
|
100
|
+
Splunk prior to 7.2 used RC4 encryption for secrets, indicated in
|
|
101
|
+
configuration files by ``$1$`` in the encrypted password. The plaintext
|
|
102
|
+
password is XOR'ed with a static salt (``DEFAULTSA``) and then RC4
|
|
103
|
+
encrypted using the first 16-bytes of ``splunk.secret`` as the key. The
|
|
104
|
+
resulting ciphertext is base64-encoded and prepended with ``$1$`` to
|
|
105
|
+
produce the encrypted password seen in the configuration files.
|
|
106
|
+
|
|
107
|
+
Splunk 7.2
|
|
108
|
+
~~~~~~~~~~
|
|
109
|
+
|
|
110
|
+
Starting in Splunk 7.2, AES256-GCM is used for encryption of secrets,
|
|
111
|
+
indicated in configuration files by ``$7$`` in the encrypted password.
|
|
112
|
+
The ``PBKDF2`` algorithm is used to derive an encryption key from all
|
|
113
|
+
254 bytes of ``splunk.secret`` (the newline character is stripped from
|
|
114
|
+
the end of the file), using a static salt of ``disk-encryption`` and a
|
|
115
|
+
single iteration. This 256-bit key is then used as the encryption key
|
|
116
|
+
for AES256-GCM, with a 16-byte randomly generated initialization vector.
|
|
117
|
+
The encryption produces both the ciphertext as well as a "tag" that is
|
|
118
|
+
used as part of integrity verification. The iv, ciphertext, and tag (in
|
|
119
|
+
that order) are concatenated, base64-encoded, and prepended with ``$7$``
|
|
120
|
+
to produce the encrypted password seen in the configuration files. If
|
|
121
|
+
the key is less than 254-bytes it is padded with null bytes.
|
|
122
|
+
|
|
123
|
+
Splunk 10.6
|
|
124
|
+
~~~~~~~~~~~
|
|
125
|
+
|
|
126
|
+
Starting in Splunk 10.6, ``PBKDF2`` is replaced with ``HKDF`` as the key
|
|
127
|
+
derivation function, and these secrets are indicated in configuration
|
|
128
|
+
files by ``$8$`` in the encrypted password. The encryption key is still
|
|
129
|
+
derived from all 254 bytes of ``splunk.secret`` (with the newline
|
|
130
|
+
character still stripped), using a random 16-byte salt, and a static
|
|
131
|
+
info string of ``disk-encryption-hkdf``. The AES256-GCM is performed in
|
|
132
|
+
the same manner as the 7.2 encryption. The output is created by
|
|
133
|
+
concatenating the prefix (``$8$``), base64-encoded HKDF salt, ``$`` as
|
|
134
|
+
the field separator, and the base64-encoded AES payload (iv, ciphertext,
|
|
135
|
+
and tag, in that order, with no separator). If the key is less than
|
|
136
|
+
254-bytes it is padded with null bytes.
|
|
137
|
+
|
|
138
|
+
Phantom
|
|
139
|
+
~~~~~~~
|
|
140
|
+
|
|
141
|
+
Phantom stores encrypted credentials in it's internal database as part
|
|
142
|
+
of the JSON blob in the ``configuration`` column of the asset table.
|
|
143
|
+
These credentials are encrypted using AES256-CBC and are stored
|
|
144
|
+
base64-encoded. A SHA256 hash is generated using the public modulus of
|
|
145
|
+
the Phantom RSA private key (located at
|
|
146
|
+
``/opt/phantom/keystore/private_key.pem``) concatenated with the
|
|
147
|
+
Django ``SECRET_KEY`` (found in
|
|
148
|
+
``/opt/phantom/www/phantom_ui/secret_key.py``) - this hash is used as
|
|
149
|
+
the key for the AES encryption. A SHA1 hash is generated using the
|
|
150
|
+
``id`` of the asset from the ``asset`` table - this hash is used as
|
|
151
|
+
the initialization vector (``iv``) for the AES encryption. The password
|
|
152
|
+
to be encrypted is padded using PKCS7 padding prior to encryption.
|
|
153
|
+
|
|
154
|
+
DBConnect pre ~3.12
|
|
155
|
+
~~~~~~~~~~~~~~~~~~~
|
|
156
|
+
|
|
157
|
+
DBConnect used to encrypt passwords using the OpenSSL ``aes-256-cbc`` command.
|
|
158
|
+
This changed somewhere around 3.12 though I haven't bothered to find the exact
|
|
159
|
+
version where the change was made.
|
|
160
|
+
This encryption is fairly straightforward, and is documented in
|
|
161
|
+
``dbxcrypto.py`` included with DBConnect. The key and IV are derived from
|
|
162
|
+
the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
|
|
163
|
+
and the salt (randomly generated by OpenSSL). The resulting ciphertext is
|
|
164
|
+
concatenated together with the salt (``Salted__`` + salt + ciphertext) and
|
|
165
|
+
encoded using Base64. The password to be encrypted is padded using PKCS7
|
|
166
|
+
padding prior to encryption.
|
|
167
|
+
|
|
168
|
+
DBConnect post ~3.12
|
|
169
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
170
|
+
|
|
171
|
+
DBConnect now encrypts passwords using AES GCM with no padding.
|
|
172
|
+
A random 16-byte salt is generated as well as a random 12-byte IV. The key is derived
|
|
173
|
+
from the salt and the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
|
|
174
|
+
using Scrypt. The final output is ``salt`` + ``iv`` + ``ciphertext``.
|
|
175
|
+
|
|
176
|
+
DBConnect in FIPS mode
|
|
177
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
178
|
+
|
|
179
|
+
Scrypt isn't FIPS-approved, so DBConnect running in FIPS mode derives the key
|
|
180
|
+
with ``PBKDF2`` (HMAC-SHA256, 32 iterations) instead. Everything else matches
|
|
181
|
+
the post ~3.12 scheme: AES GCM, with an output of ``salt`` (16 bytes) + ``iv``
|
|
182
|
+
(12 bytes) + ``ciphertext``. Use ``dbconnect-decrypt-fips`` for these passwords.
|
|
183
|
+
|
|
184
|
+
Known Issues
|
|
185
|
+
------------
|
|
186
|
+
|
|
187
|
+
- If the splunk secret and an encrypted password don't match, ``$7$`` and
|
|
188
|
+
``$8$`` passwords fail with "wrong splunk.secret or corrupted value".
|
|
189
|
+
``$1$`` (pre-7.2) passwords have no integrity check, so a mismatched secret
|
|
190
|
+
still produces gibberish output instead of an error.
|
|
191
|
+
- DBConnect will occassionally store the ending newline from OpenSSL output in
|
|
192
|
+
identities.conf, represented as a single ``\`` at the end of a line. This
|
|
193
|
+
must be removed prior to passing encrypted passwords to ``splunksecrets``
|
|
194
|
+
|
|
195
|
+
Version History
|
|
196
|
+
---------------
|
|
197
|
+
Version 1.2.0 (2026-11-18)
|
|
198
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
199
|
+
- Added support for Splunk 10.6 ``$8$`` passwords: ``splunk-decrypt`` reads
|
|
200
|
+
them, ``splunk-encrypt --v8`` writes them, and ``encrypt_v8`` writes them
|
|
201
|
+
from the library
|
|
202
|
+
- Added ``dbconnect-decrypt-fips`` for DB Connect passwords encrypted in FIPS
|
|
203
|
+
mode. Thanks to grokdesigns for this contribution.
|
|
204
|
+
- ``$7$`` and ``$8$`` decryption now checks the GCM tag, so a wrong
|
|
205
|
+
splunk.secret or a corrupted value fails with a clear error instead of
|
|
206
|
+
returning garbage
|
|
207
|
+
- ``splunk-encrypt``, ``splunk-decrypt``, ``splunk-legacy-decrypt`` and the
|
|
208
|
+
DB Connect decrypt commands report bad input and failed decryption as a
|
|
209
|
+
one-line error instead of a traceback
|
|
210
|
+
- **Behavior change for library callers:** ``splunksecrets.decrypt`` now
|
|
211
|
+
raises ``ValueError`` for an unknown prefix (it used to return ``None``),
|
|
212
|
+
and for a wrong splunk.secret or a corrupted ``$7$``/``$8$`` value (it used
|
|
213
|
+
to return garbage or raise ``UnicodeDecodeError``)
|
|
214
|
+
|
|
215
|
+
Version 1.1.0 (2025-06-05)
|
|
216
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
217
|
+
- Added support for encryption/decryption of DBConnect credentials using newer algorithm
|
|
218
|
+
- Bumps minimum Python version to 3.9
|
|
219
|
+
- Refactored code into multiple files
|
|
220
|
+
- Switched from setup.py to pyproject.toml
|
|
221
|
+
- Removed ``six`` dependency used for Python 2 compatibility
|
|
222
|
+
|
|
223
|
+
Version 1.0.1
|
|
224
|
+
~~~~~~~~~~~~~~
|
|
225
|
+
- Short secrets are padded in the same way Splunk itself does it. Thanks to
|
|
226
|
+
Matt Anderson for this contribution.
|
|
227
|
+
|
|
228
|
+
Version 1.0.0 (2021-06-07)
|
|
229
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
230
|
+
- Updated CLI command docstrings for proper help output
|
|
231
|
+
- Add initial support for encryption/decrypt of Splunk DBConnect credentials
|
|
232
|
+
|
|
233
|
+
Version 1.0.0rc1 (2021-05-19)
|
|
234
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
235
|
+
- New CLI interface that breaks each operation into its own subcommand
|
|
236
|
+
- CLI interface supports passing path to key files (splunk.secret,
|
|
237
|
+
private_key.pem, and secret_key.py) via arguments, or file contents
|
|
238
|
+
via environment variables
|
|
239
|
+
- Add initial support for encryption/decryption of Phantom asset
|
|
240
|
+
credentials (thanks swoops)
|
|
241
|
+
|
|
242
|
+
Version 0.5.1 (2022-06-29)
|
|
243
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
244
|
+
- Allow passing the splunk secret itself as an environment variable
|
|
245
|
+
~ provided by chutzimir
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
Version 0.5.0 (2020-06-23)
|
|
249
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
250
|
+
- Add support for passing a path to splunk.secret, the splunk.secret
|
|
251
|
+
contents, and the password/password hash via environment variables
|
|
252
|
+
(thanks hanswurscht)
|
|
253
|
+
- Added error output when trying to decrypt user passwords
|
|
254
|
+
|
|
255
|
+
Version 0.4.3 (2020-02-17)
|
|
256
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
257
|
+
|
|
258
|
+
- Correct an issue when splunk secret is too long. Splunk handles this
|
|
259
|
+
by truncating splunk.secret to 254 bytes, so we now do the same
|
|
260
|
+
(thanks nbertram)
|
|
261
|
+
- Added error checking in case, somehow, splunk secret is too short.
|
|
262
|
+
|
|
263
|
+
Version 0.4.2 (2019-09-29)
|
|
264
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
265
|
+
|
|
266
|
+
- Add handling for incorrectly padded (but otherwise correct) password
|
|
267
|
+
strings as a convenience (thanks rafrey-his)
|
|
268
|
+
|
|
269
|
+
Version 0.4.1 (2019-09-11)
|
|
270
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
271
|
+
|
|
272
|
+
- Fix an issue in Python 3 when using ``--splunk-secret-text`` (thanks
|
|
273
|
+
Joeboyc2)
|
|
274
|
+
|
|
275
|
+
Version 0.4.0 (2019-03-25)
|
|
276
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
277
|
+
|
|
278
|
+
- Add ``--hash-passwd`` flag for generating Splunk password hashes
|
|
279
|
+
|
|
280
|
+
Version 0.3.1 (2019-02-06)
|
|
281
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
282
|
+
|
|
283
|
+
- Fix bug when a character in the password was the same as the salt
|
|
284
|
+
character
|
|
285
|
+
- Add ``--splunk-secret-text`` and ``--password`` arguments for
|
|
286
|
+
non-interactive use (thanks nadidsky)
|
|
287
|
+
|
|
288
|
+
Version 0.3.0 (2019-01-26)
|
|
289
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
290
|
+
|
|
291
|
+
- Add ``--nosalt`` flag for pre-7.2 passwords that are not salted, such
|
|
292
|
+
as ``sslPassword`` (thanks duckfez)
|
|
293
|
+
|
|
294
|
+
Version 0.2.1 (2018-10-27)
|
|
295
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
296
|
+
|
|
297
|
+
- Cosmetic release to update metadata on PyPI
|
|
298
|
+
|
|
299
|
+
Version 0.2.0 (2018-10-24)
|
|
300
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
301
|
+
|
|
302
|
+
- Add support for Splunk 7.2
|
|
303
|
+
|
|
304
|
+
Version 0.1.0 (2018-10-08)
|
|
305
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
306
|
+
|
|
307
|
+
- Initial release
|
|
308
|
+
- Support Splunk < 7.2
|
|
309
|
+
|
|
310
|
+
License Info
|
|
311
|
+
------------
|
|
312
|
+
|
|
313
|
+
The MIT License (MIT)
|
|
314
|
+
|
|
315
|
+
Copyright (c) 2025 Hurricane Labs LLC
|
|
316
|
+
|
|
317
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
318
|
+
copy of this software and associated documentation files (the
|
|
319
|
+
"Software"), to deal in the Software without restriction, including
|
|
320
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
321
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
322
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
323
|
+
the following conditions:
|
|
324
|
+
|
|
325
|
+
The above copyright notice and this permission notice shall be included
|
|
326
|
+
in all copies or substantial portions of the Software.
|
|
327
|
+
|
|
328
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
329
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
330
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
331
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
332
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
333
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
334
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
335
|
+
|
|
336
|
+
.. |Build Status| image:: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml/badge.svg
|
|
337
|
+
:target: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml
|
|
@@ -42,12 +42,13 @@ operaton
|
|
|
42
42
|
|
|
43
43
|
Commands:
|
|
44
44
|
dbconnect-decrypt Decrypt password used for dbconnect identity
|
|
45
|
+
dbconnect-decrypt-fips Decrypt DB Connect password encrypted in FIPS mode
|
|
45
46
|
dbconnect-encrypt Encrypt password used for dbconnect identity
|
|
46
47
|
dbconnect-legacy-encrypt Encrypt password used for dbconnect identity using legacy algorithm
|
|
47
48
|
phantom-decrypt Decrypt password used for Phantom asset
|
|
48
49
|
phantom-encrypt Encrypt password used for Phantom asset
|
|
49
|
-
splunk-decrypt Decrypt password using Splunk 7.2 algorithm
|
|
50
|
-
splunk-encrypt Encrypt password using Splunk 7.2 algorithm
|
|
50
|
+
splunk-decrypt Decrypt password using Splunk 7.2 or 10.6 algorithm
|
|
51
|
+
splunk-encrypt Encrypt password using Splunk 7.2 or 10.6 algorithm
|
|
51
52
|
splunk-hash-passwd Generate password hash for use in...
|
|
52
53
|
splunk-legacy-decrypt Decrypt password using legacy Splunk algorithm...
|
|
53
54
|
splunk-legacy-encrypt Encrypt password using legacy Splunk algorithm...
|
|
@@ -57,10 +58,14 @@ followed by ``--help``.
|
|
|
57
58
|
|
|
58
59
|
- **dbconnect-encrypt** and **dbconnect-decrypt** are for interacting with
|
|
59
60
|
credentials stored in ``identities.conf`` in splunk_app_db_connect
|
|
61
|
+
- **dbconnect-decrypt-fips** is for the same credentials when DB Connect runs
|
|
62
|
+
in FIPS mode
|
|
60
63
|
- **phantom-encrypt** and **phantom-decrypt** are for interacting with
|
|
61
64
|
credentials stored in the Phantom database
|
|
62
65
|
- **splunk-encrypt** and **splunk-decrypt** are for interacting with
|
|
63
|
-
credentials from Splunk 7.2 or newer
|
|
66
|
+
credentials from Splunk 7.2 or newer. ``splunk-decrypt`` reads both ``$7$``
|
|
67
|
+
and ``$8$`` values. ``splunk-encrypt`` writes ``$7$`` by default; pass
|
|
68
|
+
``--v8`` to write ``$8$``, which only Splunk 10.6 or newer can read
|
|
64
69
|
- **splunk-legacy-encrypt** and **splunk-legacy-decrypt** are for interacting
|
|
65
70
|
with credentials from Splunk versions below 7.2
|
|
66
71
|
- **splunk-hash-passwd** is for generating Splunk local user password hashes
|
|
@@ -103,6 +108,21 @@ that order) are concatenated, base64-encoded, and prepended with ``$7$``
|
|
|
103
108
|
to produce the encrypted password seen in the configuration files. If
|
|
104
109
|
the key is less than 254-bytes it is padded with null bytes.
|
|
105
110
|
|
|
111
|
+
Splunk 10.6
|
|
112
|
+
~~~~~~~~~~~
|
|
113
|
+
|
|
114
|
+
Starting in Splunk 10.6, ``PBKDF2`` is replaced with ``HKDF`` as the key
|
|
115
|
+
derivation function, and these secrets are indicated in configuration
|
|
116
|
+
files by ``$8$`` in the encrypted password. The encryption key is still
|
|
117
|
+
derived from all 254 bytes of ``splunk.secret`` (with the newline
|
|
118
|
+
character still stripped), using a random 16-byte salt, and a static
|
|
119
|
+
info string of ``disk-encryption-hkdf``. The AES256-GCM is performed in
|
|
120
|
+
the same manner as the 7.2 encryption. The output is created by
|
|
121
|
+
concatenating the prefix (``$8$``), base64-encoded HKDF salt, ``$`` as
|
|
122
|
+
the field separator, and the base64-encoded AES payload (iv, ciphertext,
|
|
123
|
+
and tag, in that order, with no separator). If the key is less than
|
|
124
|
+
254-bytes it is padded with null bytes.
|
|
125
|
+
|
|
106
126
|
Phantom
|
|
107
127
|
~~~~~~~
|
|
108
128
|
|
|
@@ -120,7 +140,7 @@ the initialization vector (``iv``) for the AES encryption. The password
|
|
|
120
140
|
to be encrypted is padded using PKCS7 padding prior to encryption.
|
|
121
141
|
|
|
122
142
|
DBConnect pre ~3.12
|
|
123
|
-
|
|
143
|
+
~~~~~~~~~~~~~~~~~~~
|
|
124
144
|
|
|
125
145
|
DBConnect used to encrypt passwords using the OpenSSL ``aes-256-cbc`` command.
|
|
126
146
|
This changed somewhere around 3.12 though I haven't bothered to find the exact
|
|
@@ -141,19 +161,45 @@ A random 16-byte salt is generated as well as a random 12-byte IV. The key is de
|
|
|
141
161
|
from the salt and the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
|
|
142
162
|
using Scrypt. The final output is ``salt`` + ``iv`` + ``ciphertext``.
|
|
143
163
|
|
|
164
|
+
DBConnect in FIPS mode
|
|
165
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
166
|
+
|
|
167
|
+
Scrypt isn't FIPS-approved, so DBConnect running in FIPS mode derives the key
|
|
168
|
+
with ``PBKDF2`` (HMAC-SHA256, 32 iterations) instead. Everything else matches
|
|
169
|
+
the post ~3.12 scheme: AES GCM, with an output of ``salt`` (16 bytes) + ``iv``
|
|
170
|
+
(12 bytes) + ``ciphertext``. Use ``dbconnect-decrypt-fips`` for these passwords.
|
|
171
|
+
|
|
144
172
|
Known Issues
|
|
145
173
|
------------
|
|
146
174
|
|
|
147
|
-
- If the splunk secret and an encrypted password don't match,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
175
|
+
- If the splunk secret and an encrypted password don't match, ``$7$`` and
|
|
176
|
+
``$8$`` passwords fail with "wrong splunk.secret or corrupted value".
|
|
177
|
+
``$1$`` (pre-7.2) passwords have no integrity check, so a mismatched secret
|
|
178
|
+
still produces gibberish output instead of an error.
|
|
151
179
|
- DBConnect will occassionally store the ending newline from OpenSSL output in
|
|
152
180
|
identities.conf, represented as a single ``\`` at the end of a line. This
|
|
153
181
|
must be removed prior to passing encrypted passwords to ``splunksecrets``
|
|
154
182
|
|
|
155
183
|
Version History
|
|
156
184
|
---------------
|
|
185
|
+
Version 1.2.0 (2026-11-18)
|
|
186
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
187
|
+
- Added support for Splunk 10.6 ``$8$`` passwords: ``splunk-decrypt`` reads
|
|
188
|
+
them, ``splunk-encrypt --v8`` writes them, and ``encrypt_v8`` writes them
|
|
189
|
+
from the library
|
|
190
|
+
- Added ``dbconnect-decrypt-fips`` for DB Connect passwords encrypted in FIPS
|
|
191
|
+
mode. Thanks to grokdesigns for this contribution.
|
|
192
|
+
- ``$7$`` and ``$8$`` decryption now checks the GCM tag, so a wrong
|
|
193
|
+
splunk.secret or a corrupted value fails with a clear error instead of
|
|
194
|
+
returning garbage
|
|
195
|
+
- ``splunk-encrypt``, ``splunk-decrypt``, ``splunk-legacy-decrypt`` and the
|
|
196
|
+
DB Connect decrypt commands report bad input and failed decryption as a
|
|
197
|
+
one-line error instead of a traceback
|
|
198
|
+
- **Behavior change for library callers:** ``splunksecrets.decrypt`` now
|
|
199
|
+
raises ``ValueError`` for an unknown prefix (it used to return ``None``),
|
|
200
|
+
and for a wrong splunk.secret or a corrupted ``$7$``/``$8$`` value (it used
|
|
201
|
+
to return garbage or raise ``UnicodeDecodeError``)
|
|
202
|
+
|
|
157
203
|
Version 1.1.0 (2025-06-05)
|
|
158
204
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
159
205
|
- Added support for encryption/decryption of DBConnect credentials using newer algorithm
|
|
@@ -165,7 +211,7 @@ Version 1.1.0 (2025-06-05)
|
|
|
165
211
|
Version 1.0.1
|
|
166
212
|
~~~~~~~~~~~~~~
|
|
167
213
|
- Short secrets are padded in the same way Splunk itself does it. Thanks to
|
|
168
|
-
Matt Anderson for this contribution.
|
|
214
|
+
Matt Anderson for this contribution.
|
|
169
215
|
|
|
170
216
|
Version 1.0.0 (2021-06-07)
|
|
171
217
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "splunksecrets"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.2.0"
|
|
4
4
|
description = "Command-line tools for working with secrets for Splunk products"
|
|
5
|
+
readme = "README.rst"
|
|
5
6
|
requires-python = ">=3.9"
|
|
6
7
|
dependencies = [
|
|
7
8
|
"click>=8.0.0",
|
|
@@ -30,5 +31,5 @@ packages = ["splunksecrets"]
|
|
|
30
31
|
dev = [
|
|
31
32
|
"pre-commit>=4.1.0",
|
|
32
33
|
"pytest>=8.3.4",
|
|
33
|
-
"ruff
|
|
34
|
+
"ruff==0.17.5",
|
|
34
35
|
]
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
from .dbconnect import decrypt_dbconnect, encrypt_dbconnect, get_key_and_iv
|
|
2
|
-
from .splunk import decrypt, encrypt, encrypt_new
|
|
3
2
|
from .phantom import decrypt_phantom, encrypt_phantom, to_bytes
|
|
3
|
+
from .splunk import decrypt, encrypt, encrypt_new, encrypt_v8
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
|
+
"decrypt",
|
|
6
7
|
"decrypt_dbconnect",
|
|
8
|
+
"decrypt_phantom",
|
|
9
|
+
"encrypt",
|
|
7
10
|
"encrypt_dbconnect",
|
|
8
|
-
"decrypt_splunk_legacy",
|
|
9
|
-
"decrypt_splunk",
|
|
10
|
-
"encrypt_splunk_legacy",
|
|
11
|
-
"encrypt_splunk",
|
|
12
11
|
"encrypt_new",
|
|
13
|
-
"decrypt",
|
|
14
|
-
"encrypt",
|
|
15
|
-
"get_key_and_iv",
|
|
16
|
-
"decrypt_phantom",
|
|
17
12
|
"encrypt_phantom",
|
|
13
|
+
"encrypt_v8",
|
|
14
|
+
"get_key_and_iv",
|
|
18
15
|
"to_bytes",
|
|
19
16
|
]
|