Skip to content

Commit

Permalink
Support /etc/ssh/sshd_config.d for AcceptEnv
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Feb 20, 2024
1 parent 56fb5fa commit 7e0d03f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions pkg/cidata/cidata.TEMPLATE.d/boot/11-colorterm-environment.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#!/bin/sh
set -eux

# openSUSE Tumbleweed uses /etc/ssh/sshd_config.d, not /etc/ssh/sshd_config
# TODO: support /etc/ssh/sshd_config.d
if [ ! -e /etc/ssh/sshd_config ]; then
exit 0
fi
if [ -d /etc/ssh/sshd_config.d ]; then
if [ -e /etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf ]; then
exit 0
fi

# accept any incoming COLORTERM environment variable
echo "AcceptEnv COLORTERM" >/etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf
elif [ -e /etc/ssh/sshd_config ]; then
if grep -q "COLORTERM" /etc/ssh/sshd_config; then
exit 0
fi

if grep -q "COLORTERM" /etc/ssh/sshd_config; then
# accept any incoming COLORTERM environment variable
sed -i 's/^AcceptEnv LANG LC_\*$/AcceptEnv COLORTERM LANG LC_*/' /etc/ssh/sshd_config
else
exit 0
fi

# accept any incoming COLORTERM environment variable
sed -i 's/^AcceptEnv LANG LC_\*$/AcceptEnv COLORTERM LANG LC_*/' /etc/ssh/sshd_config
if [ -f /sbin/openrc-run ]; then
rc-service --ifstarted sshd reload
elif command -v systemctl >/dev/null 2>&1; then
Expand Down

0 comments on commit 7e0d03f

Please sign in to comment.