Skip to content

Commit

Permalink
fix: fix quoting and HOME env on rsync and sshd container commands (#255
Browse files Browse the repository at this point in the history
)

* fix: switch from using ~ to $HOME

Signed-off-by: Alex Romanenko <[email protected]

* fix: quote all paths

Signed-off-by: Utku Ozdemir <[email protected]>

---------

Signed-off-by: Alex Romanenko <[email protected]>
Signed-off-by: Utku Ozdemir <[email protected]>
Co-authored-by: Utku Ozdemir <[email protected]>
  • Loading branch information
alex-vmw and utkuozdemir authored Oct 9, 2023
1 parent 4f5b0e1 commit 1affa11
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions helm/pv-migrate/templates/rsync/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ spec:
period={{ .Values.rsync.retryPeriodSeconds }}
{{ if .Values.rsync.privateKeyMount -}}
privateKeyFilename=$(basename "{{ .Values.rsync.privateKeyMountPath }}")
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cp -v "{{ .Values.rsync.privateKeyMountPath }}" ~/.ssh/
chmod 400 "~/.ssh/$privateKeyFilename"
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
cp -v "{{ .Values.rsync.privateKeyMountPath }}" "$HOME/.ssh/"
chmod 400 "$HOME/.ssh/$privateKeyFilename"
{{- end }}
until [ "$n" -ge "$retries" ]
do
Expand Down
8 changes: 4 additions & 4 deletions helm/pv-migrate/templates/sshd/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ spec:
set -x
{{ if .Values.sshd.privateKeyMount -}}
privateKeyFilename=$(basename "{{ .Values.sshd.privateKeyMountPath }}")
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cp -v "{{ .Values.sshd.privateKeyMountPath }}" ~/.ssh/
chmod 400 "~/.ssh/$privateKeyFilename"
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
cp -v "{{ .Values.sshd.privateKeyMountPath }}" "$HOME/.ssh/"
chmod 400 "$HOME/.ssh/$privateKeyFilename"
{{- end }}
/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config
securityContext:
Expand Down
Binary file modified migrator/helm-chart.tgz
Binary file not shown.

0 comments on commit 1affa11

Please sign in to comment.