Skip to content

Instantly share code, notes, and snippets.

@arthurazs
Last active April 3, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthurazs/a40a0aac420ffb8b5be429a4ca5dd543 to your computer and use it in GitHub Desktop.
Save arthurazs/a40a0aac420ffb8b5be429a4ca5dd543 to your computer and use it in GitHub Desktop.
Xubuntu -> AuthFlow w/ Mininet

Xubuntu

keyboard -> Application Shortcut: xfce4-popup-whiskermenu -> Super L

sudo sed -i '$a arthurazs ALL=(ALL) NOPASSWD:ALL' /etc/sudoers
sed -i '$a alias apt="sudo apt"' ~/.bashrc
source ~/.bashrc
apt update
apt upgrade
apt install tilix

keyboard -> Application Shortcut:

  • exo-open --launch TerminalEmulator -> Remove
  • Add -> tilix -> Ctrl+Alt+T
sed -i '$a if [ $TILIX_ID ] || [ $VTE_VERSION ]; then\n        source /etc/profile.d/vte.sh\nfi' ~/.bashrc
sudo ln -s /etc/profile.d/vte-2.91.sh /etc/profile.d/vte.sh
source ~/.bashrc

Tilix -> Preferences -> Appearance: Theme variant -> Dark

Hostapd

apt install build-essential libssl-dev libnl-3-dev libnl-genl-3-dev pkg-config

FreeRADIUS

sudo apt-mark hold freeradius
sudo /etc/init.d/freeradius stop

Add bob Cleartext-Password := "hello" to the beginning of /etc/freeradius/3.0/users

sudo freeradius -X
radtest bob hello localhost 0 testing123

TODO

virtual entherfaces

apt install bridge-utils
sudo brctl addbr br0
sudo ip link add type veth
sudo ifconfig veth1 up
sudo ifconfig veth0 up
sudo ifconfig br0 up
# sudo brctl addif br0 veth1
# sudo brctl delif br0 veth1
# sudo brctl addif br0 veth0
# sudo brctl delif br0 veth0

wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1

# EAP-PEAP/MSCHAPv2 configuration for RADIUS servers that use the new peaplabel
# (e.g., Radiator)
network={
	ssid="test"
	key_mgmt=IEEE8021X
	eap=PEAP
	identity="bob"
	password="hello"
#	ca_cert="/etc/cert/ca.pem"
	phase1="peaplabel=1"
	phase2="auth=MSCHAPV2"
#	priority=10
}

sudo wpa_supplicant -Dwired -iveth0 -cwpa_supplicant.conf

hostapd.conf

bridge=br0
interface=veth1
driver=wired
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
#debug=4
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
#mudar para 0 para ficar direito --> unicast
#para isso tenho que mudar o script das maquinas virtuais --> configuracao de rede do xen
#use_pae_group_addr=0
use_pae_group_addr=1

#ctrl_interface_group=0
#ssid=test
#auth_algs=3
##### IEEE 802.1X-2004 related configuration ################################## 
ieee8021x=1
#eapol_version=2
#eap_message=hello
#wep_key_len_broadcast=5
#wep_key_len_unicast=5
#wep_rekey_period=300
#eapol_key_index_workaround=0
#eap_reauth_period=3600
#use_pae_group_addr=1
eap_server=0
# The own IP address of the access point (used as NAS-IP-Address) 
own_ip_addr=127.0.0.1
nas_identifier=localhost1
# RADIUS authentication server
auth_server_addr=127.0.0.1
auth_server_port=1812
auth_server_shared_secret=testing123
# RADIUS accounting server
acct_server_addr=127.0.0.1
acct_server_port=1813
acct_server_shared_secret=testing123
radius_retry_primary_interval=600
radius_acct_interim_interval=600
#wpa=1
#wpa_key_mgmt=WPA-EAP 
#wpa_pairwise=TKIP 
#rsn_preauth=1

sudo ./hostapd hostapd.conf

Others

sudo brctl addbr br0
sudo ip link add type veth
sudo ifconfig veth1 up
sudo ifconfig veth0 up
sudo ifconfig br0 up
sudo freeradius -X
sudo ~/AuthFlow/hostapd-2.6-auth/hostapd/./hostapd ~/AuthFlow/hostapd-2.6-auth/hostapd/hostapd.conf
nc -l 10000
sudo wpa_supplicant -D wired -i veth0 -c ~/AuthFlow/wpa_supplicant.conf 

.bashrc

alias veth='sudo brctl addbr br0; sudo ip link add type veth; sudo ifconfig veth1 up; sudo ifconfig veth0 up; sudo ifconfig br0 up'
alias radius='sudo freeradius -X'
alias hostapd='sudo ~/AuthFlow/hostapd-2.6-auth/hostapd/./hostapd ~/AuthFlow/hostapd-2.6-auth/hostapd/hostapd.conf'
alias wpa='sudo wpa_supplicant -D wired -i veth0 -c ~/AuthFlow/wpa_supplicant.conf'

pox

cd ~/AuthFlow; clear; sudo mn --custom custom_topo.py --topo my_topo --mac --controller remote,port=6633 --switch ovs,protocols=OpenFlow10
cd ~/AuthFlow/pox; clear; python pox.py --verbose log.level --DEBUG forwarding.l2_learning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment