Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5e78337
Added DN comparison via cryptography library, with work-arounds
surfarno481 Feb 24, 2026
1ed049b
Documentation
surfarno481 Feb 24, 2026
efcb2b4
Merge branch 'BandwidthOnDemand:main' into main
surfarno481 Feb 26, 2026
ecf7a74
Fixed test with illegal country code, must be two chars
surfarno481 Feb 27, 2026
e6f2e47
Comment update
surfarno481 Feb 27, 2026
d46b953
From https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_12_3_1_R…
surfarno481 Mar 9, 2026
545c161
Generarated by doc/oid2py.py
surfarno481 Mar 9, 2026
a707670
Utilities for comparing X.509 DistinguishNames
surfarno481 Mar 9, 2026
7f3f502
pytest pass
surfarno481 Mar 9, 2026
49bb1d8
Object-based State, OID mapping additions
surfarno481 Mar 9, 2026
2e0cc8a
Exceptions following doc
surfarno481 Mar 9, 2026
2a7177b
Added HTTP DN Header order test
surfarno481 Mar 10, 2026
7569a65
cryptograph name internal order is big-to-small, so sort if allowed_d…
surfarno481 Mar 10, 2026
644d252
Refactor into fixtures that can have multiple allowed_dn.txt files la…
surfarno481 Mar 16, 2026
42f1cb2
Traefik full cert in HTTP header support, simple test werks
surfarno481 Mar 16, 2026
e7bc73c
Passes existing unit tests
surfarno481 Mar 17, 2026
615d3c6
Added test suite for certs, but fails for good cert, TODO
surfarno481 Mar 17, 2026
ff6f9ec
PEBCAK
surfarno481 Mar 17, 2026
dc2544f
Removed debugging
surfarno481 Mar 17, 2026
f4e9a84
AI dup-ed line
surfarno481 Mar 17, 2026
67d8062
Merge branch 'main' into main
hanstrompert Mar 19, 2026
23a1a5a
Manual improvements based on Claude review
surfarno481 Mar 20, 2026
480015c
Resolved test suite conflicts, C=ZZ (MUST be 2 letters)
surfarno481 Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ trusted CA chain (see [Ingress Configuration](#4-ingress-configuration)).

### 3. Configuration Options

| Variable | Description | Default |
| -------------------------------- | ------------------------ | ------------------------------- |
| `ALLOWED_CLIENT_SUBJECT_DN_PATH` | Path to the file listing allowed client certificate DNs. | `/config/allowed_client_dn.txt` |
| `SSL_CLIENT_SUBJECT_DN_HEADER` | HTTP header containing the client certificate DN. For **ingress-nginx**, this should not be changed. | `ssl-client-subject-dn` |
| `USE_WATCHDOG` | Enables file-change monitoring using [watchdog](https://pypi.org/project/watchdog/). Useful for non-Kubernetes environments. | `False` |
| `LOG_LEVEL` | Logging verbosity. Options: `DEBUG`, `INFO`, `WARNING`, `ERROR`. | `INFO` |
| Variable | Description | Default |
| -------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------- |
| `ALLOWED_CLIENT_SUBJECT_DN_PATH` | Path to the file listing allowed client certificate DNs. DNs should be as close to RFC4514 as possible, and stored as UTF-8 in the file. | `/config/allowed_client_dn.txt` |
| `SSL_CLIENT_SUBJECT_DN_HEADER` | HTTP header containing the client certificate DN. For **ingress-nginx**, this should not be changed. | `ssl-client-subject-dn` |
| `USE_WATCHDOG` | Enables file-change monitoring using [watchdog](https://pypi.org/project/watchdog/). Useful for non-Kubernetes environments. | `False` |
| `LOG_LEVEL` | Logging verbosity. Options: `DEBUG`, `INFO`, `WARNING`, `ERROR`. | `INFO` |

**File reload behavior:**

Expand Down
81 changes: 81 additions & 0 deletions doc/oid2py.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import re
import sys

name2oid = {}

skipflag = False

# Working in binary domain
f = open("oids.txt","rb")
for line in f:
# remove comments
for i in range(0,len(line)):
if line[i:i+1] == b'#':
break
commentless = line[:i]
# remove trailing space
for i in range(len(commentless)-1,-1,-1):
if commentless[i:i+1] != b' ':
break
commentless = commentless[0:i+1]
prefix_bytes = commentless[0:3]

if prefix_bytes == b'OID':
skipflag = False
oid = commentless[4:] # excluding \n
# cryptography does not grok OIDs from the top of the hierarchy, so with few dots.
oidstr = str(oid)
if oidstr.count(".") < 2:
skipflag = True

matchlist = re.findall('[0-9\\.]+',oidstr)
if len(matchlist) == 1:
oidbytes = oid[:len(matchlist[0])]
oidobj = b'ObjectIdentifier("'+oidbytes+b'")'
else:
raise Exception("OID not digits:" + oidstr + " " + str(matchlist))
elif not skipflag and prefix_bytes == b'TAG':
unofficial_but_common_name = commentless[4:] # excluding \n
# add quotes
quoted_name = b'"'+unofficial_but_common_name+b'"'
name2oid[quoted_name] = oidobj
elif not skipflag and prefix_bytes == b'ATT':
attr = commentless[5:] # excluding \n
name2oid[attr] = oidobj

f.close()

#
# Omissions in oids.txt
#
oidobj = name2oid[b'"givenName"']
name2oid[b'"gn"'] = oidobj

# Sigh...
name2oid[b'"organizationIdentifier"'] = b'ObjectIdentifier("2.5.4.97")'

# RFC4514 says: ST stateOrProvinceName (2.5.4.8)
# Mozilla uses "S"

oidobj = name2oid[b'"id-at-stateOrProvinceName"']
name2oid[b'"st"'] = oidobj


f = open("name2oid.py","wb")


f.write(b'# AUTOMATICALLY GENERATED BY OID2PY.PY, DO NOT EDIT\n')
f.write(b'# Source: https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_12_3_1_RTM/src/nss-3.12.3.1.tar.gz\n')
f.write(b'#\n')
f.write(b'from cryptography.x509.oid import ObjectIdentifier\n')
f.write(b'#\n')
f.write(b'names2oid = {}\n')

for n,v in name2oid.items():
f.write(b'names2oid[')
f.write(n)
f.write(b'] = ')
f.write(v)
f.write(b'\n')

f.close()
Loading