Author

Topic: [HowTo] Coindesk - Setup for encrypted wireless network (Read 612 times)

legendary
Activity: 938
Merit: 1000
Thanks for your guide, It took some time to get It clear for me but I finally did. Good guide.
newbie
Activity: 24
Merit: 0
The coindesk seems to be prepared for open wireless networks out of the box, but my network is encrypted with WPA2-Personal/AES.
This does not work out of the box (or I'm really really stupid Smiley ), as it requires the wpa_supplicant binary which is not included. I found no package manager installed to install the binary and I also have not found a binary on the web, so I needed to cross compile it.
To save anyone the hassle to do the same, I provide you with my compiled binary. I also cross-compiled the wlan-tools, which are helpful in checking if your wlan adapter works and to scan networks + get details about their settings.

This is a condensed how-to, you might run into trouble somewhere and if you do, you need to know or find out how to solve it.
I cannot give support for this, there are just too many things that can go wrong (in terms of: wlan not working). Smiley

Note:
As I have compiled the provided binaries from source, in theory I could have manipulated the source to do evil things with your miner.
I guarantee that I did not, but I think that you should be aware of that such things are possible. Smiley

Note2:
I cannot be held responsible for any damage caused by my instructions or the files provided. It is extremely unlikely that any damage gets caused and nothing should void your warranty as this is nothing but moving a couple of binaries on the miner and reconfiguring the network, but be careful nonetheless. If at any time you happen to f**k the OS of the miner up to no rescue, which again is unlikely if you follow my steps, you can get a new sd-card flash file at bitmines website, so you should be somewhat safe. Smiley



Prerequisites

a) Mandatory
  • wpa_supplicant binary (provided in package)
  • access to a linux box with wpa_passphrase binary
  • working wifi card/usb-plug.
  • DHCP Server

b) Optional
  • wlan-tools (provided in package)

c) Known issues
  • The front display will not display the IP anymore. (fixed, see bottom)
  • There is an error message when starting wpa_supplicant, but it works anyway.
  • I was yet unable to compile wpa_passphrase, therefore you unfortunately need access to a linux box that has it to create your PSK key
  • You can't use wget to fetch the package from mega. You need to download it and move it to your coindesk using scp (in linux terminal: scp coindesk-wlan-package-1.0.tar.gz root@IP-OF-YOUR-MINER:/home/root) (on windows use WinSCP)



Cross compiled binaries

coindesk-wlan-package-1.0.tar.gz at (1,5 MB, @mega)

Includes:
  • wpa_supplicant binary
  • wlan-tools binary + 1 library file
  • init-wlan script for if-pre-up to start wpa_supplicant on ifup

Binaries compiled using:
  • arm-bcm2708-linux-gnueabi-cc
  • arm-bcm2708-linux-gnueabi-gcc

See at the bottom: "Helpful ressources - 4. Setup cross compiler for raspberry on linux" to get a starting point to compile everything on your own. Good luck. Smiley



Optional step - wlan-tools:

1. Unzip package:

root@raspberrypi:~# tar xvzf coindesk-wlan-package-1.0.tar.gz

2. Change to new dir

root@raspberrypi:~# cd package

3. copy library to /usr/lib

root@raspberrypi:~# cp libiw.so.29 /usr/lib

4. copy binaries to /usr/bin

root@raspberrypi:~# cp iw* /usr/bin

See "1. Quick overview on wifi-tools:" at the bottom for some basic info about the binaries.
The most interesting would probably be:
root@raspberrypi:~# iwlist scan
root@raspberrypi:~# iwconfig



Steps - connecting with WPA2 auth:

1. Unzip package:

root@raspberrypi:~# tar xvzf coindesk-wlan-package-1.0.tar.gz

2. Change to new dir

root@raspberrypi:~# cd package

3. Copy wpa_supplicant to /usr/bin

root@raspberrypi:~# cp wpa_supplicant /usr/bin

4. Make sure it's executeable:

root@raspberrypi:~# chmod +x /usr/bin/wpa_supplicant

5. Configure /etc/network/interfaces

root@raspberrypi:~# vi /etc/network/interfaces

