Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Scripting wpa_supplicant for multi-profile selection Post 303041446 by Techbart on Sunday 24th of November 2019 09:49:55 AM
Old 11-24-2019
Some progress. Managed to create a basic indexed array and have it print all contents to shell per following:

Code:
#!/bin/bash
# WPA Profiles

#Home
wpa_Profile[0]="wpa_supplicant -B -c /etc/wpa_Home.conf -i wlp1s0"
#Anne
wpa_Profile[1]="wpa_supplicant -B -c /etc/wpa_Anne.conf -i wlp1s0"
#Emilia
wpa_Profile[2]="wpa_supplicant -B -c /etc/wpa_Emilia.conf -i wlp1s0"

for i in "${wpa_Profile[*]}"; do echo "$i"; done

What I'm stuck with now is finding away to interactively read from shell and either output or execute a specific index. As mentioed earlier, I guess the array should contain only references to the wpa passphrase, which can then be joined to a standard wpa_supplicant + arguments...one step at a time though I s'pose Smilie.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

multi-file multi-edit

Good day! I am trying to learn how to use the "sed" editor, to perform multiple edits on multiple files in multiple directories. I have one script that tries to call up each file and process it according to the edits listed in a second script. I am using a small input text to test these, at... (12 Replies)
Discussion started by: kielitaide
12 Replies

2. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies

3. UNIX for Dummies Questions & Answers

Multi User Multi Task

Dear Experts Why we always hear that unix operating system is Multi User and Multi task. What does these two means. I have looked at some books and documents but couldn't find aclear explenation. Can we say Windows operating system is also multi user and multi task?? Thanks for your help in... (6 Replies)
Discussion started by: Reza Nazarian
6 Replies

4. Shell Programming and Scripting

hi..all..pls...help..!!..profile scripting..

hi.. I want to customize a user in unix which could have only ftp access and NO TELNET ACCESS! ..... As being a newbie to unix to my understanding the user .profile has to be edited but if someone can explain how to edit it so that i can block telnet access for that user.....Is /etc/profile has... (5 Replies)
Discussion started by: rookie250
5 Replies

5. Infrastructure Monitoring

trap in etc/profile and user .profile

Hello I really wonder what's trap in etc/profile and in each user .profile. I try to google for it but I think I have no luck. Mostly hit is SNMP traps which I think it is not the same thing. I want to know ... 1. What's a "trap 2 3" means and are there any other value I can set... (4 Replies)
Discussion started by: Smith
4 Replies

6. Shell Programming and Scripting

How to substract selective values in multi row, multi column file (using awk or sed?)

Hi, I have a problem where I need to make this input: nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b look like this output: nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
Discussion started by: nricardo
4 Replies

7. Programming

Multi head/multi window hello world

I am trying to write a large X app. I have successfully modified my xorg.conf to setup 4 monitors on an NVIDIA Quatro5200. I am trying to modify a simple hello world application to open a window on three of the four monitors. depending on the changes to loop the window creation section and event... (2 Replies)
Discussion started by: advorak
2 Replies

8. BSD

FreeBSD DHCP wpa_supplicant Wi-Fi Issues

I just got FreeBSD up and running with an XFCE desktop on an old Gateway laptop. It works great, except the wireless setup is scaring me. I can connect to my home WiFi fine most of the time, but I'm concerned about other WiFi that I will need to connect to away from home. I understand that I can... (1 Reply)
Discussion started by: BrentBANKS
1 Replies

9. Shell Programming and Scripting

Multi pattern selection

I'm confused with what to use (awk or grep) in this case as i need to select 2 corresponding patterns. "SName" & "ESys" in a appln config file which looks like this; SName=abc123 ESys=xyz456 Host=xxx Port=yyy I used awk and didn't get any output for multi-pattern search. $ awk -F"="... (7 Replies)
Discussion started by: sam_bd
7 Replies

10. Shell Programming and Scripting

Help with reformat single-line multi-fasta into multi-line multi-fasta

Input File: >Seq1 ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD >Seq2 SDASDAQEQWEQeqAdfaasd >Seq3 ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG ...... Desired Output File >Seq1 ASDADAFASF ASFADGSDGF SDFSDFSDFS DFSDFSDFSD FSDFSDFSDF SD >Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies
WPA_SUPPLICANT.CONF(5)													    WPA_SUPPLICANT.CONF(5)

NAME
       wpa_supplicant.conf - configuration file for wpa_supplicant

OVERVIEW
       wpa_supplicant  is  configured using a text file that lists all accepted networks and security policies, including pre-shared keys. See the
       example configuration file, probably in /usr/share/doc/wpa_supplicant/, for detailed information about the configuration  format  and  sup-
       ported fields.

       All  file  paths  in  this  configuration file should use full (absolute, not relative to working directory) path in order to allow working
       directory to be changed. This can happen if wpa_supplicant is run in the background.

       Changes to configuration file can be reloaded be sending SIGHUP	signal	to  wpa_supplicant  ('killall  -HUP  wpa_supplicant').	Similarly,
       reloading can be triggered with the wpa_cli reconfigure command.

       Configuration  file can include one or more network blocks, e.g., one for each used SSID. wpa_supplicant will automatically select the best
       network based on the order of network blocks in the configuration  file,  network  security  level  (WPA/WPA2  is  preferred),  and  signal
       strength.

