splunksecrets 1.0.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.
@@ -0,0 +1,52 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ persist-credentials: false
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.x"
18
+ - name: Install pypa/build
19
+ run: >-
20
+ python3 -m
21
+ pip install
22
+ build
23
+ --user
24
+ - name: Build a binary wheel and a source tarball
25
+ run: python3 -m build
26
+ - name: Store the distribution packages
27
+ uses: actions/upload-artifact@v4
28
+ with:
29
+ name: python-package-distributions
30
+ path: dist/
31
+
32
+ publish-to-pypi:
33
+ name: >-
34
+ Publish Python 🐍 distribution 📦 to PyPI
35
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36
+ needs:
37
+ - build
38
+ runs-on: ubuntu-latest
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/p/splunksecrets
42
+ permissions:
43
+ id-token: write
44
+
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+ - name: Publish distribution 📦 to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,46 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "**" # "*" skips branch names with a /
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ main-lint-test:
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 }}
19
+ strategy:
20
+ matrix:
21
+ python-version:
22
+ - "3.9"
23
+ - "3.10"
24
+ - "3.11"
25
+ - "3.12"
26
+ - "3.13"
27
+ - "3.14"
28
+
29
+ steps:
30
+ - name: 🛎️ Checkout
31
+ uses: actions/checkout@v4
32
+
33
+ - name: 📦 Install uv
34
+ uses: astral-sh/setup-uv@v5
35
+
36
+ - name: 🚀 Install just
37
+ uses: extractions/setup-just@v2
38
+
39
+ - name: 🦾 Install the project
40
+ run: just dev-sync
41
+
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
@@ -0,0 +1,72 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env/
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ .python-version
25
+
26
+ # PyInstaller
27
+ # Usually these files are written by a python script from a template
28
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov/
38
+ .tox/
39
+ .coverage
40
+ .coverage_data
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+
45
+ # Translations
46
+ *.mo
47
+ *.pot
48
+
49
+ # Django stuff:
50
+ *.log
51
+
52
+ # Sphinx documentation
53
+ docs/_build/
54
+
55
+ # PyBuilder
56
+ target/
57
+
58
+ #Vim
59
+ *.swp
60
+
61
+ # Divshot
62
+ .divshot-cache/
63
+ .venv
64
+ splunk.secret
65
+ .vscode/**
66
+ .pytest_cache/**
67
+ .venv-py27
68
+ secret.gh*
69
+ test_phantom_private_key.pem
70
+ test_phantom_secret_key.py
71
+ test_splunk.secret
72
+ test_identity.dat
@@ -0,0 +1,37 @@
1
+ # https://github.com/casey/just
2
+
3
+ dev-sync:
4
+ uv sync --all-extras --cache-dir .uv_cache
5
+
6
+ prod-sync:
7
+ uv sync --all-extras --no-dev --cache-dir .uv_cache
8
+
9
+ install-hooks:
10
+ uv run pre-commit install
11
+
12
+ format:
13
+ uv run ruff format
14
+
15
+ lint:
16
+ uv run ruff check --fix
17
+ test:
18
+ uv run pytest --verbose --color=yes tests
19
+
20
+ validate: format lint test
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
+
31
+ dockerize:
32
+ docker build -t python-repo-template .
33
+
34
+ # Use it like:
35
+ # just run 10
36
+ run number:
37
+ uv run main.py --number {{number}}
@@ -1,18 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.5
2
2
  Name: splunksecrets
3
- Version: 1.0.0
4
- Summary: splunksecrets - Encrypt / Decrypt Splunk encrypted passwords
5
- Author: Hurricane Labs
6
- Author-email: splunk-app@hurricanelabs.com
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Programming Language :: Python :: 2
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Development Status :: 5 - Production/Stable
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
11
12
 
12
13
  splunksecrets - Encrypt and Decrypt Splunk Passwords
13
14
  ====================================================
14
15
 
15
- |Build Status| |codecov.io|
16
+ |Build Status|
16
17
 
17
18
  ``splunksecrets`` is a tool for working with Splunk secrets offline. It
18
19
  currently supports encryption and decryption of passwords, but in the
@@ -24,18 +25,19 @@ infrastructure).
24
25
  Installation
25
26
  ------------
26
27
 
27
- ``splunksecrets`` can be installed using pip3:
28
+ You can install ``splunksecrets`` using ``uv``:
28
29
 
29
30
  ::
30
31
 
31
- pip3 install splunksecrets
32
+ uv tool install splunksecrets
32
33
 
33
- Or, if you're feeling adventurous, can be installed directly from
34
- github:
34
+
35
+ Or with pip:
35
36
 
36
37
  ::
37
38
 
38
- pip3 install git+https://github.com/HurricaneLabs/splunksecrets.git
39
+ python -m pip install splunksecrets
40
+
39
41
 
40
42
  Usage
41
43
  -----
@@ -51,25 +53,31 @@ operaton
51
53
  --help Show this message and exit.
52
54
 
53
55
  Commands:
54
- dbconnect-decrypt Decrypt password used for dbconnect identity
55
- dbconnect-encrypt Encrypt password used for dbconnect identity
56
- phantom-decrypt Decrypt password used for Phantom asset
57
- phantom-encrypt Encrypt password used for Phantom asset
58
- splunk-decrypt Decrypt password using Splunk 7.2 algorithm
59
- splunk-encrypt Encrypt password using Splunk 7.2 algorithm
60
- splunk-hash-passwd Generate password hash for use in...
61
- splunk-legacy-decrypt Decrypt password using legacy Splunk algorithm...
62
- splunk-legacy-encrypt Encrypt password using legacy Splunk algorithm...
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...
63
67
 
64
68
  You can find details of the usage of each subcommand by running the command
65
69
  followed by ``--help``.
66
70
 
67
71
  - **dbconnect-encrypt** and **dbconnect-decrypt** are for interacting with
68
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
69
75
  - **phantom-encrypt** and **phantom-decrypt** are for interacting with
70
76
  credentials stored in the Phantom database
71
77
  - **splunk-encrypt** and **splunk-decrypt** are for interacting with
72
- credentials from Splunk 7.2 or newer
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
73
81
  - **splunk-legacy-encrypt** and **splunk-legacy-decrypt** are for interacting
74
82
  with credentials from Splunk versions below 7.2
75
83
  - **splunk-hash-passwd** is for generating Splunk local user password hashes
@@ -109,7 +117,23 @@ for AES256-GCM, with a 16-byte randomly generated initialization vector.
109
117
  The encryption produces both the ciphertext as well as a "tag" that is
110
118
  used as part of integrity verification. The iv, ciphertext, and tag (in
111
119
  that order) are concatenated, base64-encoded, and prepended with ``$7$``
112
- to produce the encrypted password seen in the configuration files.
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.
113
137
 
114
138
  Phantom
115
139
  ~~~~~~~
@@ -127,10 +151,12 @@ the key for the AES encryption. A SHA1 hash is generated using the
127
151
  the initialization vector (``iv``) for the AES encryption. The password
128
152
  to be encrypted is padded using PKCS7 padding prior to encryption.
129
153
 
130
- DBConnect
131
- ~~~~~~~~~
154
+ DBConnect pre ~3.12
155
+ ~~~~~~~~~~~~~~~~~~~
132
156
 
133
- DBConnect encrypts passwords using the OpenSSL ``aes-256-cbc`` command.
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.
134
160
  This encryption is fairly straightforward, and is documented in
135
161
  ``dbxcrypto.py`` included with DBConnect. The key and IV are derived from
136
162
  the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
@@ -139,22 +165,67 @@ concatenated together with the salt (``Salted__`` + salt + ciphertext) and
139
165
  encoded using Base64. The password to be encrypted is padded using PKCS7
140
166
  padding prior to encryption.
141
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
+
142
184
  Known Issues
143
185
  ------------
144
186
 
145
- - If the splunk secret and an encrypted password don't match, one of
146
- two things will happen - either you'll get gibberish output, or a
147
- Python traceback. At some point, we'll hopefully have better error
148
- checking for this.
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.
149
191
  - DBConnect will occassionally store the ending newline from OpenSSL output in
150
192
  identities.conf, represented as a single ``\`` at the end of a line. This
151
193
  must be removed prior to passing encrypted passwords to ``splunksecrets``
152
194
 
153
195
  Version History
154
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
155
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.
156
227
 
157
- Version 1.0.0rc3 (2021-06-07)
228
+ Version 1.0.0 (2021-06-07)
158
229
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159
230
  - Updated CLI command docstrings for proper help output
160
231
  - Add initial support for encryption/decrypt of Splunk DBConnect credentials
@@ -170,8 +241,8 @@ Version 1.0.0rc1 (2021-05-19)
170
241
 
171
242
  Version 0.5.1 (2022-06-29)
172
243
  ~~~~~~~~~~~~~~~~~~~~~~~~~~
173
- - Allow passing the splunk secret itself as an environment variable
174
- ~ provided by chutzimir
244
+ - Allow passing the splunk secret itself as an environment variable
245
+ ~ provided by chutzimir
175
246
 
176
247
 
177
248
  Version 0.5.0 (2020-06-23)
@@ -241,7 +312,7 @@ License Info
241
312
 
242
313
  The MIT License (MIT)
243
314
 
244
- Copyright (c) 2020 Hurricane Labs LLC
315
+ Copyright (c) 2025 Hurricane Labs LLC
245
316
 
246
317
  Permission is hereby granted, free of charge, to any person obtaining a
247
318
  copy of this software and associated documentation files (the
@@ -264,5 +335,3 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
264
335
 
265
336
  .. |Build Status| image:: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml/badge.svg
266
337
  :target: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml
267
- .. |codecov.io| image:: https://codecov.io/gh/HurricaneLabs/splunksecrets/branch/master/graph/badge.svg
268
- :target: https://codecov.io/gh/HurricaneLabs/splunksecrets
@@ -1,18 +1,7 @@
1
- Metadata-Version: 2.1
2
- Name: splunksecrets
3
- Version: 1.0.0
4
- Summary: splunksecrets - Encrypt / Decrypt Splunk encrypted passwords
5
- Author: Hurricane Labs
6
- Author-email: splunk-app@hurricanelabs.com
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Programming Language :: Python :: 2
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Development Status :: 5 - Production/Stable
11
-
12
1
  splunksecrets - Encrypt and Decrypt Splunk Passwords
13
2
  ====================================================
14
3
 
15
- |Build Status| |codecov.io|
4
+ |Build Status|
16
5
 
17
6
  ``splunksecrets`` is a tool for working with Splunk secrets offline. It
18
7
  currently supports encryption and decryption of passwords, but in the
@@ -24,18 +13,19 @@ infrastructure).
24
13
  Installation
25
14
  ------------
26
15
 
27
- ``splunksecrets`` can be installed using pip3:
16
+ You can install ``splunksecrets`` using ``uv``:
28
17
 
29
18
  ::
30
19
 
31
- pip3 install splunksecrets
20
+ uv tool install splunksecrets
21
+
32
22
 
33
- Or, if you're feeling adventurous, can be installed directly from
34
- github:
23
+ Or with pip:
35
24
 
36
25
  ::
37
26
 
38
- pip3 install git+https://github.com/HurricaneLabs/splunksecrets.git
27
+ python -m pip install splunksecrets
28
+
39
29
 
40
30
  Usage
41
31
  -----
@@ -51,25 +41,31 @@ operaton
51
41
  --help Show this message and exit.
52
42
 
53
43
  Commands:
54
- dbconnect-decrypt Decrypt password used for dbconnect identity
55
- dbconnect-encrypt Encrypt password used for dbconnect identity
56
- phantom-decrypt Decrypt password used for Phantom asset
57
- phantom-encrypt Encrypt password used for Phantom asset
58
- splunk-decrypt Decrypt password using Splunk 7.2 algorithm
59
- splunk-encrypt Encrypt password using Splunk 7.2 algorithm
60
- splunk-hash-passwd Generate password hash for use in...
61
- splunk-legacy-decrypt Decrypt password using legacy Splunk algorithm...
62
- splunk-legacy-encrypt Encrypt password using legacy Splunk algorithm...
44
+ dbconnect-decrypt Decrypt password used for dbconnect identity
45
+ dbconnect-decrypt-fips Decrypt DB Connect password encrypted in FIPS mode
46
+ dbconnect-encrypt Encrypt password used for dbconnect identity
47
+ dbconnect-legacy-encrypt Encrypt password used for dbconnect identity using legacy algorithm
48
+ phantom-decrypt Decrypt password used for Phantom asset
49
+ phantom-encrypt Encrypt password used for Phantom asset
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
52
+ splunk-hash-passwd Generate password hash for use in...
53
+ splunk-legacy-decrypt Decrypt password using legacy Splunk algorithm...
54
+ splunk-legacy-encrypt Encrypt password using legacy Splunk algorithm...
63
55
 
64
56
  You can find details of the usage of each subcommand by running the command
65
57
  followed by ``--help``.
66
58
 
67
59
  - **dbconnect-encrypt** and **dbconnect-decrypt** are for interacting with
68
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
69
63
  - **phantom-encrypt** and **phantom-decrypt** are for interacting with
70
64
  credentials stored in the Phantom database
71
65
  - **splunk-encrypt** and **splunk-decrypt** are for interacting with
72
- 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
73
69
  - **splunk-legacy-encrypt** and **splunk-legacy-decrypt** are for interacting
74
70
  with credentials from Splunk versions below 7.2
75
71
  - **splunk-hash-passwd** is for generating Splunk local user password hashes
@@ -109,7 +105,23 @@ for AES256-GCM, with a 16-byte randomly generated initialization vector.
109
105
  The encryption produces both the ciphertext as well as a "tag" that is
110
106
  used as part of integrity verification. The iv, ciphertext, and tag (in
111
107
  that order) are concatenated, base64-encoded, and prepended with ``$7$``
112
- to produce the encrypted password seen in the configuration files.
108
+ to produce the encrypted password seen in the configuration files. If
109
+ the key is less than 254-bytes it is padded with null bytes.
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.
113
125
 
114
126
  Phantom
115
127
  ~~~~~~~
@@ -127,10 +139,12 @@ the key for the AES encryption. A SHA1 hash is generated using the
127
139
  the initialization vector (``iv``) for the AES encryption. The password
128
140
  to be encrypted is padded using PKCS7 padding prior to encryption.
129
141
 
130
- DBConnect
131
- ~~~~~~~~~
142
+ DBConnect pre ~3.12
143
+ ~~~~~~~~~~~~~~~~~~~
132
144
 
133
- DBConnect encrypts passwords using the OpenSSL ``aes-256-cbc`` command.
145
+ DBConnect used to encrypt passwords using the OpenSSL ``aes-256-cbc`` command.
146
+ This changed somewhere around 3.12 though I haven't bothered to find the exact
147
+ version where the change was made.
134
148
  This encryption is fairly straightforward, and is documented in
135
149
  ``dbxcrypto.py`` included with DBConnect. The key and IV are derived from
136
150
  the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
@@ -139,22 +153,67 @@ concatenated together with the salt (``Salted__`` + salt + ciphertext) and
139
153
  encoded using Base64. The password to be encrypted is padded using PKCS7
140
154
  padding prior to encryption.
141
155
 
156
+ DBConnect post ~3.12
157
+ ~~~~~~~~~~~~~~~~~~~~
158
+
159
+ DBConnect now encrypts passwords using AES GCM with no padding.
160
+ A random 16-byte salt is generated as well as a random 12-byte IV. The key is derived
161
+ from the salt and the secret (stored in ``$SPLUNK_HOMEetc/apps/splunk_app_db_connect/certs/identity.dat``)
162
+ using Scrypt. The final output is ``salt`` + ``iv`` + ``ciphertext``.
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
+
142
172
  Known Issues
143
173
  ------------
144
174
 
145
- - If the splunk secret and an encrypted password don't match, one of
146
- two things will happen - either you'll get gibberish output, or a
147
- Python traceback. At some point, we'll hopefully have better error
148
- checking for this.
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.
149
179
  - DBConnect will occassionally store the ending newline from OpenSSL output in
150
180
  identities.conf, represented as a single ``\`` at the end of a line. This
151
181
  must be removed prior to passing encrypted passwords to ``splunksecrets``
152
182
 
153
183
  Version History
154
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
+
203
+ Version 1.1.0 (2025-06-05)
204
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
205
+ - Added support for encryption/decryption of DBConnect credentials using newer algorithm
206
+ - Bumps minimum Python version to 3.9
207
+ - Refactored code into multiple files
208
+ - Switched from setup.py to pyproject.toml
209
+ - Removed ``six`` dependency used for Python 2 compatibility
155
210
 
211
+ Version 1.0.1
212
+ ~~~~~~~~~~~~~~
213
+ - Short secrets are padded in the same way Splunk itself does it. Thanks to
214
+ Matt Anderson for this contribution.
156
215
 
157
- Version 1.0.0rc3 (2021-06-07)
216
+ Version 1.0.0 (2021-06-07)
158
217
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159
218
  - Updated CLI command docstrings for proper help output
160
219
  - Add initial support for encryption/decrypt of Splunk DBConnect credentials
@@ -170,8 +229,8 @@ Version 1.0.0rc1 (2021-05-19)
170
229
 
171
230
  Version 0.5.1 (2022-06-29)
172
231
  ~~~~~~~~~~~~~~~~~~~~~~~~~~
173
- - Allow passing the splunk secret itself as an environment variable
174
- ~ provided by chutzimir
232
+ - Allow passing the splunk secret itself as an environment variable
233
+ ~ provided by chutzimir
175
234
 
176
235
 
177
236
  Version 0.5.0 (2020-06-23)
@@ -241,7 +300,7 @@ License Info
241
300
 
242
301
  The MIT License (MIT)
243
302
 
244
- Copyright (c) 2020 Hurricane Labs LLC
303
+ Copyright (c) 2025 Hurricane Labs LLC
245
304
 
246
305
  Permission is hereby granted, free of charge, to any person obtaining a
247
306
  copy of this software and associated documentation files (the
@@ -264,5 +323,3 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
264
323
 
265
324
  .. |Build Status| image:: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml/badge.svg
266
325
  :target: https://github.com/HurricaneLabs/splunksecrets/actions/workflows/tests.yml
267
- .. |codecov.io| image:: https://codecov.io/gh/HurricaneLabs/splunksecrets/branch/master/graph/badge.svg
268
- :target: https://codecov.io/gh/HurricaneLabs/splunksecrets