|
Bogdan Timofte
authored
2 weeks ago
|
1
|
# SSH Infrastructure
|
|
|
2
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
3
|
Source-controlled SSH routing and configuration for multi-user jump infrastructure
|
|
|
4
|
(`is-jumper` gateway → J1/J2 company network → final hosts).
|
|
Bogdan Timofte
authored
2 weeks ago
|
5
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
6
|
**⚠️ New to this project?** Start with [KEYS_AND_ACCESS.md](KEYS_AND_ACCESS.md) — it
|
|
|
7
|
explains which SSH key to use where, and how the access chain works.
|
|
Bogdan Timofte
authored
2 weeks ago
|
8
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
9
|
## Quick Start
|
|
Bogdan Timofte
authored
2 weeks ago
|
10
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
11
|
```bash
|
|
|
12
|
# 1. Access the local jump gateway
|
|
|
13
|
ssh is-jumper
|
|
|
14
|
|
|
|
15
|
# 2. From there, reach company network via J1 or J2
|
|
|
16
|
ssh j1 # or: ssh j2
|
|
|
17
|
|
|
|
18
|
# 3. From J1, reach final hosts
|
|
|
19
|
ssh porta-db # automatic routing: local → is-jumper → J1 → porta-db
|
|
|
20
|
```
|
|
|
21
|
|
|
|
22
|
The `~/.ssh/config` is auto-generated from `inventory/hosts.yaml` — edit the
|
|
|
23
|
inventory, not the config file.
|
|
|
24
|
|
|
|
25
|
## File Structure
|
|
Bogdan Timofte
authored
2 weeks ago
|
26
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
27
|
- **Project source**: `~/Documents/Workspaces/Bogdan/ssh-infrastructure`
|
|
|
28
|
- **OpenSSH runtime**: `~/.ssh` (do not commit)
|
|
Bogdan Timofte
authored
2 weeks ago
|
29
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
30
|
Keep secrets and machine-local state out of version control:
|
|
Bogdan Timofte
authored
2 weeks ago
|
31
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
32
|
- private keys: `~/.ssh/keys/` (not in git)
|
|
|
33
|
- `authorized_keys`, `known_hosts`, socket state (not in git)
|
|
|
34
|
|
|
|
35
|
Deploy the local runtime with:
|
|
Bogdan Timofte
authored
2 weeks ago
|
36
|
|
|
|
37
|
```bash
|
|
Bogdan Timofte
authored
2 weeks ago
|
38
|
# Regenerate ~/.ssh/config from inventory + install wrappers
|
|
Bogdan Timofte
authored
2 weeks ago
|
39
|
tools/deploy-local.sh
|
|
|
40
|
```
|
|
|
41
|
|
|
|
42
|
## Version control
|
|
|
43
|
|
|
|
44
|
This directory is the git repository for source files only. Generated configs,
|
|
|
45
|
local state, keys, known hosts, and handoff notes stay out of version control.
|
|
|
46
|
|
|
|
47
|
Track source changes with:
|
|
|
48
|
|
|
|
49
|
```bash
|
|
|
50
|
git status
|
|
|
51
|
git add inventory schema scripts tools .doc README.md .gitignore
|
|
|
52
|
git commit
|
|
|
53
|
```
|
|
|
54
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
55
|
## SSH Key Management
|
|
|
56
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
57
|
Which key goes where? See [KEYS_AND_ACCESS.md](KEYS_AND_ACCESS.md) for the full matrix.
|
|
|
58
|
|
|
|
59
|
Migrate hosts from legacy RSA to modern ED25519:
|
|
Bogdan Timofte
authored
2 weeks ago
|
60
|
|
|
|
61
|
```bash
|
|
Bogdan Timofte
authored
2 weeks ago
|
62
|
# Migrate all legacy hosts
|
|
Bogdan Timofte
authored
2 weeks ago
|
63
|
tools/migrate-modern-key.sh
|
|
|
64
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
65
|
# Migrate a specific host
|
|
Bogdan Timofte
authored
2 weeks ago
|
66
|
tools/migrate-modern-key.sh is-baobab
|
|
|
67
|
```
|
|
|
68
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
69
|
Details: [docs/KEY_MIGRATION.md](docs/KEY_MIGRATION.md)
|
|
Bogdan Timofte
authored
2 weeks ago
|
70
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
71
|
## Current client layout
|
|
|
72
|
|
|
|
73
|
```text
|
|
|
74
|
~/.ssh/config
|
|
|
75
|
~/.local/bin/ssh
|
|
|
76
|
~/.local/bin/scp
|
|
|
77
|
~/.local/bin/sftp
|
|
|
78
|
```
|
|
|
79
|
|
|
|
80
|
The wrapper sources stay versioned in `scripts/` inside the project; deploy
|
|
|
81
|
installs executable copies into `~/.local/bin` and removes the obsolete
|
|
|
82
|
`~/.ssh/scripts` runtime layout from older checkouts.
|
|
|
83
|
|
|
|
84
|
## Source of Truth
|
|
|
85
|
|
|
|
86
|
The structured source of truth starts in:
|
|
|
87
|
|
|
|
88
|
```text
|
|
|
89
|
inventory/hosts.yaml
|
|
|
90
|
schema/hosts.schema.json
|
|
|
91
|
tools/generate-configs.py
|
|
|
92
|
```
|
|
|
93
|
|
|
|
94
|
The `generated/*.conf` files are deploy artifacts. They are ignored by git and
|
|
|
95
|
can be recreated at any time with `tools/deploy-local.sh`.
|
|
|
96
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
97
|
## Inventory and Config Generation
|
|
Bogdan Timofte
authored
2 weeks ago
|
98
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
99
|
The single source of truth:
|
|
Bogdan Timofte
authored
2 weeks ago
|
100
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
101
|
```text
|
|
|
102
|
inventory/hosts.yaml ← edit here to add/modify hosts
|
|
|
103
|
↓ (python3 tools/generate-configs.py)
|
|
|
104
|
generated/client.conf ← deployed to ~/.ssh/config
|
|
|
105
|
generated/is-jumper.conf ← deployed to is-jumper
|
|
|
106
|
generated/j1.conf ← deployed to J1
|
|
|
107
|
generated/j2.conf ← deployed to J2
|
|
Bogdan Timofte
authored
2 weeks ago
|
108
|
```
|
|
|
109
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
110
|
### User and Port Defaults
|
|
Bogdan Timofte
authored
2 weeks ago
|
111
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
112
|
| Context | User | Port | Notes |
|
|
|
113
|
| --- | --- | --- | --- |
|
|
|
114
|
| Jump hosts (J1, J2) | `bogdan.timofte` | `24` (standard) or `25904` (VPN) | override in inventory |
|
|
|
115
|
| Final hosts | `bogdan` | `22` | most systems; dotted usernames cause issues |
|
|
|
116
|
| Interactive auth (Cisco, OLTs) | varies | `22` | marked with `auth: password_interactive` |
|
|
Bogdan Timofte
authored
2 weeks ago
|
117
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
118
|
### Deployment
|
|
Bogdan Timofte
authored
2 weeks ago
|
119
|
|
|
|
120
|
```bash
|
|
Bogdan Timofte
authored
2 weeks ago
|
121
|
# Option 1: Full deploy (recommended)
|
|
|
122
|
tools/deploy-local.sh
|
|
|
123
|
|
|
|
124
|
# Option 2: Manual steps
|
|
|
125
|
python3 tools/generate-configs.py # Regenerate configs
|
|
|
126
|
cp generated/client.conf ~/.ssh/config # Install client config
|
|
Bogdan Timofte
authored
2 weeks ago
|
127
|
```
|
|
|
128
|
|
|
Bogdan Timofte
authored
2 weeks ago
|
129
|
### Sync from Upstream
|
|
|
130
|
|
|
|
131
|
Pull latest `hosts.yaml` from nextgen and redeploy:
|
|
|
132
|
|
|
|
133
|
```bash
|
|
|
134
|
tools/sync-hosts-from-upstream.sh
|
|
|
135
|
|
|
|
136
|
# Customize:
|
|
|
137
|
DEPLOY_AFTER_SYNC=0 tools/sync-hosts-from-upstream.sh # generate only
|
|
|
138
|
UPSTREAM_SSH_TARGET=user@host tools/sync-hosts-from-upstream.sh # custom source
|
|
|
139
|
```
|