DECRUX
Posts: 6
Joined: Wed May 20, 2015 9:39 pm

[Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Wed May 20, 2015 10:25 pm

*UPDATE 17-06-2016*
I just tested this guide on the latest version of RASPBIAN JESSIE (same hardware), and it worked just fine. It's worth mentioning that I wasn't able to get it to run on the lite version though. I have no idea why it won't work there, so maybe someone else with more knowledge can give that a shot. Until then, just use the bulkier version here : https://www.raspberrypi.org/downloads/raspbian/

Good luck.
*UPDATE*


This is my first post, and I'm new to the magic world of Raspberry Pi. My knowledge is rather limited. So, please, be gentle with me :?

After hours of searching I couldn't find a working walk-through/solution, that helped me to connect my Pi to a PEAP/MSCHAPV2 network. So, I started using the limited knowledge I have on networking and linux to create a solution, that worked for me at least.


Used hardware, all running on the Pi, out of the box :
- Raspberry Pi 2B
- 16GB MicroSD card
- TP-LINK WN822N USB Network Card
- Logitech K220, wireless keyboard & mouse


Used OS / Firmware
- 2015-05-05-raspbian-wheezy.zip
- NOOBS



The Procedure

First of all, open a shell and make sure you're root (I'm not sure this is required on Pi, but I'm using to it to avoid problems with authorization.):

Code: Select all

sudo -s


Now, for the actual scripting and coding fun:


1.
Run

Code: Select all

ifconfig -a
and check that you see a wlan0 device.

2.
Edit “/etc/wpa_supplicant/wpa_supplicant.conf”.

Code: Select all

nano /etc/wpa_supplicant/wpa_supplicant.conf


It should contain (if not, make sure it looks similar):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="NETWORKNAME"
priority=1
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN
eap=PEAP
identity="USERNAME"
password="PASSWORD"
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}
3.
Replace "NETWORKNAME" with the network your wish to connect to

4.
Replace "USERNAME" with your account name

5.
Don’t replace "PASSWORD" yet!! We will replace it with an MD4 hash generated password. Create it like this:

Code: Select all

echo -n 'YOUR_REAL_PASSWORD' | iconv -t utf16le | openssl md4 > hash.txt
Replace "YOUR_REAL_PASSWORD" with, well,... your real password.

The content of hash.txt should look similar to the folowing:
(stdin)= a6fsfs71xxxxxxxxxxxxxxxetcetcetc
6.
Edit “/etc/wpa_supplicant/wpa_supplicant.conf” using the nano editor.

Code: Select all

nano /etc/wpa_supplicant/wpa_supplicant.conf


Go to the line where the password should be inserted. Use Control-R to insert the hash.txt file.
Replace
password="PASSWORD"
with
password=hash:a6fsfs71xxxxxxxxxxxxxxxetcetcetc
(your hashed password should be in there of course!)

7. Clear the bash history (security and safety first!):

Code: Select all

     history -w
     history -c
--------------------

And that should be it. It worked like a charm for me, but I can imagine your results might be different. I hope this might at least be helpful to those that are looking for a similar solution, and that it can save newbies like me some time, and prevent heads from being smashed into keyboards.

Good luck!



--2017-06-10--

I'd like to thank everyone for commenting and adding additional information. I'm a bit blown away by the amount of nice feedback I've received. That's beyond my expectations, and it has been polishing my ego quite a bit :lol:

Thanks again everyone, and sorry for not being able to reply to every individual question or comment. Life's hectic when you're me.
Last edited by DECRUX on Sat Jun 10, 2017 9:24 am, edited 3 times in total.

googlebleh
Posts: 1
Joined: Wed Mar 09, 2016 2:17 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Wed Mar 09, 2016 2:20 am

Holy crap.

I'm a university student who's been struggling with this problem trying to connect to my school's PEAP/MSCHAPV2 network for months.

Just like you created an account just to post the solution to this problem, I created an account just to express my sincerest gratitude. May you live long and prosper.

DECRUX
Posts: 6
Joined: Wed May 20, 2015 9:39 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Tue Mar 15, 2016 6:16 pm

I'm glad I've been able to help at least one person then (two if I include myself). I know it can be frustrating to get PEAP/MSCHAPV2 up and running.

Thanks for the comment. It's really appreciated. :D

SamuelWN
Posts: 1
Joined: Sun Jan 31, 2016 3:51 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Sat Mar 19, 2016 12:16 am