QUICK EXAMPLES
       1. WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work network.

	  # allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  #
	  # home network; allow all valid ciphers
	  network={
	       ssid="home"
	       scan_ssid=1
	       key_mgmt=WPA-PSK
	       psk="very secret passphrase"
	  }
	  #
	  # work network; use EAP-TLS with WPA; allow only CCMP and TKIP ciphers
	  network={
	       ssid="work"
	       scan_ssid=1
	       key_mgmt=WPA-EAP
	       pairwise=CCMP TKIP
	       group=CCMP TKIP
	       eap=TLS
	       identity="user@example.com"
	       ca_cert="/etc/cert/ca.pem"
	       client_cert="/etc/cert/user.pem"
	       private_key="/etc/cert/user.prv"
	       private_key_passwd="password"
	  }

       2. WPA-RADIUS/EAP-PEAP/MSCHAPv2	with RADIUS servers that use old peaplabel (e.g., Funk Odyssey and SBR, Meetinghouse Aegis, Interlink RAD-
	  Series)

	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  network={
	       ssid="example"
	       scan_ssid=1
	       key_mgmt=WPA-EAP
	       eap=PEAP
	       identity="user@example.com"
	       password="foobar"
	       ca_cert="/etc/cert/ca.pem"
	       phase1="peaplabel=0"
	       phase2="auth=MSCHAPV2"
	  }

       3. EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the unencrypted use. Real identity is sent only within an encrypted
	  TLS tunnel.

	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  network={
	       ssid="example"
	       scan_ssid=1
	       key_mgmt=WPA-EAP
	       eap=TTLS
	       identity="user@example.com"
	       anonymous_identity="anonymous@example.com"
	       password="foobar"
	       ca_cert="/etc/cert/ca.pem"
	       phase2="auth=MD5"
	  }

       4. IEEE 802.1X (i.e., no WPA) with dynamic WEP keys (require both unicast and broadcast); use EAP-TLS for authentication

	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  network={
	       ssid="1x-test"
	       scan_ssid=1
	       key_mgmt=IEEE8021X
	       eap=TLS
	       identity="user@example.com"
	       ca_cert="/etc/cert/ca.pem"
	       client_cert="/etc/cert/user.pem"
	       private_key="/etc/cert/user.prv"
	       private_key_passwd="password"
	       eapol_flags=3
	  }

       5. Catch  all example that allows more or less all configuration modes. The configuration options are used based on what security policy is
	  used in the selected SSID. This is mostly for testing and is not recommended for normal use.

	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  network={
	       ssid="example"
	       scan_ssid=1
	       key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
	       pairwise=CCMP TKIP
	       group=CCMP TKIP WEP104 WEP40
	       psk="very secret passphrase"
	       eap=TTLS PEAP TLS
	       identity="user@example.com"
	       password="foobar"
	       ca_cert="/etc/cert/ca.pem"
	       client_cert="/etc/cert/user.pem"
	       private_key="/etc/cert/user.prv"
	       private_key_passwd="password"
	       phase1="peaplabel=0"
	       ca_cert2="/etc/cert/ca2.pem"
	       client_cert2="/etc/cer/user.pem"
	       private_key2="/etc/cer/user.prv"
	       private_key2_passwd="password"
	  }

       6. Authentication for wired Ethernet. This can be used with wired or roboswitch interface (-Dwired or -Droboswitch on command line).

	  ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
	  ap_scan=0
	  network={
	       key_mgmt=IEEE8021X
	       eap=MD5
	       identity="user"
	       password="password"
	       eapol_flags=0
	  }

CERTIFICATES
       Some EAP authentication methods require use of certificates. EAP-TLS uses both server side and client  certificates  whereas  EAP-PEAP  and
       EAP-TTLS  only require the server side certificate. When client certificate is used, a matching private key file has to also be included in
       configuration. If the private key uses a passphrase, this has to be configured in wpa_supplicant.conf ("private_key_passwd").

       wpa_supplicant supports X.509 certificates in PEM and DER formats. User certificate and private key can be included in the same file.

       If the user certificate and private key is received in PKCS#12/PFX format, they need  to  be  converted	to  suitable  PEM/DER  format  for
       wpa_supplicant. This can be done, e.g., with following commands:

	      # convert client certificate and private key to PEM format
	      openssl pkcs12 -in example.pfx -out user.pem -clcerts
	      # convert CA certificate (if included in PFX file) to PEM format
	      openssl pkcs12 -in example.pfx -out ca.pem -cacerts -nokeys

SEE ALSO
       wpa_supplicant(8) openssl(1)

								 07 November 2012					    WPA_SUPPLICANT.CONF(5)
All times are GMT -4. The time now is 11:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy