Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Scripting wpa_supplicant for multi-profile selection Post 303041444 by Techbart on Sunday 24th of November 2019 08:23:11 AM
Old 11-24-2019
Scripting wpa_supplicant for multi-profile selection

Hi all. So, first of all my apologies for the noob question. I've searched around for a way to make use of bash arrays to perform what I need, but I'm struggling to understand which method would be better.

So, I'm looking to get a bit more comfortable with scripting, hoping to use wpa_supplicant as an ideal usecase. I know it can handle multiple wpa passphrase profiles by itself just fine, but figured I'd take this opprutunity to make my own multi-profile script.

The aim is to have a basic script which contains references to the various wpa passphrase configs I have setup, and have it provide a list of available profiles to shell, which I can select as required.

What I have in mind, is to declare a base variable for the wpa_suppplicant and arguments, then havethe script choose from an array which wpa passphrase to use. Below are the full strings I'm aiming to use, but I imagine this can be simplified:

Code:
#Home
wpa_Home="wpa_supplicant -B -c /etc/wpa_Home.conf -i wlp1s0"
#Anne
wpa_Anne="wpa_supplicant -B -c /etc/wpa_Anne.conf -i wlp1s0"
#Emilia
wpa_Emilia="wpa_supplicant -B -c /etc/wpa_Emilia.conf -i wlp1s0"

I'd imagine it would make more sense to declare the wpa_supplicant paramater with arguments, and have a means of choosing from the available wpa passphrase configs. Could I ask one of you wonderful peeps if you have some ideas on how to achieve this? Cheers!
 

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_PRIV(8)															       WPA_PRIV(8)

NAME
wpa_priv - wpa_supplicant privilege separation helper SYNOPSIS
wpa_priv [ -c ctrl path ] [ -Bdd ] [ -P pid file ] [ driver:ifname [driver:ifname ...] ] OVERVIEW
wpa_priv is a privilege separation helper that minimizes the size of wpa_supplicant code that needs to be run with root privileges. If enabled, privileged operations are done in the wpa_priv process while leaving rest of the code (e.g., EAP authentication and WPA hand- shakes) to operate in an unprivileged process (wpa_supplicant) that can be run as non-root user. Privilege separation restricts the effects of potential software errors by containing the majority of the code in an unprivileged process to avoid the possibility of a full system compromise. wpa_priv needs to be run with network admin privileges (usually, root user). It opens a UNIX domain socket for each interface that is included on the command line; any other interface will be off limits for wpa_supplicant in this kind of configuration. After this, wpa_sup- plicant can be run as a non-root user (e.g., all standard users on a laptop or as a special non-privileged user account created just for this purpose to limit access to user files even further). EXAMPLE CONFIGURATION
The following steps are an example of how to configure wpa_priv to allow users in the wpapriv group to communicate with wpa_supplicant with privilege separation: Create user group (e.g., wpapriv) and assign users that should be able to use wpa_supplicant into that group. Create /var/run/wpa_priv directory for UNIX domain sockets and control user access by setting it accessible only for the wpapriv group: mkdir /var/run/wpa_priv chown root:wpapriv /var/run/wpa_priv chmod 0750 /var/run/wpa_priv Start wpa_priv as root (e.g., from system startup scripts) with the enabled interfaces configured on the command line: wpa_priv -B -c /var/run/wpa_priv -P /var/run/wpa_priv.pid wext:wlan0 Run wpa_supplicant as non-root with a user that is in the wpapriv group: wpa_supplicant -i ath0 -c wpa_supplicant.conf COMMAND ARGUMENTS
-c ctrl path Specify the path to wpa_priv control directory (Default: /var/run/wpa_priv/). -B Run as a daemon in the background. -P file Set the location of the PID file. driver:ifname [driver:ifname ...] The <driver> string dictates which of the supported wpa_supplicant driver backends is to be used. To get a list of supported driver types see wpa_supplicant help (e.g, wpa_supplicant -h). The driver backend supported by most good drivers is wext. The <ifname> string specifies which network interface is to be managed by wpa_supplicant (e.g., wlan0 or ath0). wpa_priv does not use the network interface before wpa_supplicant is started, so it is fine to include network interfaces that are not available at the time wpa_priv is started. wpa_priv can control multiple interfaces with one process, but it is also possible to run multiple wpa_priv processes at the same time, if desired. SEE ALSO
wpa_supplicant(8) LEGAL
wpa_supplicant is copyright (c) 2003-2012, Jouni Malinen <j@w1.fi> and contributors. All Rights Reserved. This program is licensed under the BSD license (the one with advertisement clause removed). 09 June 2014 WPA_PRIV(8)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy