Fix SSH session crash: Disable PAM and enable stderr logging
This commit is contained in:
@@ -27,7 +27,7 @@ spec:
|
|||||||
- |
|
- |
|
||||||
# 1. Fix data volume permissions
|
# 1. Fix data volume permissions
|
||||||
chown -R 1000:0 /data && chmod -R 775 /data
|
chown -R 1000:0 /data && chmod -R 775 /data
|
||||||
|
|
||||||
# 2. Setup writable SSH tirectory from Secret
|
# 2. Setup writable SSH tirectory from Secret
|
||||||
cp /mnt/keys/authorized_keys /working-ssh/
|
cp /mnt/keys/authorized_keys /working-ssh/
|
||||||
chown 1000:0 /working-ssh/authorized_keys
|
chown 1000:0 /working-ssh/authorized_keys
|
||||||
@@ -37,12 +37,26 @@ spec:
|
|||||||
mountPath: /data
|
mountPath: /data
|
||||||
- name: ssh-keys-secret
|
- name: ssh-keys-secret
|
||||||
mountPath: /mnt/keys
|
mountPath: /mnt/keys
|
||||||
- name: ssh-working
|
- name: ssh-working
|
||||||
mountPath: /working-ssh
|
mountPath: /working-ssh
|
||||||
containers:
|
containers:
|
||||||
- name: clawdbox
|
- name: clawdbox
|
||||||
image: default-route-openshift-image-registry.apps.lab.apilab.us/clawdbox/clawdbox:latest
|
image: default-route-openshift-image-registry.apps.lab.apilab.us/clawdbox/clawdbox:latest
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- "-c"
|
||||||
|
- |
|
||||||
|
mkdir -p /data/ssh
|
||||||
|
if [ ! -f /data/ssh/ssh_host_rsa_key ]; then
|
||||||
|
echo 'Generating persistent host keys...'
|
||||||
|
ssh-keygen -f /data/ssh/ssh_host_rsa_key -N '' -t rsa
|
||||||
|
ssh-keygen -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
|
||||||
|
ssh-keygen -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519
|
||||||
|
fi
|
||||||
|
chmod 600 /data/ssh/ssh_host_*_key
|
||||||
|
# Run sshd with PAM disabled and logging to stderr
|
||||||
|
/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config -o UsePAM=no
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 2222
|
- containerPort: 2222
|
||||||
name: ssh
|
name: ssh
|
||||||
@@ -62,7 +76,7 @@ spec:
|
|||||||
runAsUser: 1000
|
runAsUser: 1000
|
||||||
runAsGroup: 1000
|
runAsGroup: 1000
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
allowPrivilegeEscalation: true
|
allowPrivilegeEscalation: false
|
||||||
capabilities:
|
capabilities:
|
||||||
drop: ["ALL"]
|
drop: ["ALL"]
|
||||||
volumes:
|
volumes:
|
||||||
@@ -74,4 +88,4 @@ spec:
|
|||||||
secretName: clawdbox-ssh-keys
|
secretName: clawdbox-ssh-keys
|
||||||
defaultMode: 0600
|
defaultMode: 0600
|
||||||
- name: ssh-working
|
- name: ssh-working
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
Reference in New Issue
Block a user