WPA Verschlüsselung

Diese Anleitung setzt die Kentniss folgender Seiten voraus:

  1. [1]: Installation von Programmen
  2. [2]: Bearbeiten von Paketquellen


Um für WLAN (Wireless LAN) die WPA-PSK verschlüsselung nutzen zu können, muß erst das Paket wpa_supplicant installiert[1] werden. Dazu muss zunächst die Sektion universe freigeschaltet[2] sein.

Sobald dies installiert wurde, muss erst mal die Datei /etc/wpa_supplicant.conf von Hand angelegt werden mittels Eingabe von

sudo touch /etc/wpa_supplicant.conf

in einem Terminal. Danach muß mittels

sudo wpa_passphrase <SSID des Netzes> <WPA Schlüssel>

ein verschlüsselter PSK erzeugt werden.

Hier mal meine /etc/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=2
network={
ssid="SID meines Netzes"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP CCMP
psk=Verschlüsselter PSK Key den wir oben erzeugt haben
}

Nun tragen wir in die Datei /etc/default/wpasupplicant folgendes ein:

# /etc/default/wpasupplicant
# WARNING! Make sure you have a configuration file!
ENABLED=1
# Useful flags:
# -D <driver> Wireless Driver
# -i <ifname> Interface (required, unless specified in config)
# -c <config file> Configuration file
# -d Debugging (-dd for more)
# -w Wait for interface to come up
OPTIONS="-w -i ath0 -D madwifi -B"

“ath0” und “madwifi” muß durch eure Schnittstelle und Treiber ersetzt werden.

Ganz wichtig: Enabled auf 1 setzen

Dadurch kann man später mittels

sudo /etc/init.d/wpa_supplicant {start|stop|restart}

den Dienst stoppen, starten usw.

Damit das ganze auch beim Starten des Rechners automatisch passiert, muss man folgendes in seine /etc/network/interfaces eintragen: (Hier mal meine /etc/network/interfaces)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
script grep
map eth0
# The primary network interface
auto ath0
# WLAN
iface ath0 inet dhcp
pre-up /usr/sbin/wpa_supplicant -D madwifi -i ath0 -c /etc/wpa_supplicant.conf -Bw
post-down killall -q wpa_supplicant

Ganz wichtig sind die letzten beiden Zeilen! “ath0” und “madwifi” muß wie oben schon durch eure Daten ersetzt werden.

PS: In diesem Fall hab ich DHCP benutzt.

geschrieben von Logdog82

Version B (Quelle: https://wiki.ubuntu.com/WPAHowto)

#!/bin/sh

WPA_INIT_SCRIPT=/etc/init.d/wpasupplicant
WPA_CLI=/usr/sbin/wpa_cli

if [ ! -x $WPA_INIT_SCRIPT ]; then
exit 0
fi

if [ -n "$IF_WIRELESS_WPA" ]; then
$WPA_INIT_SCRIPT start

# this part can be left out but its prevents a potentially longer DHCP timeout
# from occurring while wpa supplicant is still starting its search.
TIMEOUT=10
INTERVAL=1
STATUS=1
# Try to authenticate for $TIMEOUT secs
sleep $INTERVAL
while [[ $STATUS == 1 && $TIME -lt $TIMEOUT ]]
do
$WPA_CLI status | grep AUTHENTICATED > /dev/null
STATUS=$?
TIME=$(($TIME + $INTERVAL))
sleep $INTERVAL
done
fi
#!/bin/sh

WPA_INIT_SCRIPT=/etc/init.d/wpasupplicant

if [ ! -x $WPA_INIT_SCRIPT ]; then
exit 0
fi

if [ -n "$IF_WIRELESS_WPA" ]; then
$WPA_INIT_SCRIPT stop
fi
OPTIONS="-w -D madwifi -i ath0 -c /etc/wpa_supplicant.conf
wpa_passphrase <SSID> <wpa passwort>
network={
ssid="SSID"
#psk="wpa Passwort"
psk="verschlüßeltes WPA-Passwort"
}
network={
ssid="SSID"
proto=WPA
scan_ssid=1
key_mgmt=WPA-PSK
psk="verschlüßeltes WPA-Passwort"
}
iface ath0 inet dhcp
wireless-wpa foo
auto ath0
geändert von elektranox