Skip to content

Commit d97cbe8

Browse files
Fix
1 parent e7941c7 commit d97cbe8

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/paramiko-sftp-test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ jobs:
9494
Subsystem sftp internal-sftp
9595
EOF
9696
97-
# Set proper permissions for keys
97+
# wolfSSHd refuses to load a host key unless it is owned by root or
98+
# the daemon's user and is not group or world writable. The daemon is
99+
# launched with sudo (euid 0) while the checkout key is owned by the
100+
# runner user, so make the key root-owned and 0600.
98101
chmod 600 ./keys/server-key.pem
102+
sudo chown 0:0 ./keys/server-key.pem
99103
100104
# Print debug info
101105
echo "Contents of sshd_config.txt:"

.github/workflows/sshd-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ jobs:
107107
sudo apt-get -y install valgrind
108108
touch sshd_config.txt
109109
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" --enable-static --disable-shared && make
110+
# wolfSSHd refuses a host key not owned by root or the daemon's user.
111+
# The daemon runs under sudo (euid 0), so make the key root-owned. Mode
112+
# stays 644 (not group/world writable) so other steps can still read it.
113+
sudo chown 0:0 ./keys/server-key.pem
110114
sudo timeout --preserve-status -s 2 5 valgrind --error-exitcode=1 --leak-check=full ./apps/wolfsshd/wolfsshd -D -f sshd_config -h ./keys/server-key.pem -d -p 22222
111115
112116
# regression test, check that cat command does not hang
@@ -119,6 +123,8 @@ jobs:
119123
cat ./keys/hansel-*.pub > authorized_keys_test
120124
sed -i.bak "s/hansel/$USER/" ./authorized_keys_test
121125
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" --enable-static --disable-shared && make
126+
# Host key must be root-owned for the sudo-launched daemon to load it.
127+
sudo chown 0:0 ./keys/server-key.pem
122128
sudo ./apps/wolfsshd/wolfsshd -f sshd_config.txt -h ./keys/server-key.pem -p 22225
123129
chmod 600 ./keys/hansel-key-rsa.pem
124130
tail -c 50000 /dev/urandom > test

.github/workflows/x509-interop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ jobs:
158158
- name: Start wolfSSHd
159159
working-directory: ./wolfssh/
160160
run: |
161+
# wolfSSHd refuses a trust anchor not owned by root or the daemon's
162+
# user. The daemon runs under sudo (euid 0), so make the host key,
163+
# host cert, and user CA root-owned. Modes stay non-group/world
164+
# writable so other steps can still read them.
165+
sudo chown 0:0 ./keys/server-key.pem ./keys/server-cert.pem \
166+
./keys/ca-cert-ecc.pem
161167
sudo ./apps/wolfsshd/wolfsshd -f sshd_config -d \
162168
-E $PWD/wolfsshd-log.txt &
163169
for i in $(seq 1 20); do

0 commit comments

Comments
 (0)