View previous topic :: View next topic |
Author |
Message |
dasPaul Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/2045064500518e181e89dc8.gif)
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Wed Jun 15, 2016 11:13 am Post subject: sshd wait for wpa_supplicant association? [solved] |
|
|
Hi
Situation:
Raspberry Pi (headless)
Interfaces: LAN/eth0 (sometimes connected, used if Wifi is not available),
Wifi/ra0 (sometimes connected, AP not always on)
Problem:
Is there a way to make sshd service waiting for my wireless adapter (ra0) to finish connection, or better
to wait a specific time and then give up and start sshd with the remaining available interfaces (eth0)?
I explicitly removed ra0 from sshd dependencies
(in /etc/conf.d/sshd "rc_need="!net net.eth0"")
because if ra0 doesn't/cant connect sshd waits forever and I cant even
connect via eth0. Now I can always connect via eth0 but sshd doesnt wait for wpa_supplicant and it does not take ra0 into
account which needs sometimes 10 seconds to associate with AP.
Last edited by dasPaul on Wed Jun 15, 2016 4:42 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Syl20 l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/10625062156fe89c57a2d3.png)
Joined: 04 Aug 2005 Posts: 621 Location: France
|
Posted: Wed Jun 15, 2016 1:09 pm Post subject: |
|
|
The problem is you want to set two incompatible conditions on the same event...
I think you have to set it in two times :
1/ let rc start sshd when eth0 is ready, and
2/ restart sshd when ra0 is ready, via a postassociate hook. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dasPaul Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/2045064500518e181e89dc8.gif)
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Wed Jun 15, 2016 2:37 pm Post subject: |
|
|
thank you, I totally missed that wiki page, now studying
Quote: | /usr/share/doc/netifrc-*/net.example.bz2 |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
khayyam Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/9397496074fd0189143bb7.png)
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Jun 15, 2016 4:05 pm Post subject: Re: sshd wait for wpa_supplicant association? |
|
|
dasPaul wrote: | (in /etc/conf.d/sshd "rc_need="!net net.eth0"") |
dasPaul ... that should be 'rc_need="!net"' or 'rc_sshd_need="!net"' ... 'net' is the whole of providers. That said, with '!net' sshd shouldn't wait for some interface to provide net so I don't know why you might see it doing so.
Syl20 wrote: | I think you have to set it in two times :
1/ let rc start sshd when eth0 is ready, and
2/ restart sshd when ra0 is ready, via a postassociate hook. |
Neither of those should be necessary, '!net' means that 'need net' is nolonger required, and unless ListenAddress is provided sshd listens on 0.0.0.0:22 so will be available regardless of what interface comes up.
dasPaul wrote: | because if ra0 doesn't/cant connect sshd waits forever and I cant even connect via eth0. Now I can always connect via eth0 but sshd doesnt wait for wpa_supplicant and it does not take ra0 into account which needs sometimes 10 seconds to associate with AP. |
I don't understand why this would happen ... I can start sshd (instantly) without anything providing net.
grep sshd /etc/rc.conf: | rc_sshd_need="!net" |
best ... khay |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dasPaul Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/2045064500518e181e89dc8.gif)
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Wed Jun 15, 2016 4:23 pm Post subject: |
|
|
Problem solved now.
To restart sshd on every interface up:
/etc/conf.d/net
Code: | postup() {
/etc/init.d/sshd restart
return 0
} |
Additionally I emerged ifplugd and added
to rc.conf to have the corresponding service automatically started.
Now no matter what I plug in or out lan-cable or usb-wlanstick, sshd gets restarted. ![Cool 8)](images/smiles/icon_cool.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dasPaul Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/2045064500518e181e89dc8.gif)
Joined: 14 Feb 2012 Posts: 243 Location: Dresden
|
Posted: Wed Jun 15, 2016 4:40 pm Post subject: Re: sshd wait for wpa_supplicant association? |
|
|
khayyam wrote: | Neither of those should be necessary... |
true!
khayyam wrote: |
and unless ListenAddress is provided |
That was the problem, I had three of them in sshd_config. Thank you!
I undo(ed)? every change I wrote to the files exept
the hotplug and your "rc_sshd_need="!net"". It works |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|