Skip to content

Commit 46fd763

Browse files
committed
mount ssh-key to separate directory, cp, and fix permissions
1 parent 6a4a2ff commit 46fd763

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

templates/configmaps_post-start-script.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ data:
1818
# see: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
1919
post-start.sh: |
2020
#!/bin/bash
21+
mkdir -p /home/stanley/.ssh
22+
cp -L /home/stanley/.ssh{-key-vol,}/stanley_rsa
2123
chown -R stanley:stanley /home/stanley/.ssh/
24+
chmod 400 /home/stanley/.ssh/stanley_rsa
25+
chmod 500 /home/stanley/.ssh

templates/deployments.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,7 @@ spec:
10201020
volumeMounts:
10211021
{{- include "st2-config-volume-mounts" . | nindent 8 }}
10221022
- name: st2-ssh-key-vol
1023-
mountPath: /home/stanley/.ssh/
1024-
#readOnly: true
1023+
mountPath: /home/stanley/.ssh-key-vol/
10251024
{{- if .Values.st2.datastore_crypto_key }}
10261025
- name: st2-encryption-key-vol
10271026
mountPath: /etc/st2/keys
@@ -1064,9 +1063,7 @@ spec:
10641063
- key: private_key
10651064
path: stanley_rsa
10661065
# 0400 file permission
1067-
#mode: 256
1068-
# 0600 file permission
1069-
mode: 384
1066+
mode: 256
10701067
{{- if .Values.st2.packs.images }}
10711068
{{- include "packs-volumes" . | indent 8 }}
10721069
{{- end }}
@@ -1271,8 +1268,7 @@ spec:
12711268
- name: st2client-config-vol
12721269
mountPath: /root/.st2/
12731270
- name: st2-ssh-key-vol
1274-
mountPath: /home/stanley/.ssh/
1275-
#readOnly: true
1271+
mountPath: /home/stanley/.ssh-key-vol/
12761272
{{- if .Values.st2.datastore_crypto_key }}
12771273
- name: st2-encryption-key-vol
12781274
mountPath: /etc/st2/keys
@@ -1335,9 +1331,7 @@ spec:
13351331
- key: private_key
13361332
path: stanley_rsa
13371333
# 0400 file permission
1338-
#mode: 256
1339-
# 0600 file permission
1340-
mode: 384
1334+
mode: 256
13411335
{{- if .Values.st2.packs.images }}
13421336
{{- include "packs-volumes" . | indent 8 }}
13431337
{{- end }}

0 commit comments

Comments
 (0)