Hey, guys, I have a question about a difference between openssh 4.3 and 5.3. I have plenty of servers with RHEL5 and RHEL6. Most of RHEL5 servers have openssh-server version 4.3p2-72.el5_6.3 (kernel 2.6.39-100.7.1uek) And RHEL6 servers have 5.3p1-111.el6 (kernel 3.8.13-35.el6uek.x86_64) So there is the difference in assigning stdin and stdout for ssh connections. Openssh 4.3 assigns socket (I assume this socket points to /dev/log but not really sure, I've got it from strace), and openssh 5.3 assigns pipes. $ ssh root at rhel6 '/bin/ls -la /proc/self/fd' total 0 dr-x------ 2 root root 0 Oct 9 00:26 . dr-xr-xr-x 8 root root 0 Oct 9 00:26 .. lr-x------ 1 root root 64 Oct 9 00:26 0 -> pipe:[3818769145] l-wx------ 1 root root 64 Oct 9 00:26 1 -> pipe:[3818769146] l-wx------ 1 root root 64 Oct 9 00:26 2 -> pipe:[3818769147] lr-x------ 1 root root 64 Oct 9 00:26 3 -> /proc/26794/fd $ ssh root at rhel6 '/bin/ls -la /proc/self/fd' total 0 dr-x------ 2 root root 0 Oct 9 00:26 . dr-xr-xr-x 8 root root 0 Oct 9 00:26 .. lrwx------ 1 root root 64 Oct 9 00:26 0 -> socket:[3010813704] lrwx------ 1 root root 64 Oct 9 00:26 1 -> socket:[3010813704] lrwx------ 1 root root 64 Oct 9 00:26 2 -> socket:[3010813706] lr-x------ 1 root root 64 Oct 9 00:26 3 -> /proc/12193/fd I'm wondering is it expected behaviour? Is there way to assign pipes in openssh 4.3 too? Looked through code but I'm not very familiar with C programming. PS Some daemon libs think that if stdin is socket then daemon is running from inetd and it is causing some troubles. PSS Sorry for broken english :(
On Oct 9, 2015 11:29 AM, "????? ????????" <pv.safronov at gmail.com> wrote:> > Hey, guys, I have a question about a difference between openssh 4.3 and5.3.> I have plenty of servers with RHEL5 and RHEL6. > Most of RHEL5 servers have openssh-server version 4.3p2-72.el5_6.3 > (kernel 2.6.39-100.7.1uek) > And RHEL6 servers have 5.3p1-111.el6 (kernel 3.8.13-35.el6uek.x86_64) > > So there is the difference in assigning stdin and stdout for ssh > connections. Openssh 4.3 assigns socket (I assume this socket points > to /dev/logNo, sshd calls socketpair(2).> I'm wondering is it expected behaviour?Yes, in that we changed the compile time default at some point between those two because pipes have better close semantics for what sshd wants to do.> Is there way to assign pipes in openssh 4.3 too?Recompile it with -DUSE_PIPES.> Looked through code but I'm not very familiar with C programming. > > PS Some daemon libs think that if stdin is socket then daemon is > running from inetd and it is causing some trouble.That sounds a bit silly. Which daemons?
> So there is the difference in assigning stdin and stdout for ssh > connections. Openssh 4.3 assigns socket (I assume this socket points > to /dev/log but not really sure, I've got it from strace), and openssh > 5.3 assigns pipes....> I'm wondering is it expected behaviour? Is there way to assign pipes > in openssh 4.3 too? > Looked through code but I'm not very familiar with C programming.The most easy way is to *make* STDIN (and STDOUT) a pipe: $ ssh root at rhel5 'cat | /bin/ls -la /proc/self/fd | cat'
> Yes, in that we changed the compile time default at some point between those two because pipes have better close semantics for what sshd wants to do.Thanks for quick reply, appreciate it.> That sounds a bit silly. Which daemons?At least python-daemon lib. Look here for functions is_process_started_by_superserver() and is_detach_process_context_required() https://alioth.debian.org/scm/browser.php?group_id=100328 2015-10-09 5:17 GMT+03:00 Darren Tucker <dtucker at dtucker.net>:> > On Oct 9, 2015 11:29 AM, "????? ????????" <pv.safronov at gmail.com> wrote: >> >> Hey, guys, I have a question about a difference between openssh 4.3 and >> 5.3. >> I have plenty of servers with RHEL5 and RHEL6. >> Most of RHEL5 servers have openssh-server version 4.3p2-72.el5_6.3 >> (kernel 2.6.39-100.7.1uek) >> And RHEL6 servers have 5.3p1-111.el6 (kernel 3.8.13-35.el6uek.x86_64) >> >> So there is the difference in assigning stdin and stdout for ssh >> connections. Openssh 4.3 assigns socket (I assume this socket points >> to /dev/log > > No, sshd calls socketpair(2). > >> I'm wondering is it expected behaviour? > > Yes, in that we changed the compile time default at some point between those > two because pipes have better close semantics for what sshd wants to do. > >> Is there way to assign pipes in openssh 4.3 too? > > Recompile it with -DUSE_PIPES. > >> Looked through code but I'm not very familiar with C programming. >> >> PS Some daemon libs think that if stdin is socket then daemon is >> running from inetd and it is causing some trouble. > > That sounds a bit silly. Which daemons?-- ? ?????????, ???????? ?????.