I'm in the same situation as @googlebleh, and @DECRUX, you absolutely, without a doubt, saved my sanity.

THANK YOU

JoeyTheITguy
Posts: 1
Joined: Thu May 05, 2016 8:34 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu May 05, 2016 8:40 pm

Over a year after your post and this is still useful. Just like @googlebleh I had to create an account just to say thank you so much for this! You saved me a lot of time and effort!

benutne
Posts: 1
Joined: Mon Aug 01, 2016 2:45 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Mon Aug 01, 2016 2:47 pm

Just made an account to say thanks for the post. I was able to successfully connect to our universities WiFi network with your instructions. Great work.

fatatra
Posts: 2
Joined: Thu Oct 20, 2016 11:10 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu Oct 20, 2016 11:16 am

Hi, Thanks for your post, My apologizes for being a newbie, but what should happen after step 7, in my case, i reboot but i still have no connection ???
Cheers

cslamo
Posts: 1
Joined: Thu Oct 27, 2016 3:45 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu Oct 27, 2016 3:47 pm

I just registered to say THANK YOU! :D :D :D :D :D

mshah
Posts: 7
Joined: Wed Nov 30, 2016 2:49 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Wed Nov 30, 2016 4:21 pm

can you please show the interfaces file. I followed the instructions but it still didn't work. It might be because of the chances i made in /etc/network/interfaces

tyfoid-kid
Posts: 1
Joined: Wed Apr 20, 2016 2:57 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu Dec 01, 2016 2:38 pm

This also worked for my eduroam setup at the University here with multiple wireless networks. Great stuff.

DECRUX
Posts: 6
Joined: Wed May 20, 2015 9:39 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Fri Dec 30, 2016 3:36 pm

Thanks everyone. I've been rocking this configuration ever since I started the topic, and it's still working without any issues.

Thanks for all the kindness everyone! Appreciate it!


@fatatra : I'm not sure why yours won't connect. I've tried this in several different situations now, and it never failed.

notram
Posts: 2
Joined: Fri Jan 06, 2017 11:44 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Fri Jan 06, 2017 12:06 pm

Thank you. Another successful connection to eduroam, and a freshly registered user.

@mshah here is a dump of my /etc/wpa_supplicant/wpa_supplicant.conf:
(For obvious reasons I replaced the middle half of my hash value with '-', and my identitiy with a fake one)

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
       ssid="eduroam"
       priority=1
       proto=RSN
       key_mgmt=WPA-EAP
       pairwise=CCMP
       auth_alg=OPEN
       eap=PEAP
       identity="myusername"
       password=hash:a0-----------------------------------------------7d
       phase1="peaplabel=0"
       phase2="auth=MSCHAPV2"
}
and the /etc/network/interfaces

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
And I also had to renew my IP a few times with

Code: Select all

sudo dhclient -v -r wlan0
sudo dhclient -v wlan0

thisis17character
Posts: 1
Joined: Wed Mar 08, 2017 11:40 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Wed Mar 08, 2017 11:43 pm

i just registered to say thanks for ur help :D

Ray 23
Posts: 1
Joined: Thu Mar 30, 2017 9:14 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu Mar 30, 2017 9:26 am

Hi I am new here and to raspberry pi. I work at a school and need the raspberry to access our network. I was directed here by one of our IT guys so as to solve the problem we have, ie need to logon to network with username and password.
I have followed the instructions to the point of "echo -n 'YOUR_REAL_PASSWORD' | iconv -t utf16le | openssl md4 > hash.txt".
However I must be doing something wrong (I have entered correct password for the network) because I get nothing back.
Can you help

Many thanks

Ray

Bloomfield
Posts: 1
Joined: Sat Apr 01, 2017 12:57 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Sat Apr 01, 2017 1:02 pm

Hello, I'm a fellow college student trying to do this at the moment because I'd much rather have my one ethernet port in my dorm dedicated to my desktop rather than my raspberry pi :lol: However I ran into a problem.

Whenever I get to the part where I type in

echo -n "mypassword" | iconv -t utf161e | openssl md4 > hash.txt

the response I get is

iconv: conversion to utf161e is not supported

is there anyway around this? Apologies if I seem somewhat illiterate in terms of coding, I study Biochemistry :)

I should also mention that my password does in fact have a " ? " in it. I suspect this might have something to do with this.


