On Tue, Apr 25, 2023 at 01:16:22PM -0500, [email protected] wrote:
> On Tue, Apr 25, 2023 at 08:09:46PM +0200, Antoine Jacoutot wrote:
> >On Tue, Apr 25, 2023 at 12:41:41PM -0500, [email protected] wrote:
> >> On Tue, Apr 25, 2023 at 12:03:51PM -0500, [email protected] wrote:
> >> >On Tue, Apr 25, 2023 at 10:45:21AM -0500, [email protected] wrote:
> >> >> [..]
> >> >> [ some bad paste ]
> >> >
> >> >Just a clarification: the rc script in /etc/rc.d/autossh actually looks
> >> >like
> >> >
> >> >#!/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_2="-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_2}"
> >> >}
> >> >
> >> >rc_cmd $1
> >>
> >>
> >> So tracking this down a bit more, if I modify the rc script to just
> >> list remoteuser's ~/.ssh/config file issues arise
> >
> >That's not what the script does from what I can see.
> >
> >> rc_start() {
> >> # use rcexec here since daemon_flags may contain arguments with
> >> spaces
> >> ls -l ${daemon_user}/.ssh/config
> >> #${rcexec} "${daemon} ${daemon_flags_1}" && \
> >> #${rcexec} "${daemon} ${daemon_flags_2}"
> >> }
> >>
> >> # rcctl -d start autossh
> >> doing _rc_parse_conf
> >> autossh_flags empty, using default ><
> >> doing rc_check
> >> autossh
> >> doing rc_start
> >> doing _rc_wait_for_start
> >> doing rc_check
> >> ls: remoteuser/.ssh/config: No such file or directory
> >> doing _rc_rm_runfile
> >> (failed)
> >
> >Well it's doing exactly what you are telling it to do.
> >Not sure I understand what you mean.
>
> You missed the second part where I said:
>
> But if I add prepend "/home" to ${daemon_user}, it works as expected.
>
I didn't miss anything.
"ls -l ${daemon_user}/.ssh/config"
Which translate to "ls remoteuser/.ssh/config".
That file does not exist (it's not an absolute path so if you run it from
anywhere other than /home, then it won't be found).
When you append /home you are doing:
"ls -l /home/${daemon_user}/.ssh/config" which translate to an absolute path:
/home/remoteuser/.ssh/config.
--
Antoine