Git Product home page Git Product logo

docker-ap's People

Contributors

fgg89 avatar rosenk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-ap's Issues

`iw phy "$PHY" set netns "$pid"` Fails with "Operation not supported"

Running on a Raspberry Pi 3. wlan1 (edimax) is connected to the network, wlan0 (built-in) is my intented hostapd interface. After running the script and starting the docker container, i can repro the issue like this:

> export IFACE=wlan0
> export DOCKER_NAME=ap-container
> export PHY=$(cat /sys/class/net/"$IFACE"/phy80211/name)
> echo $PHY
phy0
> pid=$(docker inspect -f '{{.State.Pid}}' $DOCKER_NAME)
> echo $pid
1143
> iw phy "$PHY" set netns "$pid"
command failed: Operation not supported (-95)

--net option to override docker --net=bridge on docker-ap start command

I have used this fine container for connectivity from wifi clients to a local multiple docker-compose application https://github.com/getodk/central. I did this by modifying docker_ap thus:

diff --git a/docker_ap b/docker_ap
index ab33c97..b6de9c9 100755
--- a/docker_ap
+++ b/docker_ap
@@ -214,7 +214,7 @@ init () {
 service_start () { 
     IFACE="$1"
     echo -e "[+] Starting the docker container with name ${GREEN}$DOCKER_NAME${NC}"
-    docker run -dt --name $DOCKER_NAME --net=bridge --cap-add=NET_ADMIN --cap-add=NET_RAW -v "$PATHSCRIPT"/hostapd.conf:/etc/hostapd/hostapd.conf -v "$PATHSCRIPT"/dnsmasq.conf:/etc/dnsmasq.conf $DOCKER_IMAGE > /dev/null 2>&1
+    docker run -dt --name $DOCKER_NAME --net=central_default --cap-add=NET_ADMIN --cap-add=NET_RAW -v "$PATHSCRIPT"/hostapd.conf:/etc/hostapd/hostapd.conf -v "$PATHSCRIPT"/dnsmasq.conf:/etc/dnsmasq.conf $DOCKER_IMAGE > /dev/null 2>&1
     pid=$(docker inspect -f '{{.State.Pid}}' $DOCKER_NAME)     

   # Assign phy wireless interface to the container 

I propose that the docker_ap command get a new option -n or --net= , In my case I would execute docker_ap --net=central_default ... . I also propose that the script check that the value of the -n or --net option is a valid docker network name, and "error out" if it is not. This proposal is backwards compatible; it would not break existing users. This enhancement will be for a system to be used by the Red Cross, where I am a volunteer.

not working in stretch?

This is what I get

[INFO] Architecture: armv7l
[INFO] Number of physical wireless interfaces connected: 1
[INFO] Docker image fgg89/armhf-docker-ap found
[INFO] Unblocking wifi and setting wlan0 up
[INFO] Found WLAN config file
[INFO] SSID: DockerAP
[+] Generating hostapd.conf
[+] Generating dnsmasq.conf
[+] Starting the docker container with name ap-container
command failed: Operation not supported (-95)
[+] Configuring wlan0 with IP address 192.168.7.1
Device "wlan0" does not exist.
Cannot find device "wlan0"
Cannot find device "wlan0"
[+] Adding natting rule to iptables (container)
[+] Enabling IP forwarding (container)
[+] Starting hostapd and dnsmasq in the docker container ap-container

I do get a similar output when I run e.g. ifdown wlan 0

ifdown: unknown interface wlan0

Therefore I suppose deprecated (in debian stretch) functions are used.
Any chance that there will be an update soon?

From what I get the corresponding command for

sudo ifdown wlan0

in stretch would be

sudo ifconfig wlan0 down

Support for arbitrary `hostapd` parameters

I tried to add other hostapd parameters that are for specifying the authentication server, e.g. auth_server_addr, but the docker-ap raised warning that they are not recognized. Then I went through the docker-ap file and noticed that it reads the parameters one by one from the wlan_config.txt and inputs them in the hostapd.conf and there are only handful of parameters considered in it. Three questions:

  • Is there any way to add arbitrary hostapd parameters other than SSID, passphrase, hw_mode and channel?
  • Is there any specific reason behind parsing the parameters from wlan_config.txt? Why not just copy paste the file into /etc/hostapd/ inside the container?
  • Do you accept PR if you are ok with this approach? I can implement this in a way to replace the parsing or as a separate feature.

Thanks,

show connected devices

Hi, it's not an issue but an feature request:

It would be great if I could see from host, which devices are connected to my docker-ap. With console inside docker-ap I can look with "arp -a". But it's not possible directly from host.

Inside host docker-ap folder should be an file named e.g. "connected_dev". It should be bind into the docker an be written every maybe 5 minutes.

What do you think about it?

Thanks for this docker-tool. I like it.

USB WLAN Interface not found

Trying to start ap on an rtl8812au which is connected by usb.

cat: /sys/class/net/enx6023a401494d/phy80211/name: No such file or directory
[INFO] Architecture: x86_64
[INFO] Number of physical wireless interfaces connected: 1
[INFO] Docker image fgg89/docker-ap not found
[+] Building the image fgg89/docker-ap (Grab a coffee...)
sha256:8aabbfaf3d20444c8ebd702b2d30100d96a26331df1d69c624cb371186f8fa81
[INFO] Unblocking wifi and setting enx6023a401494d up
[INFO] Found WLAN config file
[INFO] SSID: DockerAP
[+] Generating hostapd.conf
[+] Generating dnsmasq.conf
[+] Starting the docker container with name ap-container
command failed: No such file or directory (-2)
[+] Configuring enx6023a401494d with IP address 192.168.7.1
Device "enx6023a401494d" does not exist.
Cannot find device "enx6023a401494d"
Cannot find device "enx6023a401494d"
[+] Adding natting rule to iptables (container)
[+] Enabling IP forwarding (container)
[+] Starting hostapd and dnsmasq in the docker container ap-container
/sys/class/net/enx6023a401494d  ls -la
total 0
drwxr-xr-x  6 root root    0 сен 18 00:37 .
drwxr-xr-x  3 root root    0 сен 18 00:37 ..
-r--r--r--  1 root root 4096 сен 18 00:37 addr_assign_type
-r--r--r--  1 root root 4096 сен 18 00:37 address
-r--r--r--  1 root root 4096 сен 18 00:58 addr_len
-r--r--r--  1 root root 4096 сен 18 00:58 broadcast
-rw-r--r--  1 root root 4096 сен 18 00:58 carrier
-r--r--r--  1 root root 4096 сен 18 00:58 carrier_changes
-r--r--r--  1 root root 4096 сен 18 00:58 carrier_down_count
-r--r--r--  1 root root 4096 сен 18 00:58 carrier_up_count
lrwxrwxrwx  1 root root    0 сен 18 00:37 device -> ../../../1-3:1.0
-r--r--r--  1 root root 4096 сен 18 00:37 dev_id
-r--r--r--  1 root root 4096 сен 18 00:37 dev_port
-r--r--r--  1 root root 4096 сен 18 00:58 dormant
-r--r--r--  1 root root 4096 сен 18 00:58 duplex
-rw-r--r--  1 root root 4096 сен 18 00:58 flags
-rw-r--r--  1 root root 4096 сен 18 00:58 gro_flush_timeout
-rw-r--r--  1 root root 4096 сен 18 00:58 ifalias
-r--r--r--  1 root root 4096 сен 18 00:37 ifindex
-r--r--r--  1 root root 4096 сен 18 00:37 iflink
-r--r--r--  1 root root 4096 сен 18 00:58 link_mode
-rw-r--r--  1 root root 4096 сен 18 00:58 mtu
-r--r--r--  1 root root 4096 сен 18 00:37 name_assign_type
-rw-r--r--  1 root root 4096 сен 18 00:58 netdev_group
-r--r--r--  1 root root 4096 сен 18 00:58 operstate
-r--r--r--  1 root root 4096 сен 18 00:37 phys_port_id
-r--r--r--  1 root root 4096 сен 18 00:37 phys_port_name
-r--r--r--  1 root root 4096 сен 18 00:58 phys_switch_id
drwxr-xr-x  2 root root    0 сен 18 00:58 power
-rw-r--r--  1 root root 4096 сен 18 00:58 proto_down
drwxr-xr-x 10 root root    0 сен 18 00:58 queues
-r--r--r--  1 root root 4096 сен 18 00:58 speed
drwxr-xr-x  2 root root    0 сен 18 00:58 statistics
lrwxrwxrwx  1 root root    0 сен 18 00:58 subsystem -> ../../../../../../../../class/net
-rw-r--r--  1 root root 4096 сен 18 00:58 tx_queue_len
-r--r--r--  1 root root 4096 сен 18 00:37 type
-rw-r--r--  1 root root 4096 сен 18 00:37 uevent
drwxr-xr-x  2 root root    0 сен 18 00:58 wireless

Cant get wifi ax on rtl8852be working?

Hello, could you help me with setting up the rtl8852be on 801.11ax standard because it only works with 801.11g, i couldn't get network to show with any other standard/version of wifi.

The conf that works for me on 801.11g is the default one.

this is my rtl8852be iwconfig:

wlp4s0    IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

Thanks in advance.

modifications for "Realtek 802.11n WLAN Adapter" (usb connected) wifi (rtl8192cu)

wifi adapter Identified with nmcli
I adapted the following changes from: https://github.com/offlinehacker/docker-ap
'''
diff --git a/templates/hostapd.template b/templates/hostapd.template
index 9ce1549..f47831e 100644
--- a/templates/hostapd.template
+++ b/templates/hostapd.template
@@ -1,3 +1,11 @@
+driver=nl80211
+wpa_pairwise=CCMP
+rsn_pairwise=CCMP
+wpa_ptk_rekey=600
+ieee80211n=1
+ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
+wmm_enabled=1
+#end PT changes
ssid=_SSID
interface=_IFACE
hw_mode=_HW_MODE
'''

Remove privileged flag

It should suffice to remove --privileged and instead use just --cap-add=NET_ADMIN --cap-add=NET_RAW

Not sure if this is docker version specific.

is it possible to remove external network manipulation?

I've been trying to create a dockerized AP for a while, in a way that can fit a docker-compose workflow. I didn't get anywhere close, without ssh-ing into the host or mounting just about everything, but your approach seems promising.

It was trivial to fill the templates from within the container and similar, but I can't seem to be able to configure the networking completely from within the container (and docker-cli arguments / docker-compose.yml params)

I'm trying on arm.

Do you think this is even possible? It would be great to have an example of that somewhere on the web

Failed to start on Raspberry Pi 3

I'm trying to use this to start access point into rpi3 but it fails with:

| \ ___ | |___ _ _ /\ | _ \
| |) / _ / | / / -) '
| / _ | /
|
/**/**|__|| // __|