Edit here: I apologize, this was a stupid mistake on my part. I assumed there were 2 of the number ones in "utf16le". I can't thank you again for doing this though.

sanglems
Posts: 5
Joined: Mon Apr 10, 2017 6:58 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Thu Apr 20, 2017 6:45 am

I took more time to search for it than implementing it with this post!
Amazing.
Worked so smoothly.
Thanks!

ONECore
Posts: 1
Joined: Wed Apr 26, 2017 3:05 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Mon May 22, 2017 1:50 pm

The stated tutorial didn't directly work for me at the University of Coloardo Denver, Anschutz Medical Campus, but it did help me getting a working system going. I thought I'd share my steps.

You can (probably) connect directly to the UC Anschutz Guest network directly, but Linux will not take you to the required Connect / “Accept our terms” page so you will not be able to access anything. Use the graphical interface to connect to UCAnshutz Guest (top right corner) and then open your favorite web browser and hit up: https://ucdenver-wireless.ucdenver.edu/login.html and click accept. Book mark the site for ease with future connections.

For the more stable UC Anschutz wireless:

In the terminal:
#Do an update, why not (obviously only when connected to internet (try UC Anschutz Guest as above)):
sudo apt-get update

#This next step is only necessary if you are on a public machine, but it’s a good idea anyhow: Create a hash password (replace YOUR_REAL_PASSWORD with, well, your password) (note the utf16le is numbers ‘16’ followed by letters ‘le’).
sudo echo -n 'YOUR_REAL_PASSWORD' | iconv -t utf16le | openssl md4 > hash.txt
# Open the file to view the file to view and copy the hash password (select the long hash code, ctrl shift c to copy). Exit with ctrl x.
sudo nano hash.txt
#Delete the hash.txt file, if you want. It doesn’t store your original password, but keep a clean system
sudo rm hash.txt

#Edit your wireless config file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

#There should be some lines on top. You can replace country with US if you’d like but it’s not necessary.
country=US

#If you connected to UC Anschutz Guest, you should see that already. Do nothing here.
network={
ssid="CU Anschutz Guest"
key_mgmt=NONE
}

#Add the UC Anschutz wireless by adding this below (update your email and password). By setting priority to 1, it will attempt to connect to this before other networks. Higher priority numbers are attempted first. Defaults to zero.):
network={
ssid="CU Anschutz"
key_mgmt=WPA-EAP
eap=PEAP
identity="firstname.lastname@ucdenver.edu
password=hash:PasteTheHashPasswordHere
phase2="auth=MSCHAPV2"
priority=1
}

#save the file with ctrl x, Y, enter

#leave no trace
history -w
history -c
clear

#reboot
sudo reboot

?
Profit

DECRUX
Posts: 6
Joined: Wed May 20, 2015 9:39 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Sat Jun 10, 2017 9:28 am

ONECore wrote:The stated tutorial didn't directly work for me at the University of Coloardo Denver, Anschutz Medical Campus, but it did help me getting a working system going. I thought I'd share my steps....
Thank you so much for adding this. I'm sure the additional information can point other people with similar configurations into the right direction. Great job!

sajidmc
Posts: 1
Joined: Mon Nov 20, 2017 9:13 pm

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Mon Nov 20, 2017 9:17 pm

Hi,

I am having difficulty with connecting to eduroam. I created the wpa_supplicant.conf file as instructed. After rebooting the computer, the connection to wireless network is completely empty. Mouseover to the icon shows "wlan0: Not associated"

Did anyone else have similar issues?

Thanks

nickshoe
Posts: 1
Joined: Wed Dec 13, 2017 11:52 am

Re: [Tutorial] Setup Raspberry Pi - PEAP/MSCHAPV2 conne

Wed Dec 13, 2017 12:10 pm

Thank you!

This configuration is working with my University WiFi network:

Code: Select all

network={
        ssid="ALMAWIFI"
        proto=RSN
        key_mgmt=WPA-EAP
        auth_alg=OPEN
        eap=PEAP
        identity="<EMAIL>"
        password=hash:<PASSWORD_MD4_HASH>
        phase1="peaplabel=0"
        phase2="auth=MSCHAPV2"
        priority=1
}
Replacing <EMAIL> with my university email address, and <PASSWORD_MD4_HASH> as indicated in the original post.

Return to “Networking and servers”

Who is online

Users browsing this forum: Gadgetguy and 11 guests