Giter VIP home page Giter VIP logo

dnp_wifi's Introduction

DAppNode Package WIFI (Core)

Website dappnode.io Documentation Wiki GIVETH Campaign ELEMENT DAppNode Twitter Follow

Dappnode package responsible for providing wifi access to the internal network.

It is an AragonApp whose repo is deployed at this address: 0xbb0fe4bcc05d83617ff29219e46a7834be9496d7 and whose ENS address is: wifi.dnp.dappnode.eth

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • git

    Install git commandline tool.

  • docker

    Install docker. The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, sudo usermod -aG docker $USER. Once you update the users group, exit from the current terminal and open a new one to make effect.

  • docker-compose

    Install docker-compose

Note: Make sure you can run git, docker ps, docker-compose without any issue and without sudo command.

Building

$ git clone https://github.com/dappnode/DNP_WIFI.git
$ docker-compose build
or
$ docker build --rm -f build/Dockerfile -t wifi.dnp.dappnode.eth:dev build

Running

Start

$ docker-compose up -d

Stop

$ docker-compose down

Status

$ docker-compose ps

Logs

$ docker-compose logs -f

Generating a tar.xz image

xz is required

$ docker save wifi.dnp.dappnode.eth:dev | xz -e9vT0 > wifi.dnp.dappnode.eth_x.y.z.tar.xz

You can download the latest tar.xz version from here releases.

Loading a Docker image

$docker load -i wifi.dnp.dappnode.eth_x.y.z.tar.xz

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Eduardo Antuña Díez - Initial work - eduadiez

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details

References

git

docker

docker-compose

Parity

dnp_wifi's People

Contributors

3alpha avatar console-cowboy avatar dapplion avatar dappnodedev avatar eduadiez avatar pablomendezroyo avatar pol-lanski avatar tropicar avatar vdo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dnp_wifi's Issues

Interface lost when setting password too long (> 63) or too short (< 8)

Error recreation:

When the user attemps to change the default password of the DAppNode wifi hotspot with a password with less than 8 characters or more than 63 characters, the wifi hotspot will loose the interface and will not be able to connect via wifi anymore, until it changes the password using the command line (ssh)

Error

Line 7: invalid WPA passphrase length 1 (expected 8..63)
WPA-PSK enabled, but PSK or passphrase is not configured.
2 errors found in configuration file '/etc/hostapd.conf'
Failed to set up interface with /etc/hostapd.conf
Failed to initialize interface

To solve it:

In the wizard of the dappnode package set a pattern (regex) for the WPA_PASSPHRASE env variable

Network interface in the host might dissappear for a while

Issue

Users have had problems with the dappnode wifi for a long time, and seems like one of the root causes is the following issue:

When the wifi container starts, it takes the network interface from the host (commonly wlan0) as well as the physical layer, (commonly the phy0) these are the paths that simply disappear:

  • /sys/class/net/wlan0
  • /sys/class/ieee80211/phy0

When the wifi container gets stopped, the network interface and the physical layer should appear back in the host, but it seems like there is a delay of 1' 53'' average, to appear in the host back again.

The line of code that takes the network interface from the host is:

docker run -t --privileged --net=host --pid=host --rm --entrypoint /bin/sh ${CONTAINER_IMAGE} -c "

Debugging

This report was obtained using a script for debugging purposes, which:

  1. Stops wifi container and waits for the paths to exists
  2. Starts wifi container and start again

Timelapses obtained:

  1. Time lapse: Thu Jul 8 16:27:50 CEST 2021 - Thu Jul 8 16:27:50 CEST 2021
  2. Time lapse: Thu Jul 8 16:27:59 CEST 2021 - Thu Jul 8 16:29:52 CEST 2021
  3. Time lapse: Thu Jul 8 16:30:01 CEST 2021 - Thu Jul 8 16:31:55 CEST 2021
  4. Time lapse: Thu Jul 8 16:32:04 CEST 2021 - Thu Jul 8 16:33:58 CEST 2021
  5. Time lapse: Thu Jul 8 16:34:07 CEST 2021 - Thu Jul 8 16:36:00 CEST 2021
    =============================================================
  6. Time lapse: Thu Jul 8 18:17:55 CEST 2021 - Thu Jul 8 18:17:55 CEST 2021
  7. Time lapse: Thu Jul 8 18:18:05 CEST 2021 - Thu Jul 8 18:18:05 CEST 2021
  8. Time lapse: Thu Jul 8 18:18:15 CEST 2021 - Thu Jul 8 18:20:07 CEST 2021
  9. Time lapse: Thu Jul 8 18:20:17 CEST 2021 - Thu Jul 8 18:22:09 CEST 2021
  10. Time lapse: Thu Jul 8 18:22:19 CEST 2021 - Thu Jul 8 18:24:11 CEST 2021

Note: notice that the first attempt works without issues, the rest of them has an average delay of 1' 50-58''

