This repository was archived by the owner on Mar 20, 2024. It is now read-only.
Commit 00e0efd
committed
Rework SSH key handling and configuration
I'm running homu in OpenShift v3/Kubernetes where it's installed (as root) to
`/usr`, but we run as non-root. This follows general best practice that apps
shouldn't be able to mutate their code.
However, we were trying to write the ssh key to `/usr`. Fix this by
generating a tempfile. This is also more secure as it closes a prior
race condition where we'd write the file with potentially non-private
access permissions, then chmod it.
Also rework things so that we only write the key once at startup. By
using `NamedTemporaryFile`, it'll be `unlink()ed` once the object goes
out of scope. To keep it alive long enough, pass it as an argument to
the "main loop".
Secondly, I want to have the github.com host key in a ConfigMap,
distinct from the code. And I want to tweak the
ssh configuration for https://stribika.github.io/2015/01/04/secure-secure-shell.html
among other things.
Hence, this also adds a `ssh_config_file` config option.1 parent b82e98b commit 00e0efd
3 files changed
+24
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 6 | | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | 456 | | |
463 | 457 | | |
464 | 458 | | |
| |||
488 | 482 | | |
489 | 483 | | |
490 | 484 | | |
491 | | - | |
492 | 485 | | |
493 | 486 | | |
494 | 487 | | |
| |||
959 | 952 | | |
960 | 953 | | |
961 | 954 | | |
962 | | - | |
| 955 | + | |
| 956 | + | |
963 | 957 | | |
964 | 958 | | |
965 | 959 | | |
| |||
1239 | 1233 | | |
1240 | 1234 | | |
1241 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1242 | 1239 | | |
1243 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
1244 | 1248 | | |
1245 | 1249 | | |
1246 | 1250 | | |
1247 | 1251 | | |
1248 | | - | |
| 1252 | + | |
1249 | 1253 | | |
1250 | 1254 | | |
1251 | 1255 | | |
| |||
0 commit comments