Bug 1711655 - Socket not removed after closing the session
Summary: Socket not removed after closing the session
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: openssh
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dmitry Belyavskiy
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-19 10:34 UTC by Frank Büttner
Modified: 2021-11-03 09:41 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-03 09:41:38 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenSSH Project 3024 0 None None None 2019-06-26 16:36:08 UTC

Description Frank Büttner 2019-05-19 10:34:07 UTC
Description of problem:
When using the socked forward via -L then after closing the session the socket created on the locale side are not removed.

Version-Release number of selected component (if applicable):
openssh-clients-7.9p1-5.fc29.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. ssh foo -L /tmp/foo:/var/lib/mysql/mysql.sock
2. close the connection
3. ssh foo -L /tmp/foo:/var/lib/mysql/mysql.sock

Actual results:
The 3rd call will fail with:
unix_listener: cannot bind to path /tmp/foo: Address already in use
Could not request local forwarding.

Expected results:
Working forward.

Additional info:
ssh foo -L /tmp/foo:/var/lib/mysql/mysql.sock
rm /tmp/foo
ssh foo -L /tmp/foo:/var/lib/mysql/mysql.sock
Will work, so nothing will use the socket.

Comment 1 Jakub Jelen 2019-05-20 08:17:22 UTC
AFAIK ssh will try to remove the socket when the forwarding is terminated (is it?), but it might be prevented to do so because either something else is using the socket at the time of exit or some permissions issues (SELinux?). I would probably have to see s strace or ssh debug log to be able to figure out what went wrong.

Anyway, always there is a StreamLocalBindUnlink configuration option, which you should also consider.

Comment 2 Frank Büttner 2019-05-20 15:07:27 UTC
For selinux I see no exception.
Here the output of ssh -vvv on closing the connection:
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 1 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 1 rtype eow reply 0
debug2: channel 1: rcvd eow
debug2: channel 1: chan_shutdown_read (i0 o0 sock -1 wfd 6 efd 8 [write])
debug2: channel 1: input open -> closed
debug3: receive packet: type 96
debug2: channel 1: rcvd eof
debug2: channel 1: output open -> drain
debug2: channel 1: obuf empty
debug2: channel 1: chan_shutdown_write (i3 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 1: output drain -> closed
debug3: receive packet: type 97
debug2: channel 1: rcvd close
debug3: channel 1: will not send data after close
debug2: channel 1: almost dead
debug2: channel 1: gc: notify user
debug2: channel 1: gc: user detached
debug2: channel 1: send close
debug3: send packet: type 97
debug2: channel 1: is dead
debug2: channel 1: garbage collecting
debug1: channel 1: free: client-session, nchannels 2
debug3: channel 1: status: The following connections are open:
  #1 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)

debug3: send packet: type 1
debug1: channel 0: free: unix listener, nchannels 1
debug3: channel 0: status: The following connections are open:

debug3: fd 1 is not O_NONBLOCK
Connection to XXXXX closed.
Transferred: sent 5464, received 3548 bytes, in 10.1 seconds
Bytes per second: sent 538.8, received 349.9
debug1: Exit status 0

On this sample, I only connect and disconnect. The created socket was not used.
Calling it via strace, I don't see any attempt to remove the socket.

Comment 3 Jakub Jelen 2019-06-26 09:34:05 UTC
Using the following works fine:

   $ ssh  -L /tmp/foo:/var/lib/mysql/mysql.sock -oStreamLocalBindUnlink=yes rhel7.virt

Reading through the code, there is really not unlink() when the forwarding is canceled/closed. The question is, whether this is intentional or not, but that is for a discussion in upstream bugzilla [1] or on mailing list (usually faster reply) [2]. Please, try to ask there, or I can redirect this bug later.

[1] http://bugzilla.mindrot.org/
[2] https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

Comment 4 Ben Cotton 2019-10-31 19:05:36 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Frank Büttner 2019-11-01 16:47:24 UTC
same for f30

Comment 6 Ben Cotton 2020-04-30 20:47:25 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Frank Büttner 2020-05-01 06:56:32 UTC
Same for f31

Comment 8 Ben Cotton 2020-11-03 15:14:13 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Frank Büttner 2020-11-03 16:44:26 UTC
Same on F32

Comment 10 Fedora Program Management 2021-04-29 15:55:42 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Frank Büttner 2021-04-30 10:30:11 UTC
Same on f33


Note You need to log in before you can comment on or make changes to this bug.