On Sunday, August 23, 2015 at 1:56:07 PM UTC-4,
nolo...@gmail.com wrote:
> I'm having troubles with an updated OpenSSH server installed in `--prefix=/usr/local`. SSHD's path is `/usr/local/sbin/sshd`. When the server receives a connection, the connection fails.
>
> The client displays the following when run with `-d`: "ssh_exchange_identification: Connection closed by remote host".
>
> The server displays the following when run with `-d`: "sshd re-exec requires execution with an absolute path".
>
It appears the error message "sshd re-exec requires execution with an absolute path" is caused by the following in `sshd.c`. It is present near line 1625:
if (!test_flag && (rexec_flag && (av[0] == NULL || *av[0] != '/')))
fatal("sshd re-exec requires execution with an absolute path");
Changing the code to print av[0] shows there is no executable or path:
if (!test_flag && (rexec_flag && (av[0] == NULL || *av[0] != '/')))
fatal("sshd re-exec requires execution with an absolute path (re-exec with \"%s\")", (av[0] ? av[0] : "<NULL>"));
The new message (because of the changes above) includes "(re-exec with "-i -d")"
This is OS X 10-5 on a old PowerMac, and the service is being started by Launchd and a plist file. Unfortunately, changing the plist to explicitly provide the absolute path in argv[0] (the full cat is shown below):
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/sshd -i -d</string>
</array>
Results in the following. Notice sshd.c still stripped the absolute path I entered at argv[0]:
$ sudo grep 'sshd' /var/log/* 2>/dev/null
/var/log/system.log:Aug 23 15:51:22 riemann.local sshd -i -d[1243]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
/var/log/system.log:Aug 23 15:51:22 riemann.local sshd -i -d[1243]: error: Bind to port 22 on :: failed: Address already in use.
/var/log/system.log:Aug 23 15:51:22 riemann.local sshd -i -d[1243]: fatal: Cannot bind any address.
> How do I tell SSHD to use its absolute path when forking?
The problem seems a little deeper than simply adding an absolute path at argv[0].
Help would be appreciated.
-----
$ cat ssh-7.1.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>Label</key>
<string>com.openssh.sshd-v7.1</string>
<key>Program</key>
<string>/usr/local/sbin/sshd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/sshd -i -d</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>1522</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>StandardErrorPath</key>
<string>/var/log/sshd.log</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
</plist>