[INFO] Architecture: armv7l
[INFO] Number of physical wireless interfaces connected: 1
[INFO] Docker image fgg89/armhf-docker-ap found
[INFO] Unblocking wifi and setting wlan0 up
[INFO] Found WLAN config file
[+] Generating hostapd.conf
[+] Generating dnsmasq.conf
[+] Starting the docker container with name ap-container
command failed: Operation not supported (-95)
[+] Configuring wlan0 with IP address 192.168.7.1
Device "wlan0" does not exist.
Cannot find device "wlan0"
Cannot find device "wlan0"
[+] Adding natting rule to iptables (container)
[+] Enabling IP forwarding (container)
[+] Starting hostapd and dnsmasq in the docker container ap-container

I have tried to debug it within my limited knowledge on this subject and apparently:
iw phy "$PHY" set netns "$pid"
fails with
command failed: Operation not supported (-95)

I have no idea what exactly this means. Is it not supported by the hardware?
$iw list output:

Wiphy phy0
    max # scan SSIDs: 10
    max scan IEs length: 2048 bytes
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports T-DLS.
    Supported Ciphers:
        * WEP40 (00-0f-ac:1)
        * WEP104 (00-0f-ac:5)
        * TKIP (00-0f-ac:2)
        * CCMP (00-0f-ac:4)
        * CMAC (00-0f-ac:6)
    Available Antennas: TX 0 RX 0
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * P2P-client
         * P2P-GO
         * P2P-device
    Band 1:
        Capabilities: 0x1020
            HT20
            Static SM Power Save
            RX HT20 SGI
            No RX STBC
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 16 usec (0x07)
        HT TX/RX MCS rate indexes supported: 0-7
        Bitrates (non-HT):
            * 1.0 Mbps
            * 2.0 Mbps (short preamble supported)
            * 5.5 Mbps (short preamble supported)
            * 11.0 Mbps (short preamble supported)
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps
        Frequencies:
            * 2412 MHz [1] (20.0 dBm)
            * 2417 MHz [2] (20.0 dBm)
            * 2422 MHz [3] (20.0 dBm)
            * 2427 MHz [4] (20.0 dBm)
            * 2432 MHz [5] (20.0 dBm)
            * 2437 MHz [6] (20.0 dBm)
            * 2442 MHz [7] (20.0 dBm)
            * 2447 MHz [8] (20.0 dBm)
            * 2452 MHz [9] (20.0 dBm)
            * 2457 MHz [10] (20.0 dBm)
            * 2462 MHz [11] (20.0 dBm)
            * 2467 MHz [12] (20.0 dBm)
            * 2472 MHz [13] (20.0 dBm)
            * 2484 MHz [14] (disabled)
    Supported commands:
         * new_interface
         * set_interface
         * new_key
         * start_ap
         * join_ibss
         * set_pmksa
         * del_pmksa
         * flush_pmksa
         * remain_on_channel
         * frame
         * set_channel
         * tdls_oper
         * start_sched_scan
         * start_p2p_device
         * crit_protocol_start
         * crit_protocol_stop
         * connect
         * disconnect
    Supported TX frame types:
         * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
         * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    Supported RX frame types:
         * managed: 0x40 0xd0
         * P2P-client: 0x40 0xd0
         * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
         * P2P-device: 0x40 0xd0
    software interface modes (can always be added):
    valid interface combinations:
         * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
           total <= 3, #channels <= 2
         * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
           total <= 4, #channels <= 1
    Device supports scan flush.

Please help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.