Good morning
I've looked through the sourcecode and found that these are the sshd_config options that are accepted.
##
## wolfsshd configuration file
##
Port 1234
PermitRootLogin yes
PasswordAuthentication yes
LoginGraceTime 30
HostKey /opt/wolfssh/etc/host_key_ed25519.pem
HostKey /opt/wolfssh/etc/host_key_ecdsa.pem
HostKey /opt/wolfssh/etc/host_key_rsa.pem
##
## All available config options
##
# AuthorizedKeysFile
# ChrootDirectory
# ForceCommand
# HostCertificate
# HostKey
# Include
# LoginGraceTime
# Match
# PasswordAuthentication
# PermitEmptyPasswords
# PermitRootLogin
# PidFile
# Port
# Protocol
# TrustedUserCAKeys
# UsePrivilegeSeparation
##
## These are also accepted but their functions are implemented.
##
# AcceptEnv
# ChallengeResponseAuthentication
# PrintMotd
# Subsystem
# UseDNS
# UsePAM
# X11Forwarding
Notably, the listenAddress option is not accepted and renders an error message. I believe it is because it is missing a OPT_LISTEN_ADDRESS equivalent in configuration.c https://github.com/wolfSSL/wolfssh/blob … ion.c#L937
I have not yet figured out how the Match option works. The option is accepted and parsed in HandleMatch, and it looks like the option User and Group can be used, however I am not sure how to use it and what options can be overridden.
Example:
Port 1234
PermitRootLogin yes
PasswordAuthentication no
LoginGraceTime 30
Match User forza
PasswordAuthentication yes
LoginGraceTime 5
In this case, the PasswordAuthentication and LoginGraceTime 5 is not applied for user forza.
The logfile shows
[PID 46798]: [SSHD] parsing config file /opt/wolfssh/etc/sshd_config
[PID 46798]: [SSHD] password authentication disabled
[PID 46798]: [SSHD] Setting login grace time to 30
[PID 46798]: [SSHD] Setting login grace time to 5
[PID 46798]: [SSHD] Starting wolfSSH SSHD application
[PID 46798]: [SSHD] Setting default Unix user name check
[PID 46798]: [SSHD] Setting Unix password check
[PID 46798]: [SSHD] Setting Unix public key check
[PID 46798]: [SSHD] parsing config file /opt/wolfssh/etc/sshd_config
[PID 46798]: [SSHD] password authentication disabled
[PID 46798]: [SSHD] Setting login grace time to 30
[PID 46798]: [SSHD] Setting login grace time to 5
[PID 46798]: [SSHD] Starting wolfSSH SSHD application
[PID 46798]: [SSHD] Setting default Unix user name check
[PID 46798]: [SSHD] Setting Unix password check
[PID 46798]: [SSHD] Setting Unix public key check
[PID 46798]: [SSHD] parsing config file /opt/wolfssh/etc/sshd_config
[PID 46798]: [SSHD] password authentication disabled
[PID 46798]: [SSHD] Setting login grace time to 30
[PID 46798]: [SSHD] Setting login grace time to 5
[PID 46798]: [SSHD] Starting wolfSSH SSHD application
[PID 46798]: [SSHD] Setting default Unix user name check
[PID 46798]: [SSHD] Setting Unix password check
[PID 46798]: [SSHD] Setting Unix public key check
[PID 46800]: [SSHD] Starting to listen on port 1234
[PID 46800]: [SSHD] Listening on port 1234
[PID 46800]: [SSHD] Lowering permissions level
[PID 46800]: [SSHD] Incoming TCP data found
[PID 46826]: [SSHD] grace time = 30 timeout = 0
[PID 46826]: [SSHD] Failed to accept WOLFSSH connection from 192.168.0.122 error -1001
[PID 46826]: [SSHD] Return from closing connection = -1001
During my testing I came across this problem when using pipes with the wolfSSHd. It does not realise the pipe ended and sits and waits forever until I send ctrl-c.
echo "Hello World" | ssh -p 1234 192.168.0.1 'cat > /tmp/hello.txt'
wolfSSHD
forza@192.168.0.1's password:
... just sits and waits after password is entered
An strace shows: read(0</dev/pts/14<char 136:14>>, <unfinished ...>
76806<cat> 11:57:05.412434 fstat(1</tmp/hello.txt>, {st_dev=makedev(0, 0x23), st_ino=348474, st_mode=S_IFREG|0666, st_nlink=1, st_uid=1006, st_gid=1008, st_blksize=2097152, st_blocks=0, st_size=0, st_atime=1720345964 /* 2024-07-07T11:52:44.357263087+0200 */, st_atime_nsec=357263087, st_mtime=1720346225 /* 2024-07-07T11:57:05.401054702+0200 */, st_mtime_nsec=401054702, st_ctime=1720346225 /* 2024-07-07T11:57:05.401054702+0200 */, st_ctime_nsec=401054702}) = 0
76806<cat> 11:57:05.412456 fstat(0</dev/pts/14<char 136:14>>, {st_dev=makedev(0, 0x17), st_ino=17, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=0, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(0x88, 0xe), st_atime=1720346225 /* 2024-07-07T11:57:05.361054122+0200 */,st_atime_nsec=361054122, st_mtime=1720346225 /* 2024-07-07T11:57:05.361054122+0200 */, st_mtime_nsec=361054122, st_ctime=1720346225 /* 2024-07-07T11:57:05.361054122+0200 */, st_ctime_nsec=361054122}) = 0
76806<cat> 11:57:05.412479 fadvise64(0</dev/pts/14<char 136:14>>, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
76806<cat> 11:57:05.412498 mmap(NULL, 2105344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3b8200000
76806<cat> 11:57:05.412517 read(0</dev/pts/14<char 136:14>>, "Hello World\n", 2097152) = 12
76806<cat> 11:57:05.412538 write(1</tmp/hello.txt>, "Hello World\n", 12) = 12
76806<cat> 11:57:05.412605 read(0</dev/pts/14<char 136:14>>, <unfinished ...>
58066<wolfsshd> 11:57:06.041197 <... pselect6 resumed>) = 0 (Timeout)
58066<wolfsshd> 11:57:06.041299 pselect6(5, [4<TCP:[0.0.0.0:1234]>], [], [], {tv_sec=1, tv_nsec=0}, NULL) = 0 (Timeout)
58066<wolfsshd> 11:57:07.042328 pselect6(5, [4<TCP:[0.0.0.0:1234]>], [], [], {tv_sec=1, tv_nsec=0}, NULL) = 0 (Timeout)
58066<wolfsshd> 11:57:08.043451 pselect6(5, [4<TCP:[0.0.0.0:1234]>], [], [], {tv_sec=1, tv_nsec=0}, NULL) = 0 (Timeout)
58066<wolfsshd> 11:57:09.044199 pselect6(5, [4<TCP:[0.0.0.0:1234]>], [], [], {tv_sec=1, tv_nsec=0}, NULL) = 0 (Timeout)
... continues forever
Perhaps wolfSSHd is not receiving or handling EOF correctly?