Possible solutions

  • The ideal solution would be to execute a systemctl restart network and make interfaces appear back again in the host. The concern is that this procedure is a bit aggressive and I did not got it work

Wifi credentials not able to be changed. Might be due to non ASCII character in current SSID?

Describe the bug

I have an SSID on the wifi that I set early february this year, at that time it worked to set an SSID with the letter "ä".
Now it mentions that "SSID must include only simple ASCII characters" when i look in the wifi tab.
I tried chaning the ä --> a.
When clicking update credentials nothing happens.
Tried it with both the wifi on and off.

I tried letting it be for some minutes just to see if it was slow, but as soon as i go to another section like the dashboard and then back to wifi section then it's the old SSID with ä

To Reproduce

See above.

Expected behavior

Some kind of text saying "wifi credentials updated" and the credentials being updated.

Screenshots

image
image

DAppNode version:

Core DAppNode Packages versions

  • bind.dnp.dappnode.eth: 0.2.6
  • core.dnp.dappnode.eth: 0.2.50
  • dappmanager.dnp.dappnode.eth: 0.2.45, commit: 7b9ad9ad
  • https.dnp.dappnode.eth: 0.1.2
  • ipfs.dnp.dappnode.eth: 0.2.15
  • vpn.dnp.dappnode.eth: 0.2.8, commit: f9a8743e
  • wifi.dnp.dappnode.eth: 0.2.8

System info

  • dockerComposeVersion: 1.25.5
  • dockerServerVersion: 20.10.2
  • dockerCliVersion: 20.10.2
  • os: debian
  • versionCodename: bullseye
  • architecture: amd64
  • kernel: 5.9.0-4-amd64
  • Disk usage: 76%
  • Browser: Brave, using VPN going to my.dappnode. Also tried doing it via dappnode.local.

Additional context

INTERFACE might be assigned to an error or empty value

Due to #33 , network interfaces might not exist on the host for a period of time up to 2'. This means that the INTERFACE variable assign may fail within the delay of the dappnode wifi container, which is up to 1' (

# This adds a one minute wait before stopping for not finding an interface
)

The INTERFACE assignment is done:

  • INTERFACE=$(docker run -t --privileged --net=host --pid=host --rm --entrypoint /bin/sh ${CONTAINER_IMAGE} -c "iw dev" | grep 'Interface' | awk 'NR==1{print $2}')
    : returns empty if network interface is within the period of time where it does not exist
  • INTERFACE=$(docker run -t --privileged --net=host --pid=host --rm --entrypoint /bin/sh ${CONTAINER_IMAGE} -c "ls /sys/class/ieee80211/*/device/net")
    : returns an error if network interface is within the period of time where it does not exist

Interface lost on updates

When upgrading the package, the container is destroyed to deploy the new one, and the interface captured by the package is not seen anymore.

Fixed with a reboot, but we should investigate a way to 'liberate' again the interface to the host on upgrades.

Restarting policy for wifi package may be a vulnerability

A few users have shown their concern for the wifi status. Wifi may be a security vulnerability so users should have the option to disable it persistently. This would eliminate an entry point for possible attacks

Currentyly, wifi is a core package that has a restart policy of "always", so even when you toggle it off and reboot the host machine, the wifi container starts again.

In this case, a solution would be to consider changing the restart policy from "always" to "unless-stop", so the wifi container status is persistent when rebooting.

Wifi should always restart if user did not manually stop it

Wifi package should be restarted always unless the package was manually stopped by the user. According to the restart policy unless-stopped docker will restart the container if the exit code is != 0.

Currently, the wifi container will exit with an exit code in two situations, this will prevent the wifi package from been restarted:


((COUNT++)) && ((COUNT==10)) && echo "[Warning] No interface found after 60s, stopping gracefully" && exit 0

  • Exit codes should be change to non-zero codes, so the wifi package keeps restarting unless the user manually stops it
  • Look for a better way of knowing if the host machine has a network interface: ls /sys/class/ieee80211/*/device/net/

Take into account that remote dappnodes will have this package restarting in an infinite loop unless the user manually disables it.

Permanently Stop/Disable modules

Currently, when a module is stopped, it will return to a running state upon reboot.

Having an option to permanently stop the module and prevent is from returning to a running state after a reboot would be very helpful.

add gracefully shut down

Stopping DAppNodeCore-wifi.dnp.dappnode.eth container results in an exit code 137. This means that the default timeout was not enough to stop the container and docker sent a SIGKILL signal to the container to stop it. Even giving a greater timeout result in same error. (docker stop DAppNodeCore-wifi.dnp.dappnode.eth -t 60)

This is critical for the UI since the container will appear as status crashed whereas it was paused

Expected behaviour

Stop DAppNodeCore-wifi.dnp.dappnode.eth container results in exit code 0.

Possible solution

Add a listener to stop the container when sent docker-stop signal to gracefully shut it down to wlanstart.sh

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.