Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augtool breaks when mapping a local /etc/ssh/sshd_config as a volume #73

Open
wharris1 opened this issue Jul 23, 2021 · 1 comment
Open

Comments

@wharris1
Copy link

wharris1 commented Jul 23, 2021

I've been able to run the image just fine --- doing various things. What I can't seem to do it is to replace its /etc/ssh/sshd_config with my own. Notice this is supported. The homepage says

Configure the container with the following environment variables or optionally mount a custom sshd config at /etc/ssh/sshd_config:

I'd like to replace it because I want to set directives such as ListenAddress. Whenever I try to replace it, I get the following error:

#docker run -v $(pwd)/sshd_config:/etc/ssh/sshd_config docker.io/panubo/sshd:latest
> Starting SSHD
>> Generating new host keys
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
error: Failed to execute command
saving failed (run 'errors' for details)
#

Output of DEBUG=true.

#docker run -v $(pwd)/sshd_config:/etc/ssh/sshd_config -e DEBUG=true docker.io/panubo/sshd:latest
> Starting SSHD
+ DAEMON=sshd
+ echo '> Starting SSHD'
++ ls -A /etc/ssh
>> Generating new host keys
+ '[' '!' 'moduli
ssh_config
sshd_config' ']'
+ ls '/etc/ssh/keys/ssh_host_*'
+ ls '/etc/ssh/ssh_host_*'
+ echo '>> Generating new host keys'
+ mkdir -p /etc/ssh/keys
+ ssh-keygen -A
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
+ mv /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/keys/
+ set_hostkeys
+ printf '%s\n' 'set /files/etc/ssh/sshd_config/HostKey[1] /etc/ssh/keys/ssh_host_rsa_key' 'set /files/etc/ssh/sshd_config/HostKey[2] /etc/ssh/keys/ssh_host_dsa_key' 'set /files/etc/ssh/sshd_config/HostKey[3] /etc/ssh/keys/ssh_host_ecdsa_key' 'set /files/etc/ssh/sshd_config/HostKey[4] /etc/ssh/keys/ssh_host_ed25519_key'
+ augtool -s
error: Failed to execute command
saving failed (run 'errors' for details)
#
@wharris1 wharris1 changed the title When mapping /etc/ssh/sshd_config as a volume, augtool breaks Augtool breaks when mapping a local /etc/ssh/sshd_config as a volume Jul 23, 2021
@nopoz
Copy link

nopoz commented Mar 6, 2024

Execute a script when the container starts and modify the /etc/ssh/sshd_config file that way.

See the Custom Scripts section of the README for details.

Example script of enabling logging in /etc/ssh/sshd_config:

#!/usr/bin/env bash

# custom configuration /etc/ssh/sshd_config
ssh_config="/etc/ssh/sshd_config"
echo "customizing /etc/ssh/sshd_config..."
sed -i 's/^#SyslogFacility AUTH/SyslogFacility AUTH/' $ssh_config
sed -i 's/^#LogLevel INFO/LogLevel INFO/' $ssh_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants