racfhound 0.1.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.
- racfhound-0.1.0/.gitignore +50 -0
- racfhound-0.1.0/LICENSE +21 -0
- racfhound-0.1.0/PKG-INFO +170 -0
- racfhound-0.1.0/README.md +141 -0
- racfhound-0.1.0/pyproject.toml +68 -0
- racfhound-0.1.0/racfhound/__init__.py +3 -0
- racfhound-0.1.0/racfhound/cli.py +249 -0
- racfhound-0.1.0/racfhound/collect/__init__.py +5 -0
- racfhound-0.1.0/racfhound/collect/collect.py +304 -0
- racfhound-0.1.0/racfhound/collect/connection.py +136 -0
- racfhound-0.1.0/racfhound/collect/jcl.py +63 -0
- racfhound-0.1.0/racfhound/collect/parsers.py +96 -0
- racfhound-0.1.0/racfhound/data/__init__.py +0 -0
- racfhound-0.1.0/racfhound/data/custom-types.json +60 -0
- racfhound-0.1.0/racfhound/data/queries/All Users with Privilege.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get CLAUTH FACILITY Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Certificate Associations.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Certificate Paths to SPECIAL.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Direct STGADMIN Access.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Direct Write Access to APF Libraries.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Direct Write Access to PARMLIB.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Direct Write Access to PROCLIB.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Group Members.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Group-Revoked Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Group-Scoped OPER Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Group-Scoped SPECIAL Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get High-Privilege Users Without MFA.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get ICSF Key Access.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Legacy Password Algorithms.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get MFA Coverage.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Orphaned ACL Entries.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Passticket Access.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Passticket Paths to SPECIAL.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Passticket-Enabled Applications.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to APF Write.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to BPX.SUPERUSER.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to CLAUTH SURROGAT.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to IRR.PASSWORD.RESET.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to OPERATIONS.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to PROCLIB Write.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to SPECIAL.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to STGADMIN.ADR.DUMP.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Paths to STGADMIN.ADR.RESTORE.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Profile Owners of APF Libraries.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Protected Non-Interactive Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Revoked Users with Latent Privilege.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Started Task Identities.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Surrogate Chains to SPECIAL.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Surrogates.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get TRUSTED and PRIVILEGED Started Tasks.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get TSO Users.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get Users with SPECIAL.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get WARNING Mode APF Libraries.json +1 -0
- racfhound-0.1.0/racfhound/data/queries/Get World-Writable Datasets.json +1 -0
- racfhound-0.1.0/racfhound/export.py +129 -0
- racfhound-0.1.0/racfhound/pipeline.py +61 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Distribution / packaging
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
*.egg
|
|
13
|
+
MANIFEST
|
|
14
|
+
|
|
15
|
+
# Installer logs
|
|
16
|
+
pip-log.txt
|
|
17
|
+
pip-delete-this-directory.txt
|
|
18
|
+
|
|
19
|
+
# Virtual environments
|
|
20
|
+
.venv/
|
|
21
|
+
venv/
|
|
22
|
+
env/
|
|
23
|
+
ENV/
|
|
24
|
+
|
|
25
|
+
# Testing
|
|
26
|
+
.pytest_cache/
|
|
27
|
+
.coverage
|
|
28
|
+
htmlcov/
|
|
29
|
+
.tox/
|
|
30
|
+
|
|
31
|
+
# IDE / editor
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
36
|
+
*~
|
|
37
|
+
|
|
38
|
+
# Claude Code
|
|
39
|
+
.claude/
|
|
40
|
+
|
|
41
|
+
# Collection output (local run artifacts — not part of the package)
|
|
42
|
+
collect_output/
|
|
43
|
+
racf_opengraph.json
|
|
44
|
+
racfdump.txt
|
|
45
|
+
apflist.txt
|
|
46
|
+
parmlist.txt
|
|
47
|
+
proclist.txt
|
|
48
|
+
|
|
49
|
+
# macOS
|
|
50
|
+
.DS_Store
|
racfhound-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jonathan Prince
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
racfhound-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: racfhound
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RACF security analysis for z/OS — collect, transform, and upload to BloodHound CE
|
|
5
|
+
Project-URL: Repository, https://github.com/JonathanPrince/racfhound
|
|
6
|
+
Project-URL: Documentation, https://github.com/JonathanPrince/racfhound/tree/main/docs
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/JonathanPrince/racfhound/issues
|
|
8
|
+
Author-email: Jonathan Prince <jonathan.prince@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: attack-path,bloodhound,graph,ibm,irrdbu00,mainframe,penetration-testing,racf,red-team,security,z/os,zos
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: System :: Systems Administration
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: click>=8.0
|
|
25
|
+
Requires-Dist: mfpandas-racfhound
|
|
26
|
+
Requires-Dist: paramiko>=3.0
|
|
27
|
+
Requires-Dist: requests>=2.28
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# RACFHound
|
|
31
|
+
|
|
32
|
+
Automated RACF security analysis for z/OS. Collects the RACF database via SSH, transforms it into a BloodHound-compatible graph, and uploads it to BloodHound CE for attack path analysis.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
z/OS (SSH + FTP) Linux BloodHound CE
|
|
36
|
+
┌──────────────┐ ┌─────────────────┐ ┌────────────────┐
|
|
37
|
+
│ RACF DB │─IRRDBU00→│ racfdump.txt │ │ Graph DB │
|
|
38
|
+
│ SYS1.RACFDS │ │ apflist.txt │─────→ │ RACF nodes │
|
|
39
|
+
│ APF/PARMLIB │ │ opengraph.json │ │ Attack paths │
|
|
40
|
+
└──────────────┘ └─────────────────┘ └────────────────┘
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick start — collect from z/OS
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install racfhound
|
|
47
|
+
|
|
48
|
+
# 1. Collect from z/OS
|
|
49
|
+
racfhound collect \
|
|
50
|
+
--host zos.example.com --user IBMUSER --key ~/.ssh/id_rsa
|
|
51
|
+
|
|
52
|
+
# 2. Transform to BloodHound graph
|
|
53
|
+
racfhound export --dump collect_output/racfdump.txt \
|
|
54
|
+
--apf collect_output/apflist.txt \
|
|
55
|
+
--parmlib collect_output/parmlist.txt \
|
|
56
|
+
--proclib collect_output/proclist.txt
|
|
57
|
+
|
|
58
|
+
# 3. Authenticate to BloodHound
|
|
59
|
+
export BH_URL=http://bloodhound:8080
|
|
60
|
+
export BH_TOKEN=$(racfhound login --user admin@example.com --password 's3cr3t')
|
|
61
|
+
|
|
62
|
+
# 4. Provision BloodHound (once per instance)
|
|
63
|
+
racfhound provision
|
|
64
|
+
racfhound queries
|
|
65
|
+
|
|
66
|
+
# 5. Upload graph
|
|
67
|
+
racfhound upload racf_opengraph.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick start — local IRRDBU00 unload
|
|
71
|
+
|
|
72
|
+
If you already have an IRRDBU00 unload (from manual FTP, a previous run, or a third-party extraction), skip straight to transform:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Transform an existing unload — no z/OS connection required
|
|
76
|
+
racfhound export --dump /path/to/racfdump.txt
|
|
77
|
+
|
|
78
|
+
# With optional context lists for APF/PARMLIB/PROCLIB marking
|
|
79
|
+
racfhound export --dump /path/to/racfdump.txt \
|
|
80
|
+
--apf apflist.txt --parmlib parmlist.txt --proclib proclist.txt
|
|
81
|
+
|
|
82
|
+
# Then authenticate and upload as normal
|
|
83
|
+
export BH_TOKEN=$(racfhound login --user admin@example.com --password 's3cr3t')
|
|
84
|
+
racfhound upload racf_opengraph.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Prerequisites
|
|
88
|
+
|
|
89
|
+
| Requirement | Notes |
|
|
90
|
+
|-------------|-------|
|
|
91
|
+
| Python ≥ 3.10 | |
|
|
92
|
+
| BloodHound CE | For graph analysis |
|
|
93
|
+
| z/OS OpenSSH | SSH + SFTP access — only needed for remote collection |
|
|
94
|
+
| z/OS FTP server | For retrieving the RACF dump — only needed for remote collection |
|
|
95
|
+
| IRRDBU00 authority | RACF READ on the database dataset — only needed for remote collection |
|
|
96
|
+
|
|
97
|
+
The collecting user needs:
|
|
98
|
+
- SSH login to z/OS UNIX System Services
|
|
99
|
+
- READ access to the RACF database dataset (`SYS1.RACFDS` or equivalent)
|
|
100
|
+
- TSO access (for `RVARY LIST` and job submission)
|
|
101
|
+
- FTP access to the z/OS system
|
|
102
|
+
|
|
103
|
+
## Architecture
|
|
104
|
+
|
|
105
|
+
RACFHound is built from two cooperating packages:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
mfpandas-racfhound (transforms IRRDBU00 output → BloodHound OpenGraph)
|
|
109
|
+
↑ imported by github.com/JonathanPrince/mfpandas-racfhound
|
|
110
|
+
racfhound (collect → transform → export pipeline + CLI)
|
|
111
|
+
collect/ SSH collection, JCL submission, FTP retrieval
|
|
112
|
+
data/ Bundled custom-types.json + 40 Cypher queries
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Both packages depend on [`mfpandas`](https://github.com/wizardofzos/mfpandas) (upstream IRRDBU00 parser by [@wizardofzos](https://github.com/wizardofzos)).
|
|
116
|
+
|
|
117
|
+
The transformation is done by [`mfpandas-racfhound`](https://github.com/JonathanPrince/mfpandas-racfhound) which maps RACF profiles, ACLs, group structure, and system attributes into BloodHound graph nodes and edges.
|
|
118
|
+
|
|
119
|
+
## Commands
|
|
120
|
+
|
|
121
|
+
| Command | Description |
|
|
122
|
+
|---------|-------------|
|
|
123
|
+
| `collect` | Collect from z/OS via SSH/FTP — RVARY LIST, IRRDBU00, PARMLIB |
|
|
124
|
+
| `export` | Transform a RACF unload file into BloodHound OpenGraph JSON |
|
|
125
|
+
| `login` | Authenticate to BloodHound CE and print a session token |
|
|
126
|
+
| `provision` | Register RACF node type icons and colours (once per instance) |
|
|
127
|
+
| `queries` | Load 40 bundled RACF Cypher queries (once per instance) |
|
|
128
|
+
| `upload` | Upload an OpenGraph JSON file to BloodHound CE |
|
|
129
|
+
|
|
130
|
+
## What gets collected
|
|
131
|
+
|
|
132
|
+
| Artifact | Source | Purpose |
|
|
133
|
+
|----------|--------|---------|
|
|
134
|
+
| `racfdump.txt` | IRRDBU00 unload | All RACF profiles (users, groups, datasets, resources) |
|
|
135
|
+
| `apflist.txt` | PARMLIB PROGxx | Marks APF-authorised libraries in the graph |
|
|
136
|
+
| `parmlist.txt` | PARMLIB member | Marks PARMLIB datasets in the graph |
|
|
137
|
+
| `proclist.txt` | PARMLIB member | Marks PROCLIB datasets in the graph |
|
|
138
|
+
|
|
139
|
+
## Environment variables
|
|
140
|
+
|
|
141
|
+
| Variable | Command | Description |
|
|
142
|
+
|----------|---------|-------------|
|
|
143
|
+
| `MF_HOST` | collect | z/OS SSH hostname |
|
|
144
|
+
| `MF_PORT` | collect | SSH port (default 22) |
|
|
145
|
+
| `MF_FTP_PORT` | collect | FTP port (default 21) |
|
|
146
|
+
| `MF_USER` | collect | TSO/USS username |
|
|
147
|
+
| `MF_KEY` | collect | SSH private key path |
|
|
148
|
+
| `MF_PASSWORD` | collect | SSH/FTP password |
|
|
149
|
+
| `MF_RACF_DSN` | collect | RACF database DSN (overrides RVARY LIST) |
|
|
150
|
+
| `MF_JOB_CLASS` | collect | JES job class |
|
|
151
|
+
| `MF_MSG_CLASS` | collect | JES message class |
|
|
152
|
+
| `BH_URL` | login / provision / queries / upload | BloodHound base URL |
|
|
153
|
+
| `BH_USER` | login | BloodHound username / email |
|
|
154
|
+
| `BH_PASSWORD` | login | BloodHound password |
|
|
155
|
+
| `BH_TOKEN` | provision / queries / upload | BloodHound JWT session token |
|
|
156
|
+
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
- [Getting started](docs/getting-started.md)
|
|
160
|
+
- [Collection](docs/collect.md)
|
|
161
|
+
- [BloodHound setup](docs/bloodhound.md)
|
|
162
|
+
- [Query reference](docs/queries.md)
|
|
163
|
+
|
|
164
|
+
## Graph model
|
|
165
|
+
|
|
166
|
+
**Nodes:** `RACFUser` · `RACFGroup` · `RACFDataset` · `RACFResource` · `RACFPrivilege` · `RACFStartedTask` · `RACFClass` · `RACFCertificate` · `RACFMFAFactor` · `RACFUndefined`
|
|
167
|
+
|
|
168
|
+
**Edges:** `RACFMemberOf` · `RACFHasSubgroup` · `RACFGroupAuth_{USE|CREATE|CONNECT|JOIN}` · `RACFOwns` · `RACFCanRead` · `RACFCanWrite` · `RACFCanExecute` · `RACFHasPrivilege` · `RACFSurrogateFor` · `RACFStartedTaskRunsAs` · `RACFCertificateFor` · `RACFPassticketFor` · `RACFCanAccessKey`
|
|
169
|
+
|
|
170
|
+
See the [query reference](docs/queries.md) and [BloodHound setup](docs/bloodhound.md) for more detail.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# RACFHound
|
|
2
|
+
|
|
3
|
+
Automated RACF security analysis for z/OS. Collects the RACF database via SSH, transforms it into a BloodHound-compatible graph, and uploads it to BloodHound CE for attack path analysis.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
z/OS (SSH + FTP) Linux BloodHound CE
|
|
7
|
+
┌──────────────┐ ┌─────────────────┐ ┌────────────────┐
|
|
8
|
+
│ RACF DB │─IRRDBU00→│ racfdump.txt │ │ Graph DB │
|
|
9
|
+
│ SYS1.RACFDS │ │ apflist.txt │─────→ │ RACF nodes │
|
|
10
|
+
│ APF/PARMLIB │ │ opengraph.json │ │ Attack paths │
|
|
11
|
+
└──────────────┘ └─────────────────┘ └────────────────┘
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick start — collect from z/OS
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install racfhound
|
|
18
|
+
|
|
19
|
+
# 1. Collect from z/OS
|
|
20
|
+
racfhound collect \
|
|
21
|
+
--host zos.example.com --user IBMUSER --key ~/.ssh/id_rsa
|
|
22
|
+
|
|
23
|
+
# 2. Transform to BloodHound graph
|
|
24
|
+
racfhound export --dump collect_output/racfdump.txt \
|
|
25
|
+
--apf collect_output/apflist.txt \
|
|
26
|
+
--parmlib collect_output/parmlist.txt \
|
|
27
|
+
--proclib collect_output/proclist.txt
|
|
28
|
+
|
|
29
|
+
# 3. Authenticate to BloodHound
|
|
30
|
+
export BH_URL=http://bloodhound:8080
|
|
31
|
+
export BH_TOKEN=$(racfhound login --user admin@example.com --password 's3cr3t')
|
|
32
|
+
|
|
33
|
+
# 4. Provision BloodHound (once per instance)
|
|
34
|
+
racfhound provision
|
|
35
|
+
racfhound queries
|
|
36
|
+
|
|
37
|
+
# 5. Upload graph
|
|
38
|
+
racfhound upload racf_opengraph.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick start — local IRRDBU00 unload
|
|
42
|
+
|
|
43
|
+
If you already have an IRRDBU00 unload (from manual FTP, a previous run, or a third-party extraction), skip straight to transform:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Transform an existing unload — no z/OS connection required
|
|
47
|
+
racfhound export --dump /path/to/racfdump.txt
|
|
48
|
+
|
|
49
|
+
# With optional context lists for APF/PARMLIB/PROCLIB marking
|
|
50
|
+
racfhound export --dump /path/to/racfdump.txt \
|
|
51
|
+
--apf apflist.txt --parmlib parmlist.txt --proclib proclist.txt
|
|
52
|
+
|
|
53
|
+
# Then authenticate and upload as normal
|
|
54
|
+
export BH_TOKEN=$(racfhound login --user admin@example.com --password 's3cr3t')
|
|
55
|
+
racfhound upload racf_opengraph.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Prerequisites
|
|
59
|
+
|
|
60
|
+
| Requirement | Notes |
|
|
61
|
+
|-------------|-------|
|
|
62
|
+
| Python ≥ 3.10 | |
|
|
63
|
+
| BloodHound CE | For graph analysis |
|
|
64
|
+
| z/OS OpenSSH | SSH + SFTP access — only needed for remote collection |
|
|
65
|
+
| z/OS FTP server | For retrieving the RACF dump — only needed for remote collection |
|
|
66
|
+
| IRRDBU00 authority | RACF READ on the database dataset — only needed for remote collection |
|
|
67
|
+
|
|
68
|
+
The collecting user needs:
|
|
69
|
+
- SSH login to z/OS UNIX System Services
|
|
70
|
+
- READ access to the RACF database dataset (`SYS1.RACFDS` or equivalent)
|
|
71
|
+
- TSO access (for `RVARY LIST` and job submission)
|
|
72
|
+
- FTP access to the z/OS system
|
|
73
|
+
|
|
74
|
+
## Architecture
|
|
75
|
+
|
|
76
|
+
RACFHound is built from two cooperating packages:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
mfpandas-racfhound (transforms IRRDBU00 output → BloodHound OpenGraph)
|
|
80
|
+
↑ imported by github.com/JonathanPrince/mfpandas-racfhound
|
|
81
|
+
racfhound (collect → transform → export pipeline + CLI)
|
|
82
|
+
collect/ SSH collection, JCL submission, FTP retrieval
|
|
83
|
+
data/ Bundled custom-types.json + 40 Cypher queries
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Both packages depend on [`mfpandas`](https://github.com/wizardofzos/mfpandas) (upstream IRRDBU00 parser by [@wizardofzos](https://github.com/wizardofzos)).
|
|
87
|
+
|
|
88
|
+
The transformation is done by [`mfpandas-racfhound`](https://github.com/JonathanPrince/mfpandas-racfhound) which maps RACF profiles, ACLs, group structure, and system attributes into BloodHound graph nodes and edges.
|
|
89
|
+
|
|
90
|
+
## Commands
|
|
91
|
+
|
|
92
|
+
| Command | Description |
|
|
93
|
+
|---------|-------------|
|
|
94
|
+
| `collect` | Collect from z/OS via SSH/FTP — RVARY LIST, IRRDBU00, PARMLIB |
|
|
95
|
+
| `export` | Transform a RACF unload file into BloodHound OpenGraph JSON |
|
|
96
|
+
| `login` | Authenticate to BloodHound CE and print a session token |
|
|
97
|
+
| `provision` | Register RACF node type icons and colours (once per instance) |
|
|
98
|
+
| `queries` | Load 40 bundled RACF Cypher queries (once per instance) |
|
|
99
|
+
| `upload` | Upload an OpenGraph JSON file to BloodHound CE |
|
|
100
|
+
|
|
101
|
+
## What gets collected
|
|
102
|
+
|
|
103
|
+
| Artifact | Source | Purpose |
|
|
104
|
+
|----------|--------|---------|
|
|
105
|
+
| `racfdump.txt` | IRRDBU00 unload | All RACF profiles (users, groups, datasets, resources) |
|
|
106
|
+
| `apflist.txt` | PARMLIB PROGxx | Marks APF-authorised libraries in the graph |
|
|
107
|
+
| `parmlist.txt` | PARMLIB member | Marks PARMLIB datasets in the graph |
|
|
108
|
+
| `proclist.txt` | PARMLIB member | Marks PROCLIB datasets in the graph |
|
|
109
|
+
|
|
110
|
+
## Environment variables
|
|
111
|
+
|
|
112
|
+
| Variable | Command | Description |
|
|
113
|
+
|----------|---------|-------------|
|
|
114
|
+
| `MF_HOST` | collect | z/OS SSH hostname |
|
|
115
|
+
| `MF_PORT` | collect | SSH port (default 22) |
|
|
116
|
+
| `MF_FTP_PORT` | collect | FTP port (default 21) |
|
|
117
|
+
| `MF_USER` | collect | TSO/USS username |
|
|
118
|
+
| `MF_KEY` | collect | SSH private key path |
|
|
119
|
+
| `MF_PASSWORD` | collect | SSH/FTP password |
|
|
120
|
+
| `MF_RACF_DSN` | collect | RACF database DSN (overrides RVARY LIST) |
|
|
121
|
+
| `MF_JOB_CLASS` | collect | JES job class |
|
|
122
|
+
| `MF_MSG_CLASS` | collect | JES message class |
|
|
123
|
+
| `BH_URL` | login / provision / queries / upload | BloodHound base URL |
|
|
124
|
+
| `BH_USER` | login | BloodHound username / email |
|
|
125
|
+
| `BH_PASSWORD` | login | BloodHound password |
|
|
126
|
+
| `BH_TOKEN` | provision / queries / upload | BloodHound JWT session token |
|
|
127
|
+
|
|
128
|
+
## Documentation
|
|
129
|
+
|
|
130
|
+
- [Getting started](docs/getting-started.md)
|
|
131
|
+
- [Collection](docs/collect.md)
|
|
132
|
+
- [BloodHound setup](docs/bloodhound.md)
|
|
133
|
+
- [Query reference](docs/queries.md)
|
|
134
|
+
|
|
135
|
+
## Graph model
|
|
136
|
+
|
|
137
|
+
**Nodes:** `RACFUser` · `RACFGroup` · `RACFDataset` · `RACFResource` · `RACFPrivilege` · `RACFStartedTask` · `RACFClass` · `RACFCertificate` · `RACFMFAFactor` · `RACFUndefined`
|
|
138
|
+
|
|
139
|
+
**Edges:** `RACFMemberOf` · `RACFHasSubgroup` · `RACFGroupAuth_{USE|CREATE|CONNECT|JOIN}` · `RACFOwns` · `RACFCanRead` · `RACFCanWrite` · `RACFCanExecute` · `RACFHasPrivilege` · `RACFSurrogateFor` · `RACFStartedTaskRunsAs` · `RACFCertificateFor` · `RACFPassticketFor` · `RACFCanAccessKey`
|
|
140
|
+
|
|
141
|
+
See the [query reference](docs/queries.md) and [BloodHound setup](docs/bloodhound.md) for more detail.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "racfhound"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "RACF security analysis for z/OS — collect, transform, and upload to BloodHound CE"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Jonathan Prince", email = "jonathan.prince@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"racf", "mainframe", "zos", "z/os", "ibm",
|
|
17
|
+
"bloodhound", "security", "attack-path", "graph",
|
|
18
|
+
"irrdbu00", "penetration-testing", "red-team",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 3 - Alpha",
|
|
22
|
+
"Environment :: Console",
|
|
23
|
+
"Intended Audience :: Information Technology",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Topic :: Security",
|
|
31
|
+
"Topic :: System :: Systems Administration",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"click>=8.0",
|
|
35
|
+
"requests>=2.28",
|
|
36
|
+
"paramiko>=3.0",
|
|
37
|
+
"mfpandas-racfhound",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Repository = "https://github.com/JonathanPrince/racfhound"
|
|
42
|
+
Documentation = "https://github.com/JonathanPrince/racfhound/tree/main/docs"
|
|
43
|
+
"Bug Tracker" = "https://github.com/JonathanPrince/racfhound/issues"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
racfhound = "racfhound.cli:cli"
|
|
47
|
+
|
|
48
|
+
# ---------------------------------------------------------------------------
|
|
49
|
+
# Build
|
|
50
|
+
# ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["racfhound"]
|
|
54
|
+
|
|
55
|
+
[tool.hatch.build.targets.sdist]
|
|
56
|
+
include = [
|
|
57
|
+
"racfhound/",
|
|
58
|
+
"README.md",
|
|
59
|
+
"LICENSE",
|
|
60
|
+
"pyproject.toml",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
# ---------------------------------------------------------------------------
|
|
64
|
+
# Tests
|
|
65
|
+
# ---------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
testpaths = ["tests"]
|