Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1966  / 1 Year ago, tue, march 28, 2023, 1:39:15

Recent Upstart has these new fancy systemd-like features of starting jobs on incoming connection via socket-bridge. I'd like to start my sshd upon first connection to port 22.



I now have:
start on socket PROTO=inet PORT=22 in my ssh.conf and I have upstart-socket-bridge and upstart-udev-bridge jobs running.



The ssh job starts OK when I connect to my box on port 22 but sshd doesn't talk back to me. Its as if it doesn't receive it and cannot accept it. Retrying to connect will not help, even sshd is now running and should be accepting the connections normally. Upstart is still messing with it!



Socket event man pages say:




When an incoming connection is detected, the file descriptor
representing the socket is passed to the job in question to allow it to
accept(2) the connection. Additionally, the environment variable
UPSTART_JOB will contain the name of the event ("socket") and the
environment variable UPSTART_FDS will contain the number of the file
descriptor corresponding to the listening socket.




Does that mean that to take advantage of this, ssh needs specific support to passing socket FD? IF that is the case, it kinda spoils all the fun :/


More From » upstart

 Answers
5

Using the socket bridge requires a patched daemon that can handle the socket that it is given.



From man socket-event:




When an incoming connection is detected, the file descriptor representing the socket is passed to the job in question to allow it to accept(2) the connection. Additionally, the environment variable UPSTART_JOB will contain the name of the event ("socket") and the environment variable UPSTART_FDS will contain the number of the file descriptor corresponding to the listening socket.




While normally sshd would simply create a socket and run listen() then accept() on it, sshd just needs to read the UPSTART_FDS environment variable and accept() on that.


[#40886] Thursday, March 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arkcker

Total Points: 296
Total Questions: 111
Total Answers: 104

Location: Nepal
Member since Tue, Sep 8, 2020
4 Years ago
arkcker questions
Tue, Aug 17, 21, 00:08, 3 Years ago
Sun, May 14, 23, 01:04, 1 Year ago
Wed, Nov 16, 22, 03:12, 1 Year ago
Tue, Jun 1, 21, 01:29, 3 Years ago
;