(press insert to toggle between read, insert, replace mode. mode is displayed in bottom left (none, "I", "R")
(when in read mode, write :q to exit, :wq to write and exit, :q! to exit without saving changes)

There should be a wlan section at the top already. Change it to this:
Code:
# Wireless interfaces
auto wlan0          
iface wlan0 inet dhcp        
        wireless_mode managed    
        wireless_essid YOUR_NETWORK_SSID
        wpa-driver wext                  
        wpa-roam /etc/wpa_supplicant.conf

Replace YOUR_NETWORK_SSID with the SSID of your wireless network.
Save changes and close editor.

6. Create your PSK key

Get to a linux box with installed wpa_supplicant and run:
user@boxwithwpa:~# wpa_passphrase YOUR_NETWORK_SSID YOUR_NETWORK_PASSWORD

It should output something like this:
Code:
network={
ssid="my_network"
#psk="mypass123"
psk=2ee48ed09b145a41c63b9afb98b517fe9826cde0d5990cea6d1a686560ff23b3
}
Copy the long string after psk=

7. Create /etc/wpa_supplicant.conf

root@raspberrypi:~# vi /etc/wpa_supplicant.conf

Insert this:
Code:
network={
ssid="YOUR_NETWORK_SSID_AS_IN_STEP_6"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk=YOUR_COPIED_PSK_KEY_FROM_STEP_6
}

Replace the stuff in UPPERCASE.
This is for WPA2/Personal with AES. If you have a different setting (check with wlan-tools: iwlist scan), you need to modify this. Check at the bottom "Helpful ressources - 2. Different configuration settings for different encryptions" to get an idea about the different settings.



At this point you should be able to log in to your network and receive an IP with these steps:

1. shut down wlan0:
root@raspberrypi:~# ifconfig wlan0 down

2. start wpa_supplicant:
root@raspberrypi:~# wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf

(It will throw an warning/error about ioctl, don't care...)

3. start up wlan0:
root@raspberrypi:~# ifup wlan0

udhcpc should start discovering your network, it then should receive an IP and you're in.
Verify with:

root@raspberrypi:~# ifconfig

There should be a wlan0 interface that has an IP.



For me this was not enought to make it start up on boot, I needed to add a if-pre-up script to make sure wpa_supplicant is up and running before udhcpc starts to fetch an IP.
Copy the script provided in the package to /etc/network/if-pre-up.d/:

root@raspberrypi:~# cp init-wlan /etc/network/if-pre-up.d/

Make sure it's executable:

root@raspberrypi:~# chmod +x /etc/network/if-pre-up.d/init-wlan

Leave the cable in, do a reboot and check with ifconfig if the wlan0 interface has started up and if it has an IP.
If it does, write down the wlan0 IP, remove the cable, reboot and you're clear to go.



Helpful ressources:

1. Quick overview on wifi-tools:
https://rasspberrypi.wordpress.com/2012/09/09/wifi-tools-for-raspberry-pi/

2. Different configuration settings for different encryptions:
http://ubuntuforums.org/showthread.php?t=318539
Note: Scroll down, there are multiple sections for various encryption types. Of interest are these lines:
Quote
wpa-proto XYZ
wpa-pairwise XYZ
wpa-group XYZ
wpa-key-mgmt XYZ
To use the settings, remove the "wpa-" part and copy it to/replace it in your /etc/wpa_supplicant.conf.

3. Explanation of wpa_supplicant (German)
http://wiki.ubuntuusers.de/WLAN/wpa_supplicant

4. Setup cross compiler for raspberry on linux
http://stackoverflow.com/questions/19162072/installing-raspberry-pi-cross-compiler/19269715#19269715



Updates

Fix display of IP

Backup minerosd.py, just in case.
root@raspberrypi:~# cp /mineros/minerosd.py /mineros/minerosd.py.bck

Edit minerosd.py:
root@raspberrypi:~# vi /mineros/minerosd.py

Change this:
Code:
def GetIP():                                                                                                        
        ifreq = struct.pack('16sH14s', 'eth0', socket.AF_INET, '\x00'*14)

to this:
Code:
def GetIP():                                                                                                        
        ifreq = struct.pack('16sH14s', 'wlan0', socket.AF_INET, '\x00'*14)

If you're feeling fancy and know python, you could modify this part to first check for ethernet and then fall back to wireless.
Don't touch the rest. Save, exit, reboot.



Please let me know if this was helpful for you.
And just in case that you're feeling generous: 1KZa4QediT8TUx5vF4UXzuJhqWPYAhd3P9

Good luck! Smiley
Jump to: