After upgrading to 7.3 autossh is failing using the following rc script
in /etc/rc.d/autossh. It looks like maybe switching to $daemon_user is
not happening to find the correct ssh config stanzas? Thanks in advance
for any help.
## Startup configuration
#!/bin/ksh
# start autossh tunnel
# requires remoteuser user with $HOME/.ssh/config and keys
daemon="/usr/local/bin/autossh"
daemon_flags_1="-M 0 -f -N tun-remoteA"
daemon_flags_1="-M 0 -f -N tun-remoteB"
daemon_user="remoteuser"
. /etc/rc.d/rc.subr
rc_reload=NO
pexp="autossh:.*"
# Child will not return a config parsing error to the parent.
rc_start() {
# use rcexec here since daemon_flags may contain arguments with spaces
${rcexec} "${daemon} ${daemon_flags_1}" && \
${rcexec} "${daemon} ${daemon_flags_1}"
}
rc_cmd $1
## User config
SSH config for the user in ~remoteuser/.ssh/config everything looks good and
nothing has changed on this since being on 7.2.
Host tun-remoteA
HostName remoteA.example.org
AddressFamily inet
User remoteuser
IdentityFile /home/remoteuser/.ssh/id_rsa
RemoteForward 32220 localhost:22
ServerAliveInterval 15
ServerAliveCountMax 3
ExitOnForwardFailure yes
Host tun-remoteB
HostName remoteB.example.org
AddressFamily inet
User remoteuser
IdentityFile /home/remoteuser/.ssh/id_rsa
RemoteForward 32220 localhost:22
ServerAliveInterval 15
ServerAliveCountMax 3
ExitOnForwardFailure yes
## Startup showing failure
# rcctl -d start autossh
doing _rc_parse_conf
autossh_flags empty, using default ><
doing rc_check
autossh
doing rc_start
/etc/rc.d/autossh: /usr/local/bin/autossh -M 0 -f -N tun-remoteA: not found
doing _rc_wait_for_start
doing _rc_rm_runfile
(failed)
# echo $?
1
## Checking that the ssh config for the user works on local to remoteA
# uname -a
OpenBSD local 7.3 GENERIC.MP#1125 amd64
# su -l remoteuser
remoteuser$ ssh tun-remoteA
Last login: Tue Apr 25 10:14:51 2023 from 10.10.10.10
OpenBSD 7.3 (GENERIC) #1072: Sat Mar 25 10:26:08 MDT 2023
remoteA$ uname -a
OpenBSD remoteA 7.3 GENERIC#1072 amd64