Results 1 to 4 of 4

Thread: USB wifi stick as AP - however, hotplug busts WPA security

  1. #1

    Default USB wifi stick as AP - however, hotplug busts WPA security

    Greetings!

    I have set up an USB wifi stick so that it acts as an access point with WPA enabled (WEP's just too insecure).
    Now, when I remove and then replug the stick (or plug it some time after system boot) the WPA security is lost, and I have to restart hostapd manuallyto regain it.

    Is there a way to automatically kill hostapd when the stick is unplugged and relaunch it after the device has come up again? FYI: I'm using the traditional scheme using ifup/ifdown...

  2. #2
    Join Date
    Jun 2008
    Location
    Kansas City Area, Missouri, USA
    Posts
    7,236

    Default Re: USB wifi stick as AP - however, hotplug busts WPA security

    On 11/28/2013 06:36 AM, Robidu wrote:
    >
    > Greetings!
    >
    > I have set up an USB wifi stick so that it acts as an access point with
    > WPA enabled (WEP's just too insecure).
    > Now, when I remove and then replug the stick (or plug it some time after
    > system boot) the WPA security is lost, and I have to restart hostapd
    > manuallyto regain it.
    >
    > Is there a way to automatically kill hostapd when the stick is unplugged
    > and relaunch it after the device has come up again? FYI: I'm using the
    > traditional scheme using ifup/ifdown...


    There is no automatic way to do it that I know about. The general assumption is
    that some boxes are used for computing, and others are used as access points.
    The latter are assumed to always be running some version of hostapd, or the
    equivalent.

    You could write a script that tests if the wlX device is present. If not and
    hostapd is running, then kill it. If the device is present and hostapd is not
    running, then start it. Then sleep for some time and loop.

    I know that jdmcdaniel3 prefers bash for his scripts, but I prefer perl. The
    string handling routines are a lot better.


  3. #3

    Default Re: USB wifi stick as AP - however, hotplug busts WPA security

    Hmmm... o.k., thanks for the reply.
    So it looks as if I need to do some tinkering with the scripts, then.

    Polling to see whether or not an interface is up seems to be a bit unsatisfactory, because it greatly depends on the time interval chosen for checking - you could incur a race condition here. I guess I'm going to dig into the startup/shutdown script for the network interfaces to see if I can find anything that could help implementing this.

    The best solution would, of course, be a hook within ifup/ifdown that invokes an auxiliary script in case you need additional measures to be taken when an interface is brought up or taken down.

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    23,704
    Blog Entries
    1

    Default Re: USB wifi stick as AP - however, hotplug busts WPA security

    Quote Originally Posted by Robidu View Post
    Hmmm... o.k., thanks for the reply.
    So it looks as if I need to do some tinkering with the scripts, then.

    Polling to see whether or not an interface is up seems to be a bit unsatisfactory, because it greatly depends on the time interval chosen for checking - you could incur a race condition here. I guess I'm going to dig into the startup/shutdown script for the network interfaces to see if I can find anything that could help implementing this.

    The best solution would, of course, be a hook within ifup/ifdown that invokes an auxiliary script in case you need additional measures to be taken when an interface is brought up or taken down.
    You could use a udev rule to detect the device, and run a script on detection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •