Commit 4b768a6
Add automatic local subnet detection for systemd service
Problem:
- Hardcoded IPAddressAllow=192.168.1.0/24 prevented users on different
subnets (10.0.0.x, 192.168.0.x, 172.16.x.x) from connecting to Pi
- Service would install successfully but SSH connections would fail silently
Solution:
- Add %LOCAL_SUBNET% placeholder to service template
- Auto-detect local subnet in install_service.sh using multiple methods:
1. Parse default gateway from `ip route`
2. Fallback: Detect from primary interface IP
3. Final fallback: Use 192.168.1.0/24 with warning
- Display detected subnet during installation for transparency
- Provide manual override instructions if detection fails
This ensures the systemd network hardening works correctly across
different network configurations without manual editing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 78cec67 commit 4b768a6
2 files changed
+32
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
26 | 54 | | |
27 | 55 | | |
28 | 56 | | |
29 | 57 | | |
30 | 58 | | |
| 59 | + | |
31 | 60 | | |
32 | 61 | | |
33 | 62 | | |
34 | 63 | | |
35 | 64 | | |
36 | 65 | | |
37 | 66 | | |
| 67 | + | |
38 | 68 | | |
39 | 69 | | |
40 | 70 | | |
| |||
0 commit comments