Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
devname
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
devname
Commits
1c3ff048
Commit
1c3ff048
authored
Nov 12, 2026
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
devname: degrade to http when mkcert is missing instead of crashing
parent
a46c84a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
devname
bin/devname
+17
-6
No files found.
bin/devname
View file @
1c3ff048
...
...
@@ -74,7 +74,7 @@ PLIST = os.path.join(HOME, "Library", "LaunchAgents", LABEL + ".plist")
LOGDIR = os.path.join(HOME, "Library", "Logs", "devname")
POOL = range(17000, 18000)
CADDY = shutil.which("caddy") or "/opt/homebrew/bin/caddy"
MKCERT = shutil.which("mkcert") or
"/opt/homebrew/bin/mkcert"
MKCERT = shutil.which("mkcert") or
("/opt/homebrew/bin/mkcert" if os.path.exists("/opt/homebrew/bin/mkcert") else None)
# no JDK keystore here: mkcert's optional Java step exits 1 and would block issuing the cert (found 2026-11-03)
MKCERT_ENV = dict(os.environ, TRUST_STORES="system,nss")
SUFFIX = ".localhost"
...
...
@@ -500,6 +500,16 @@ def lan_gate_open():
return False
def mkcert_caroot():
"""mkcert's CA directory, or "" when mkcert is missing or fails: no CA means http only, never a crash."""
if not MKCERT:
return ""
try:
return subprocess.run([MKCERT, "-CAROOT"], capture_output=True, text=True, timeout=10).stdout.strip()
except (OSError, subprocess.TimeoutExpired):
return ""
def ensure_cert(reg):
"""One SAN cert over every registered name, loopback and LAN faces both (wildcards cannot span two
labels). Issued whether or not the LAN gate is open: the cert must be ready when the gate opens.
...
...
@@ -507,8 +517,8 @@ def ensure_cert(reg):
names = sorted(set(reg["entries"])
| {h[:-len(SUFFIX)] + LAN_SUFFIX for h in reg["entries"]}
| {INDEX_HOST, GATEWAY_HOST, "localhost", "127.0.0.1", "::1"})
root =
subprocess.run([MKCERT, "-CAROOT"], capture_output=True, text=True).stdout.strip
()
if not os.path.exists(os.path.join(root, "rootCA.pem")):
root =
mkcert_caroot
()
if not
root or not
os.path.exists(os.path.join(root, "rootCA.pem")):
return False
want = "\n".join(names)
have = open(SANS).read() if os.path.exists(SANS) else None
...
...
@@ -947,7 +957,7 @@ class IndexHandler(http.server.BaseHTTPRequestHandler):
data = ctype = None
code = 200
if path in ("/rootCA.pem", "/CA"): # served over plain http on the LAN face: a phone that trusts no CA yet
root =
subprocess.run([MKCERT, "-CAROOT"], capture_output=True, text=True).stdout.strip
()
root =
mkcert_caroot
()
try:
with open(os.path.join(root, "rootCA.pem"), "rb") as fh:
data = fh.read()
...
...
@@ -1031,8 +1041,9 @@ def cmd_doctor(a):
except OSError:
pass
line(code == 200, f"index page on {INDEX_HOST} (got {code})")
root = subprocess.run([MKCERT, "-CAROOT"], capture_output=True, text=True).stdout.strip()
line(os.path.exists(os.path.join(root, "rootCA.pem")), "mkcert root CA exists (https; trust it with `mkcert -install`)")
root = mkcert_caroot()
line(bool(root) and os.path.exists(os.path.join(root, "rootCA.pem")),
"mkcert root CA exists (https; trust it with `mkcert -install`)")
line(have_https(), "https cert issued for the registered names")
try:
with open(LAN_GATE) as fh:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment