You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnfmt.Errorf("Permissions %s for SSH key are too open. It is recommended to mount secret volume with `defaultMode: 256` (decimal number for octal 0400).", fileInfo.Mode())
483
486
}
484
487
488
+
ifsetupKnownHosts {
489
+
_, err:=os.Stat(pathToSSHKnownHosts)
490
+
iferr!=nil {
491
+
returnfmt.Errorf("error: could not find SSH known_hosts file: %v", err)
Copy file name to clipboardExpand all lines: docs/ssh.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,21 @@ Git-sync supports using the SSH protocol for pulling git content.
6
6
Create a Secret to store your SSH private key, with the Secret keyed as "ssh". This can be done one of two ways:
7
7
8
8
***Method 1:***
9
+
Obtain the host keys for your git server:
10
+
11
+
```
12
+
ssh-keyscan $YOUR_GIT_HOST > /tmp/known_hosts
13
+
```
9
14
10
15
Use the ``kubectl create secret`` command and point to the file on your filesystem that stores the key. Ensure that the file is mapped to "ssh" as shown (the file can be located anywhere).
Write a config file for a Secret that holds your SSH private key, with the key (pasted as plaintext) mapped to the "ssh" field.
23
+
Write a config file for a Secret that holds your SSH private key, with the key (pasted in base64 encoded plaintext) mapped to the "ssh" field.
18
24
```
19
25
{
20
26
"kind": "Secret",
@@ -23,7 +29,8 @@ Write a config file for a Secret that holds your SSH private key, with the key (
23
29
"name": "git-creds"
24
30
},
25
31
"data": {
26
-
"ssh": <private-key>
32
+
"ssh": <base64 encoded private-key>
33
+
"known_hosts": <base64 encoded known_hosts>
27
34
}
28
35
```
29
36
@@ -32,6 +39,8 @@ Create the Secret using ``kubectl create -f``.
32
39
kubectl create -f /path/to/secret-config.json
33
40
```
34
41
42
+
Invoke the `git-sync` binary with the `-ssh-known-hosts` parameter to enforce `known_hosts` checking. This will be enabled by default in a future release.
43
+
35
44
## Step 2: Configure Pod/Deployment Volume
36
45
37
46
In your Pod or Deployment configuration, specify a Volume for mounting the Secret. Ensure that secretName matches the name you used when creating the Secret (e.g. "git-creds" used in both above examples).
0 commit comments