selnic/0000770000175000017500000000000013631221066011700 5ustar thomasthomasselnic/Haftungsausschluss0000644000175000017500000000235413500512010015512 0ustar thomasthomasHaftungsausschluss: Das von mir geschriebene Programme "selnic" ist als Bash-Script nur ein Wrapper für verschiedene Linux-Programme. Das Programm selber verändert nicht das installierte Betriebssystem und schreibt/erstellt außer journald-Einträgen, Conf-Files in /etc/wpa_supplicant und einer eigenen Conf in /usr/local/bin keine weiteren Daten. Ich erhebe keinen Anspruch darauf, dass das Programm vollständig fehlerfrei programmiert ist und ich behaupte das auch nicht. Sowohl durch Programmierfehler in meinen Code, wie auch durch vorhandene Fehler in den vom Programm verwendeten Linux-Programmen, sowie durch ggf. zeitgleich auftretende äußere mechanische Einflüsse, wie auch durch den Anwender selber verursacht durch Änderungen am Programm oder durch unsachgemäße oder fehlerhafte Einstellungen oder falsche Parameterübergaben innerhalb des Programme ist Datenverlust möglich, wenn das laufende Programm wegen solcherart unsachgemäßer Manipulation nicht mehr Bestimmungsgemäß arbeiten können. Deshalb schließe ich jede Haftung für Schäden an Software oder Hardware oder Vermögensschäden oder für Datenverlust aus, die durch die Benutzung des Programms selnic enstehen. Die Benutzung des Programms erfolgt auf eigenes Risiko. selnic/etc/0000770000175000017500000000000013140624643012456 5ustar thomasthomasselnic/etc/systemd/0000770000175000017500000000000013140617333014144 5ustar thomasthomasselnic/etc/systemd/system/0000770000175000017500000000000013631220006015460 5ustar thomasthomasselnic/etc/systemd/system/network-is-connect.service0000644000175000017500000000030313407415713022606 0ustar thomasthomas[Unit] Description=thlu:network-is-connect.service: Starts after Network is connected or before disconnected [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/true ExecStop=/bin/true selnic/etc/systemd/system/selnic.service0000644000175000017500000000055113631220006020323 0ustar thomasthomas[Unit] Description=thlu:selnic.service: Connect to Network (Wired or WLAN-SSID) After=basic.target Before=network.target shutdown.target Wants=network.target Conflicts=shutdown.target [Service] Type=simple Environment="TERM=xterm" RemainAfterExit=yes ExecStart=/usr/local/bin/selnic -f ExecStop=/usr/local/bin/selnic -x [Install] WantedBy=multi-user.target selnic/home/0000770000175000017500000000000013140623621012626 5ustar thomasthomasselnic/home/user/0000770000175000017500000000000013631220553013606 5ustar thomasthomasselnic/home/user/Schreibtisch/0000770000175000017500000000000013631220573016222 5ustar thomasthomasselnic/home/user/Schreibtisch/selnic.desktop0000644000175000017500000000032013631220573021070 0ustar thomasthomas[Desktop Entry] Type=Application Name=Networkmanager Comment=Networkmanager Icon=/usr/local/share/Icons/network.png Exec=/usr/bin/pkexec selnic -n Terminal=true StartupNotify=true Name[de_DE]=Network-manager selnic/home/user/.bash_aliases0000644000175000017500000000006513631220553016231 0ustar thomasthomasalias selnic="/usr/bin/pkexec /usr/local/bin/selnic" selnic/usr/0000770000175000017500000000000013140616371012513 5ustar thomasthomasselnic/usr/local/0000770000175000017500000000000013140624037013603 5ustar thomasthomasselnic/usr/local/bin/0000770000175000017500000000000013140615266014357 5ustar thomasthomasselnic/usr/local/bin/selnic0000644000175000017500000016615413630420106015566 0ustar thomasthomas#!/bin/bash #============================================================================================== # selnic = Select NIC and Connect to LAN or WLAN-AP, connect to VPN, process mounts # # Description: Support the handling of Networkinterfaces NIC (eth0 & wlan*) when using # alternating WISP with or without using Networkmounts and OpenVPN # Category : Shell Menu-Tools # Dependencies: dialog, iw, wpasupplicant, isc-dhcp-client, xterm, {/usr/local/bin/mountctl | OpenVPN} # # Script-Name : selnic # Lizenz : GNU General Public License 3 # Written by : TomL*thlu.de Version="3.0 - 05.03.2020" #============================================================================================== # Permissions U G O # /usr/local/bin/selnic root:root 755 RWX R-X- R-X # Usage as root or create Polkit-Authentication for Script and User # # Usage: # Execute manual as root: selnic {options} {-?} # Execute via desktop-starter: pkexec /usr/local/bin/selnic {parms} (Polkit-Authentication needed!) # Possibly aliasing in ~/.bash.rc: alias selnic="pkexec /usr/local/bin/selnic" (dto.) # Possibly via systemd-unit at boot /etc/systemd/system/selnic.service #============================================================================================== # Init some Var's PATH=/usr/sbin:/usr/bin:$PATH PrimaryWlanDevice="" PrimaryEthDevice="" TerminalApp="" TempFileName="/tmp/selnic_answer.$$" TraceFileName="/tmp/selnic_trace.$$" OpenVPNLog="/var/run/openvpn/client.log" SavedSettings="" AutoConnect=false AutoClose=false Favorites=false DoMounts=false RequestSaveSettings=true Hold=false WlanIF=false # Wlan-Interface found? WlanSW=0 # Wlan-Software installed? WlanOK=false # Wlan is OK? Trace=0 # 1 = on, 0 = off TracePID=0 VPNLogPID=0 Quiet=false ConnectTo="" Wait4Key=false CurrUser="" tStart=0 tEnd=0 declare -a iface_type declare -a iface_status declare -a iface_name declare -a iface_ipaddr declare -a iface_linkto declare -a iface_hotkey declare -a wisp_key_type declare -a wisp_key_property declare -a wisp_pwd_request declare -i iface_count declare -i menuopt_count #============================================================================================== TraceOn() { echo "Tracemode is on" >$TraceFileName sleep 2 if [ $Quiet == false ] || [ Wait4Key == true ]; then [[ "$TerminalApp" =~ "xterm" ]] && $TerminalApp -geometry 140x30+10+10 -e "tail $TraceFileName -n 100 --sleep-interval=2 -f --pid=$$" & [[ "$TerminalApp" =~ "urxvt" ]] && $TerminalApp -fg white -bg black -geometry 140x30 -e tail $TraceFileName -n 100 --sleep-interval=2 -f --pid=$$ & TracePID=$! # $! is the PID of the last backgrounded process. fi # $$ is the PID of the current shell. printf "%-30s %-s\n" "TraceOn(1)" "BASHPID=$$ TracePID=$TracePID" >>$TraceFileName printf "%-30s %-s\n" "TraceOn(2)" "TerminalApp=$TerminalApp TraceFileName=$TraceFileName" >>$TraceFileName } #============================================================================================== Trim() { local var="$*" var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters " var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters " echo -n "$var" } #============================================================================================== GetMenuOptPos() # $1 = HotKey to search { local n for ((n=0;n<$menuopt_count;n++)) do if [ "${iface_hotkey[$n]}" == "$1" ]; then return $n fi done return -1 } #============================================================================================== SaveSettings() { ActualSettings="" for ((n=0;n<$iface_count;n++)) do if [ "${iface_status[$n]}" == "on" ]; then ActualSettings="$ActualSettings""$n" fi done GetMenuOptPos "M" if [[ $? -ge 0 ]] && [ "${iface_status[$?]}" == "on" ]; then ActualSettings="$ActualSettings""M" fi ActualSettings=$(Trim "$ActualSettings") (($Trace)) && printf "%-30s %-s\n" "SaveSettings(1)" "ActualSettings=$ActualSettings SavedSettings=$SavedSettings" >>$TraceFileName [ "$ActualSettings" == "$SavedSettings" ] && return dialog --title "Einstellungen" --backtitle "Netzwerk" --yesno "\nSollen die aktuellen Einstellungen gespeichert werden?" 7 60 rc=$? if [ $rc -eq 0 ]; then if [ -z "$ActualSettings" ]; then (($Trace)) && printf "%-30s %-s\n" "SaveSettings(2)" "ActualSettings=$ActualSettings delete $0.conf" >>$TraceFileName rm "$0.conf" else (($Trace)) && printf "%-30s %-s\n" "SaveSettings(3)" "ActualSettings=$ActualSettings Save Settings" >>$TraceFileName echo $ActualSettings >$0.conf fi fi } #============================================================================================== # Build Array-Items from ip->Result and from ls /etc/wpa_supplicant/*.conf GetDefinedInterfaces() { iface_count=0 iface_type=() iface_status=() iface_name=() iface_ipaddr=() iface_linkto=() iface_hotkey=() (($Trace)) && printf "%-30s %-s\n" "GetDefinedInterfaces(1)" "identify existing interfaces" >>$TraceFileName # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Get present Interfaces while read line do type="" if [ -n "$line" ]; then if [ $(cat /sys/class/net/$line/type) -eq 1 ]; then [ -d "/sys/class/net/$line/wireless" ] && type="wlan" || type="eth" fi if [ -n "$type" ]; then iface_name[$iface_count]="$line" iface_status[$iface_count]="off" iface_linkto[$iface_count]="" iface_ipaddr[$iface_count]="" iface_hotkey[$iface_count]="$((iface_count))" iface_type[$iface_count]=$type (($Trace)) && printf "%-30s %-20s %-12s %-12s %-10s\n" "GetDefinedInterfaces(2)" "Add $line" "Type=${iface_type[$iface_count]}" "Status=${iface_status[$iface_count]}" "Count=$iface_count" >>$TraceFileName (( iface_count++ )) fi fi done < <(ip link show | grep state | awk -F ': ' '{ print $2 }' | sort -b -g) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Primary*Devices ggf. korrigieren, wenn nur 1 Wlan-Device exist, falls z.B. UDEV-Regeln mehrere vorhandene Sticks static durchnummerieren eth_index=-1 eth_count=0 wlan_index=-1 wlan_count=0 for ((n=0;n<$iface_count;n++)) do if [ "${iface_type[$n]}" == "eth" ]; then [ -z "$PrimaryEthDevice" ] && PrimaryEthDevice=${iface_name[$n]} [ $eth_index -eq -1 ] && eth_index=$n (( eth_count++ )) elif [ "${iface_type[$n]}" == "wlan" ]; then [ -z "$PrimaryWlanDevice" ] && PrimaryWlanDevice=${iface_name[$n]} [ $wlan_index -eq -1 ] && wlan_index=$n (( wlan_count++ )) fi done [ $eth_count -eq 1 ] && PrimaryEthDevice=${iface_name[$eth_index]} [ $wlan_count -eq 1 ] && PrimaryWlanDevice=${iface_name[$wlan_index]} (($Trace)) && printf "%-30s %-s\n" "GetDefinedInterfaces(3)" "Set PrimaryEthDevice to $PrimaryEthDevice" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "GetDefinedInterfaces(4)" "Set PrimaryWlanDevice to $PrimaryWlanDevice" >>$TraceFileName # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Check /etc/wpa_supplicant/*.conf if $WlanOK; then if [ -n "$(find /etc/wpa_supplicant/*.conf -maxdepth 0 -print 2> /dev/null)" ]; then while read line do line=$(basename "$line") line="${line%'.conf'*}" # Fetch left part before ".conf" if [ ! -z "$line" ]; then iface_type[$iface_count]="ssid" iface_name[$iface_count]="$line" iface_status[$iface_count]="off" iface_linkto[$iface_count]="" iface_ipaddr[$iface_count]="" iface_hotkey[$iface_count]="$((iface_count))" (($Trace)) && printf "%-30s %-s\n" "GetDefinedInterfaces(5)" "Add SSID=$line Type=${iface_type[$iface_count]} Status=${iface_status[$iface_count]} Count=$iface_count" >>$TraceFileName (( iface_count++ )) fi done < <(ls /etc/wpa_supplicant/*.conf) fi fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Static Menu-Items menuopt_count=$iface_count [[ -z "$(grep -i "nfs\|cifs" /proc/mounts)" ]] && mountctlstate="off" || mountctlstate="on" [[ -z "$(ps -aux | grep openvpn | grep -v grep)" ]] && openvpnstate="off" || openvpnstate="on" if $WlanOK; then iface_name[$menuopt_count]="WLAN: Verfügbare Netze anzeigen" iface_type[$menuopt_count]="static" iface_status[$menuopt_count]="off" iface_hotkey[$menuopt_count]="L" iface_linkto[$menuopt_count]="" iface_ipaddr[$menuopt_count]="" (( menuopt_count++ )) fi if [ -f /etc/systemd/system/mountctl@.service ]; then iface_name[$menuopt_count]="Netzwerk-Mounts" iface_type[$menuopt_count]="static" iface_status[$menuopt_count]=$mountctlstate iface_hotkey[$menuopt_count]="M" iface_linkto[$menuopt_count]="" iface_ipaddr[$menuopt_count]="" (( menuopt_count++ )) fi if [ -f /etc/systemd/system/openvpn@.service ]; then iface_name[$menuopt_count]="OpenVPN-Verbindung" iface_type[$menuopt_count]="static" iface_status[$menuopt_count]=$openvpnstate iface_hotkey[$menuopt_count]="O" iface_linkto[$menuopt_count]="" iface_ipaddr[$menuopt_count]="" (( menuopt_count++ )) fi iface_name[$menuopt_count]="Alle Verbindungen trennen" iface_type[$menuopt_count]="static" iface_status[$menuopt_count]="off" iface_hotkey[$menuopt_count]="X" iface_linkto[$menuopt_count]="" iface_ipaddr[$menuopt_count]="" (( menuopt_count++ )) (($Trace)) && printf "%-30s %-s\n" "GetDefinedInterfaces(6)" "menuopt_count=$menuopt_count iface_count=$iface_count" >>$TraceFileName } #============================================================================================== GetInterfaceStatus() { ConnectedTo="-" for ((n=0;n<$iface_count;n++)) do if [ ${iface_type[$n]} == "eth" ] || [ ${iface_type[$n]} == "wlan" ]; then iface_status[$n]="off" iface_linkto[$n]="" iface_ipaddr[$n]="" [[ -n $(ip link show | grep "${iface_name[$n]}" -i | grep "state up\|multicast,up" -i) ]] && iface_status[$n]="on" (($Trace)) && printf "%-30s %-s\n" "GetInterfaceStatus(1)" "$n: iface=${iface_name[$n]} is ${iface_status[$n]} " >>$TraceFileName if [ "${iface_status[$n]}" == "on" ]; then iface_ipaddr[$n]=$(ip -f inet -o addr show ${iface_name[$n]}|cut -d\ -f 7 | cut -d/ -f 1) if [ -n "${iface_ipaddr[$n]}" ]; then (($Trace)) && printf "%-30s %-s\n" "GetInterfaceStatus(2)" "$n: ${iface_name[$n]} is set to IP-Adress=${iface_ipaddr[$n]}" >>$TraceFileName fi if [ "${iface_type[$n]}" == "wlan" ]; then ConnectedTo=$(iw dev ${iface_name[$n]} link | grep "ssid" -i) ConnectedTo="${ConnectedTo/'SSID: '/}" ConnectedTo=$(Trim "$ConnectedTo") if [ -n "$ConnectedTo" ]; then iface_linkto[$n]=$ConnectedTo (($Trace)) && printf "%-30s %-s\n" "GetInterfaceStatus(3)" "$n: ${iface_name[$n]} is connect to=$ConnectedTo" >>$TraceFileName for ((m=0;m<$iface_count;m++)) do if [ "${iface_type[$m]}" == "ssid" ]; then if [ "${iface_name[$m]}" == "$ConnectedTo" ]; then iface_status[$m]="on" iface_linkto[$m]=${iface_name[$n]} (($Trace)) && printf "%-30s %-s\n" "GetInterfaceStatus(4)" "$m: ssid=${iface_name[$m]} is linked to=${iface_linkto[$m]}" >>$TraceFileName else iface_status[$m]="off" iface_linkto[$m]="" fi fi done fi fi fi else if [ "${iface_name[$n]}" == "Netzwerk-Mounts" ]; then [[ -z "$(grep -i "nfs\|cifs" /proc/mounts)" ]] && iface_status[$n]="off" || iface_status[$n]="on" elif [ "${iface_name[$n]}" == "OpenVPN-Verbindung" ]; then [[ -z "$(ps -aux | grep openvpn | grep -v grep)" ]] && iface_status[$n]="off" || iface_status[$n]="on" fi fi done } #============================================================================================== # Scan and List present WISP ListWisp() { local -a menuitems local -a ssid local rc=1 (($Trace)) && printf "%-30s %-s\n" "ListWisp(1)" "Scanning for WISP" >>$TraceFileName [ -f $TempFileName ] && rm $TempFileName for ((n=0;n<$iface_count;n++)) do if [ "${iface_name[$n]}" == "$PrimaryWlanDevice" ]; then if [ "${iface_status[$n]}" == "off" ]; then dialog --msgbox "Achtung:\n\nDas Wlan-Network-Interface [$PrimaryWlanDevice]\nist nicht geöffnet!" 8 60 return 1 fi fi done # Manueller Check in CLI: # iw dev wlan0 scan >TempFileName # grep "SSID:\|signal:\|RSN:\|WPA:\|WEP:\|associated" TempFileName dialog --infobox "Hinweis:\n\nDer Scan-Vorgang nach vorhandenen WLAN-Netzen kann \neinige Sekunden dauern. Bitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "ListWisp(3)" "Exec: iw dev $PrimaryWlanDevice scan | grep -i 'ssid:\|signal:\|associated'" >>$TraceFileName iw dev $PrimaryWlanDevice scan | grep -i "ssid:\|signal:\|associated" >$TempFileName # cp $TempFileName $TempFileName.debug n=0 connected="off" while read line do if [[ "$line" =~ "associated" ]]; then connected="on" continue elif [[ "$line" =~ "signal:" ]]; then line="${line//signal: /}" wisp_signalstrength="$line" continue elif [[ "$line" =~ "SSID:" ]]; then line="${line//SSID:/}" tmp="$wisp_signalstrength - $(Trim $line)" ssid[$n]="$(Trim $line)" menuitems+=( "$n" "$tmp" "$connected" ) (($Trace)) && printf "%-30s %-5s %-22s %-26s %-s\n" "ListWisp(4)" "n=$n" "scan=$PrimaryWlanDevice" "ssid=${ssid[$n]}" "connected=$connected" >>$TraceFileName connected="off" fi (( n++ )) done < <(cat $TempFileName) clear dialog --backtitle "Liste der gefunden WLAN-Netze" --title "Netzwerk" --radiolist "Gefundene WLAN-Netze auf $PrimaryWlanDevice:" 16 80 10 "${menuitems[@]}" 2> $TempFileName if [ $? -eq 0 ]; then wisp_selected=${ssid[$(cat $TempFileName)]} if [ -n "$wisp_selected" ]; then conf="/etc/wpa_supplicant/$wisp_selected.conf" if [ -f "$conf" ]; then menuitems=() menuitems+=( "Z" "Keine Änderung, zurück" "on" ) menuitems+=( "L" "Netzwerkverbindung löschen" "off" ) dialog --backtitle "Netzwerkverbindung ist bereits eingerichtet!" --radiolist "Bitte auswählen::" 10 50 8 "${menuitems[@]}" 2> $TempFileName if [ $? -eq 0 ]; then itemselected=$(cat $TempFileName) if [ "$itemselected" == "L" ]; then (($Trace)) && printf "%-30s %-s\n" "ListWisp(5)" "Exec: rm $conf" >>$TraceFileName rm "$conf" rc=0 fi fi else dialog --title "Wlan-Netzwerk einrichten" --yesno "\nSoll der ausgewählte WISP\n $wisp_selected\nneu angelegt werden?" 10 40 if [ $? -eq 0 ]; then Create_wpasupplicant_conf rc=$? fi fi fi fi [ -f $TempFileName ] && rm $TempFileName return $rc } #============================================================================================== CheckFavorites() { local aplist=() local conf=() local tmp=() local ifno=0 (($Trace)) && printf "%-30s %-s\n" "CheckFavorites(1)" "Scanning for WISP with $PrimaryWlanDevice" >>$TraceFileName [ -f $TempFileName ] && rm $TempFileName for ((ifno=0; ifno<$iface_count;ifno++)) do if [ "${iface_type[$ifno]}" == "wlan" ]; then if [ "${iface_name[$ifno]}" == "$PrimaryWlanDevice" ]; then if [ "${iface_status[$ifno]}" == "off" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckFavorites(2)" "Exec: ip link set dev $PrimaryWlanDevice up" >>$TraceFileName ip link set dev $PrimaryWlanDevice up sleep 1 fi (($Trace)) && printf "%-30s %-s\n" "CheckFavorites(3)" "Exec: iw dev $PrimaryWlanDevice scan | grep -i 'ssid:\|signal:\|associated'" >>$TraceFileName iw dev $PrimaryWlanDevice scan | grep -i "ssid:\|signal:\|associated" >$TempFileName if [ "${iface_status[$ifno]}" == "off" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckFavorites(4)" "Exec: ip link set dev $PrimaryWlanDevice down" >>$TraceFileName ip link set dev $PrimaryWlanDevice down sleep 1 fi break; fi fi done [ ! -f $TempFileName ] && return 1 n=0 while read line # Check SSID in the neighbourhood do if [[ "$line" =~ "signal:" ]]; then line="${line//signal: -/}" ap_signalstrength="$line" continue elif [[ "$line" =~ "SSID:" ]]; then line="${line//SSID:/}" ap_ssid="$(Trim $line)" tmp[$n]="$ap_signalstrength=$ap_ssid" fi (( n++ )) done < <(cat $TempFileName) [ -f $TempFileName ] && rm $TempFileName IFS=$'\n' aplist=($(sort <<<"${tmp[*]}")); unset IFS # printf "[%s]\n" "${aplist[@]}" n=0 if [ -n "$(find /etc/wpa_supplicant/*.conf -maxdepth 0 -print 2> /dev/null)" ]; then while read line # Find existing confs do line=`basename "$line"` line="${line%'.conf'*}" if [ ! -z "$line" ]; then conf[$n]="$line" (( n++ )) fi done < <(ls /etc/wpa_supplicant/*.conf) fi # printf "[%s]\n" "${conf[@]}" for ap in "${aplist[@]}"; do for cnf in "${conf[@]}"; do a=${ap#*=} if [ "$a" == "$cnf" ]; then ConnectTo=$cnf (($Trace)) && printf "%-30s %-s\n" "CheckFavorites(5)" "Found SSID $cnf" >>$TraceFileName return 0 fi done done return 1 } #============================================================================================== Create_wpasupplicant_conf() { local n=0 local password="" tmp="" keytypeindex="" local -a menuitems # read -p "Breakpoint at 340" (($Trace)) && printf "%-30s %-s\n" "Create_wpasupplicant_conf(1)" "Start to create $conf" >>$TraceFileName Get_WispKeyProperties if [[ ${#wisp_key_type[*]} -gt 0 ]]; then for i in "${wisp_key_type[@]}" do menuitems+=( "$n" "${wisp_key_type[$n]}" "off" ) (( n++ )) done dialog --backtitle "Verschlüsselung auswählen" --title "Netzwerk" --radiolist "Unterstützte Verschlüsselung:" 16 40 10 "${menuitems[@]}" 2> $TempFileName [ $? -ne 0 ] && return 1 keytypeindex=$(cat $TempFileName) if [ -z "$keytypeindex" ]; then dialog --title "Achtung!" --msgbox "\nKeine Verschlüsselung ausgewählt!\n\nDas Anlegen der wpa-supplicant.conf wird abgebrochen.\n" 9 60 return 1 fi if ${wisp_pwd_request[$keytypeindex]}; then dialog --title "Wlan-Netzwerk einrichten" --inputbox "\nBitte das Netzwerk-Password für '$wisp_selected' eingeben:\n" 10 60 2> $TempFileName [ $? -ne 0 ] && return 1 tmp=`cat $TempFileName` lenge=${#tmp} if [ $lenge -lt 8 ] || [ $lenge -gt 63 ]; then clear echo "Passphrase must be 8..63 characters" sleep 3 return 1 fi if [[ "${wisp_key_type[$keytypeindex]}" =~ "WPA" ]]; then password=$(wpa_passphrase "$wisp_selected" "$tmp") [ $? -ne 0 ] && return 1 password=${password#'network={'*} password=${password%'}'*} elif [[ "${wisp_key_type[$keytypeindex]}" =~ "WEP" ]]; then password='\twep_key0="'$tmp'"' fi fi fi # "ctrl_interface_group=netdev\n"\ echo -e "# $wisp_selected.conf - created by selnic on `date +%d.%m.%Y` - `date +%H:%M:%S`\n\n"\ "ctrl_interface=/var/run/wpa_supplicant\n"\ "ap_scan=1\n\n"\ "network={\n"\ "\tscan_ssid=1\n"\ "\tpriority=20\n"\ '\tid_str="Guest"' >"$conf" [[ "$password" =~ "ssid=" ]] || echo -e '\n\tssid="'$wisp_selected'"\n' >>"$conf" [ -n "$password" ] && echo -e "$password" >>"$conf" [ -n "$keytypeindex" ] && echo -e "${wisp_key_property[$keytypeindex]}" >>"$conf" echo "}" >>"$conf" dialog --infobox "Hinweis:\n\n$conf wurde angelegt!" 7 60 sleep 3 (($Trace)) && printf "%-30s %-s\n" "Create_wpasupplicant_conf(2)" "`basename $conf` created ssid=$wisp_selected KeyType=${#wisp_key_type[$keytypeindex]}" >>$TraceFileName return 0 } #============================================================================================== Get_WispKeyProperties() { local wisp_found=0 tmp="" local proto="" keytype="" group="" pairwise="" authentication="" key_mgmt="" wisp_key_type=() wisp_key_property=() wisp_pwd_request=() dialog --infobox "Hinweis:\n\nDie Verschlüsselung des ausgewählten Accesspoints wird ermittelt. Bitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "Get_WispKeyProperties(1)" "scan device=$PrimaryWlanDevice, search Key-Properties" >>$TraceFileName iw dev $PrimaryWlanDevice scan >$TempFileName clear while read line do if [ ! -z "$line" ]; then if [ $wisp_found -eq 1 ]; then if [[ "$line" =~ "SSID:" ]]; then break elif [[ "$line" =~ "RSN:" ]]; then wisp_key_type+=("WPA2") elif [[ "$line" =~ "WPA:" ]]; then wisp_key_type+=("WPA1") elif [[ "$line" =~ "WEP:" ]]; then wisp_key_type+=("WEP") fi elif [[ "$line" =~ "$wisp_selected" ]]; then (($Trace)) && printf "%-30s %-s\n" "Get_WispKeyProperties(2)" "ssid:$wisp_selected found in scan-result" >>$TraceFileName wisp_found=1 fi fi done < <(grep "SSID:\|signal:\|RSN:\|WPA:\|WEP:" $TempFileName) if [[ ${#wisp_key_type[*]} -gt 0 ]]; then for i in "${wisp_key_type[@]}" do proto="" group="" pairwise="" key_mgmt="" if [[ "$i" == "WPA2" ]]; then proto="proto=WPA RSN" pairwise="pairwise=CCMP TKIP" group="group=CCMP TKIP" key_mgmt="key_mgmt=WPA-PSK" wisp_key_property+=("\t$proto\n\t$group\n\t$pairwise\n\t$key_mgmt\n") wisp_pwd_request+=(true) elif [[ "$i" =~ "WPA1" ]]; then proto="proto=WPA" pairwise="pairwise=TKIP" group="group=TKIP" key_mgmt="key_mgmt=WPA-PSK" wisp_key_property+=("\t$proto\n\t$group\n\t$pairwise\n\t$key_mgmt\n") wisp_pwd_request+=(true) elif [[ "$i" =~ "WEP" ]]; then proto="wep_tx_keyidx=0" key_mgmt="key_mgmt=NONE" wisp_key_property+=("\t$proto\n\t$key_mgmt\n") wisp_pwd_request+=(true) fi (($Trace)) && printf "%-30s %-s\n" "Get_WispKeyProperties(3)" "Add Properties: ${wisp_selected:0:10} $i $proto $group $pairwise $key_mgmt" >>$TraceFileName done fi wisp_key_type+=("none") wisp_key_property+=("\tkey_mgmt=NONE\n") wisp_pwd_request+=(false) [ -f $TempFileName ] && rm $TempFileName } #============================================================================================== Unmountnfs() { local line sync (($Trace)) && printf "%-30s %-s\n" "Unmountnfs(1)" "Processing umount" >>$TraceFileName while read line do umount $line -f 2>&1 done < <(cat /proc/mounts | grep // | awk -F ' ' '{ print $1 }') # done < <(systemctl status *.mount | grep "What: //" | awk -F ': ' '{ print $2 }') } #============================================================================================== CheckDoMounts() { local ChkBoxItemsSelected=$1 # "M" = mount, "X" + "" = umount local mpos tmp [[ "$ChkBoxItemsSelected" =~ "M" ]] && tmp="mount" || tmp="umount" (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(1)" "Check for mount/umount" >>$TraceFileName GetMenuOptPos "M" mpos=$? [[ $mpos -eq -1 ]] && return 0 if [ -f /etc/systemd/system/mountctl@.service ]; then if [ -n "$CurrUser" ]; then if [[ "$ChkBoxItemsSelected" =~ "M" ]]; then if [ "${iface_status[$mpos]}" == "off" ]; then [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nDer Mount-Vorgang kann einige Sekunden dauern.\nBitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(3)" "Processing $tmp" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(4)" "Exec: systemctl start mountctl@$CurrUser.service" >>$TraceFileName systemctl start mountctl@$CurrUser.service >&1 >/dev/null rc=$? sleep 1 if [ ! $rc -eq 0 ]; then [ $Quiet == false ] && dialog --msgbox "Achtung!\n\nMounts nicht erfolgreich! Möglicherweise ein Netzwerkfehler?\n(Mount beendet mit Fehlercode: $rc)" 8 70 return fi iface_status[$mpos]="on" fi else if [ "${iface_status[$mpos]}" == "on" ]; then [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nDas Trennen der Mounts kann einige Sekunden dauern.\nBitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(5)" "Processing $tmp" >>$TraceFileName if [ "$(systemctl is-active mountctl@$CurrUser.service)" == "active" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(6)" "Exec: systemctl stop mountctl@$CurrUser.service" >>$TraceFileName systemctl stop mountctl@$CurrUser.service >&1 >/dev/null fi iface_status[$mpos]="off" fi fi fi fi if [[ "$ChkBoxItemsSelected" =~ "X" ]]; then (($Trace)) && printf "%-30s %-s\n" "CheckDoMounts(2)" "Exec: Unmountnfs()" >>$TraceFileName Unmountnfs iface_status[$mpos]="off" fi } #============================================================================================== CheckDoVPN() { local ChkBoxItemsSelected=$1 # "" = close VPN-Connection local mpos local -a menuitems local vpnconfs=() local vpnconfcnt=0 GetMenuOptPos "O" mpos=$? [[ $mpos -eq -1 ]] && return 0 (($Trace)) && printf "%-30s %-s\n" "CheckDoVPN(1)" "Check for Connect/Disconnect OpenVPN-Session" >>$TraceFileName if [ -n "$(find /etc/openvpn/*.conf -maxdepth 0 -print 2> /dev/null)" ]; then while read line do line=`basename "$line"` line="${line%'.conf'*}" # Fetch left part before ".conf" if [ ! -z "$line" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckDoVPN(2)" "Add VPNConf=$line Count=$vpnconfcnt" >>$TraceFileName menuitems+=( "$vpnconfcnt" "$line" "off" ) vpnconfs[$vpnconfcnt]="$line" (( vpnconfcnt++ )) fi done < <(ls /etc/openvpn/*.conf) fi if [[ "$ChkBoxItemsSelected" =~ "O" ]]; then if [ "${iface_status[$mpos]}" == "off" ]; then if [ ${#vpnconfs[*]} -eq 0 ]; then dialog --title "Achtung!" --msgbox "\nKeine VPN-Konfigurationsdateien gefunden!\n\nVPN-Verbindung wird abgebrochen.\n" 9 60 return 1 fi dialog --backtitle "VPN-Konfiguration auswählen" --title "OpenVPN" --radiolist "Conf-Files:" 16 40 12 "${menuitems[@]}" 2> $TempFileName [ $? -ne 0 ] && return 1 vpnselect=$(cat $TempFileName) if [ -z "$vpnselect" ]; then dialog --title "Achtung!" --msgbox "\nKein VPN ausgewählt!\n\nVPN-Verbindung wird abgebrochen.\n" 9 60 return 1 fi rc=1 [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nVPN wird verbunden. Bitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "CheckDoVPN(3)" "Exec: systemctl start openvpn@${vpnconfs[$vpnselect]}.service" >>$TraceFileName systemctl start openvpn@${vpnconfs[$vpnselect]}.service >&1 >/dev/null rc=$? [[ "$TerminalApp" =~ "xterm" ]] && $TerminalApp -geometry 120x20+1+1 -e "echo \$$ > $TempFileName; tail $OpenVPNLog -n 100 --sleep-interval=2 -f --pid=$$" & [[ "$TerminalApp" =~ "urxvt" ]] && $TerminalApp -geometry 120x20+1+1 -fg white -bg black -e sh -c "echo \$$ > $TempFileName; tail $OpenVPNLog -n 100 --sleep-interval=2 -f --pid=$$" & sleep 1 VPNLogPID=$(cat $TempFileName) # VPNLogPID=$(ps -x | grep $TerminalApp | grep "tail $OpenVPNLog" | awk -F ' ' '{ print $1 }') if [ ! $rc -eq 0 ]; then [ $Quiet == false ] && dialog --msgbox "Achtung!\n\nOpenVPN ist nicht erfolgreich verbunden! Möglicherweise ein Netzwerkfehler?\n(Fehlercode: $rc)" 8 70 return fi iface_status[$mpos]="on" fi else if [ "${iface_status[$mpos]}" == "on" ]; then for i in "${vpnconfs[@]}" do if [ "$(systemctl is-active openvpn@$i.service)" == "active" ]; then [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nVPN-Verbindung wird getrennt. Bitte warten!" 7 60 (($Trace)) && printf "%-30s %-s\n" "CheckDoVPN(4)" "Exec: systemctl stop openvpn@$i.service" >>$TraceFileName systemctl stop openvpn@$i.service >&1 >/dev/null if [[ $VPNLogPID -gt 0 ]]; then if kill -0 $VPNLogPID 2>1 >/dev/null; then kill -SIGTERM $VPNLogPID fi VPNLogPID=0 fi sleep 2 fi (( n++ )) done iface_status[$mpos]="off" fi fi [ -f $TempFileName ] && rm $TempFileName return 0 } #============================================================================================== CheckSetInterfaces() { local ChkBoxItemsSelected=$1 # "" = alles schließen [ "$ChkBoxItemsSelected" == "X" ] && ChkBoxItemsSelected="" # nichts mehr selektiert [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nDas Herstellen, Trennen bzw. Prüfen der Netzwerkverbindungen kann einige Sekunden dauern. Bitte warten!" 7 65 (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 1)" "ChkBoxItemsSelected=$ChkBoxItemsSelected" >>$TraceFileName # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Sollen NIC oder SSID geschlossen werden? Wenn NIC, dann SSID (link to WISP) auch schließen, wenn SSID closed, dann NIC ebenfalls schließen! devicepos=-1 ssidpos=-1 for ((a=0; a<$iface_count;a++)) do if [[ ! "$ChkBoxItemsSelected" =~ "$a" ]]; then # Menupos jetzt nicht (mehr) selected? if [ "${iface_status[$a]}" == "on" ]; then if [ "${iface_type[$a]}" == "eth" ] || [ "${iface_type[$a]}" == "wlan" ]; then devicepos=$a ssidpos=-1 for ((b=0; b<$iface_count;b++)) # wenn wlan, hat das geöffnete Device eine SSID? do if [ "${iface_type[$b]}" == "ssid" ]; then if [ "${iface_linkto[$b]}" == "${iface_name[$a]}" ]; then ssidpos=$b break fi fi done elif [ "${iface_type[$a]}" == "ssid" ]; then # Wurde nur ein SSID-Link geschlossen? Dann Menu devicepos=-1 # bereinigen und NIC ebenfalls schließen ssidpos=$a for ((b=0; b<$iface_count;b++)) do if [ "${iface_type[$b]}" == "wlan" ]; then # zur verbundenen SSID das geöffnete Device suchen if [ "${iface_name[$b]}" == "${iface_linkto[$a]}" ]; then devicepos=$b break; fi fi done fi if [ $ssidpos -ne -1 ] || [ $devicepos -ne -1 ]; then CheckDoMounts "X" CheckDoVPN "X" if [ -f /etc/systemd/system/serverctl.service ]; then if [ "$(systemctl is-active serverctl.service)" == "active" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 2)" "stopping serverctl.service" >>$TraceFileName systemctl stop serverctl.service fi fi if [ -f /etc/systemd/system/network-is-connect.service ]; then if [ "$(systemctl is-active network-is-connect.service)" == "active" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 3)" "stopping network-is-connect.service" >>$TraceFileName systemctl stop network-is-connect.service fi fi fi if [ $ssidpos -ne -1 ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 4)" "disconnect wisp=${iface_name[$ssidpos]}" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 5)" "Exec: pkill -f ${iface_name[$ssidpos]}.conf" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 6)" "Exec: dhclient -r ${iface_linkto[$ssidpos]}" >>$TraceFileName echo "Disconnect SSID=${iface_name[$ssidpos]} pkill=wpasupplicant release=dhclient" | systemd-cat -t "thlu:$(basename $0)" -p "info" pkill -f "${iface_name[$ssidpos]}.conf" # killall -HUP wpa_supplicant -s=9 dhclient -r ${iface_linkto[$ssidpos]} 2> /dev/null iface_status[$ssidpos]="off" iface_linkto[$ssidpos]="" iface_ipaddr[$ssidpos]="" ChkBoxItemsSelected="${ChkBoxItemsSelected//$ssidpos/}" fi if [ $devicepos -ne -1 ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 7)" "Exec: ip link set dev ${iface_name[$devicepos]} down" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 8)" "Exec: dhclient -r ${iface_name[$devicepos]}" >>$TraceFileName echo "Interface: set dev ${iface_name[$devicepos]} down release=dhclient" | systemd-cat -t "thlu:$(basename $0)" -p "info" ip link set dev ${iface_name[$devicepos]} down 2> /dev/null dhclient -r ${iface_name[$devicepos]} 2> /dev/null iface_status[$devicepos]="off" iface_linkto[$devicepos]="" iface_ipaddr[$devicepos]="" ChkBoxItemsSelected="${ChkBoxItemsSelected//$devicepos/}" sleep 2 fi fi fi done # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Sollen NIC oder SSID geöffnet werden? for ((a=0; a<$iface_count;a++)) do if [[ "$ChkBoxItemsSelected" =~ "$a" ]]; then # device oder wisp jetzt (neu) selected? if [ "${iface_status[$a]}" == "off" ]; then # wenn bisher Off (down), dann aktivieren (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces( 9)" "Try to set ${iface_name[$a]} up" >>$TraceFileName if [ "${iface_type[$a]}" == "eth" ] || [ ${iface_type[$a]} == "wlan" ]; then d=`date +%H:%M:%S` (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(10)" "$d Exec: ip link set dev ${iface_name[$a]} up" >>$TraceFileName echo "$d Interface: set dev ${iface_name[$a]} up. Get IP via dhclient" | systemd-cat -t "thlu:$(basename $0)" -p "info" ip link set dev ${iface_name[$a]} up sleep 3 d=`date +%H:%M:%S` if [ -n "$(ip link show dev ${iface_name[$a]} | grep 'MULTICAST,UP')" ]; then if [ "${iface_type[$a]}" == "eth" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(11)" "$d Exec: dhclient -v ${iface_name[$a]}" >>$TraceFileName dhclient -v ${iface_name[$a]} rc=$? sleep 3 IP_is_given=$(ip -f inet -o addr show ${iface_name[$a]} | cut -d\ -f 7 | cut -d/ -f 1) d=`date +%H:%M:%S` if [ -z "$IP_is_given" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(12)" "$d dhclient=${iface_name[$a]} failed! (RC=$rc) - no IP." >>$TraceFileName echo "$d Connect to SSID ${iface_name[$ssidpos]} failed. DHClient RC=$rc" | systemd-cat -t "thlu:$(basename $0)" -p "err" [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nVerbindungsversuch fehlgeschlagen!" 7 65 else (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(13)" "$d Connect successful! ${iface_name[$a]} IP=$IP_is_given" >>$TraceFileName echo "$d Connect successful! ${iface_name[$a]} IP=$IP_is_given" | systemd-cat -t "thlu:$(basename $0)" -p "info" if [ -f /etc/systemd/system/network-is-connect.service ]; then systemctl start network-is-connect.service else echo "/etc/systemd/system/network-is-connect.service not found" | systemd-cat -t "thlu:$(basename $0)" -p "info" (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(14)" "/etc/systemd/system/network-is-connect.service not found" >>$TraceFileName fi return 0 fi fi else (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(15)" "$d Set ${iface_name[$a]} up failed!" >>$TraceFileName echo "$d Set ${iface_name[$a]} up failed!" | systemd-cat -t "thlu:$(basename $0)" -p "err" fi elif [ "${iface_type[$a]}" == "ssid" ]; then ssidpos=$a for ((b=0; b<$iface_count;b++)) # vorher prüfen, ob noch mit anderem WISP verbunden ist do if [ "${iface_type[$b]}" == "ssid" ]; then if [ "${iface_status[$b]}" == "on" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(16)" "Disconnect WISP ${iface_name[$b]}" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(17)" "Exec: pkill -f ${iface_name[$b]}.conf" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(18)" "Exec: dhclient -r ${iface_linkto[$b]}" >>$TraceFileName pkill -f "${iface_name[$b]}.conf" dhclient -r ${iface_linkto[$b]} 2> /dev/null iface_status[$b]="off" iface_linkto[$b]="" ChkBoxItemsSelected="${ChkBoxItemsSelected//$b/}" break; fi fi done for ((b=0; b<$iface_count;b++)) # wlan-device ist up? do if [ "${iface_type[$b]}" == "wlan" ]; then if [ "${iface_name[$b]}" == "$PrimaryWlanDevice" ]; then if [ "${iface_status[$b]}" == "off" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(19)" "set $PrimaryWlanDevice up" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(20)" "Exec: ip link set dev $PrimaryWlanDevice up" >>$TraceFileName ip link set dev $PrimaryWlanDevice up sleep 3 break; fi fi fi done if [ -n "$(ip link show dev $PrimaryWlanDevice | grep 'MULTICAST,UP')" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(21)" "link $PrimaryWlanDevice to wisp=${iface_name[$ssidpos]}" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(22)" "Exec: iw dev $PrimaryWlanDevice scan | grep ssid: ${iface_name[$ssidpos]} -i" >>$TraceFileName if [ -z "$(iw dev "$PrimaryWlanDevice" scan | grep -i "ssid: ${iface_name[$ssidpos]}")" ]; then [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nDas ausgewählte Netzwerk [${iface_name[$ssidpos]}] ist derzeit nicht erreichbar." 7 65 echo "Connect to SSID ${iface_name[$ssidpos]} failed. Network not reachable!" | systemd-cat -t "thlu:$(basename $0)" -p "err" (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(23)" "Connect to SSID ${iface_name[$ssidpos]} failed. Network not reachable!" >>$TraceFileName sleep 5 else clear (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(24)" "Exec: wpa_supplicant -B -i $PrimaryWlanDevice -c /etc/wpa_supplicant/${iface_name[$ssidpos]}.conf" >>$TraceFileName [ $Quiet == false ] && echo -e "Das Herstellen der Verbindung dauert ein paar Sekunden....\n" wpa_supplicant -B -i $PrimaryWlanDevice -c /etc/wpa_supplicant/"${iface_name[$ssidpos]}".conf # -D nl80211,wext rc=$? if [ $rc -eq 0 ]; then sleep 2 (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(25)" "Exec: dhclient -v $PrimaryWlanDevice" >>$TraceFileName dhclient -v $PrimaryWlanDevice rc=$? fi IP_is_given=$(ip -f inet -o addr show $PrimaryWlanDevice | cut -d\ -f 7 | cut -d/ -f 1) if [ "$IP_is_given" == "" ]; then (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(26)" "dhclient=$PrimaryWlanDevice failed! (RC=$rc) - no IP." >>$TraceFileName echo "Connect to SSID ${iface_name[$ssidpos]} failed. DHClient RC=$rc" | systemd-cat -t "thlu:$(basename $0)" -p "err" [ $Quiet == false ] && dialog --infobox "Hinweis:\n\nVerbindungsversuch fehlgeschlagen!" 7 65 pkill -f "wpa_supplicant" sleep 5 else sleep 3 (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(27)" "dhclient successful! (RC=$rc) IP = $IP_is_given." >>$TraceFileName echo "Connect to SSID ${iface_name[$ssidpos]} successful! IP=$IP_is_given" | systemd-cat -t "thlu:$(basename $0)" -p "info" if [ -f /etc/systemd/system/network-is-connect.service ]; then systemctl start network-is-connect.service else echo "/etc/systemd/system/network-is-connect.service not found" | systemd-cat -t "thlu:$(basename $0)" -p "info" (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(28)" "/etc/systemd/system/network-is-connect.service not found" >>$TraceFileName fi return 0 fi fi else (($Trace)) && printf "%-30s %-s\n" "CheckSetInterfaces(29)" "Set $PrimaryWlanDevice up failed!" >>$TraceFileName echo "Set $PrimaryWlanDevice up failed!" | systemd-cat -t "thlu:$(basename $0)" -p "err" fi break fi fi fi done return 1 } #============================================================================================== # Dialog/GUI: interface oder ssid zum Öffnen oder Schließen auswählen MainMenu() { local -a menuitems (($Trace)) && printf "%-30s %-s\n" "MainMenu(1)" "Running Dialog-MainMenu" >>$TraceFileName for ((n=0;n<$menuopt_count;n++)) do if [ -n "${iface_ipaddr[$n]}" ]; then menuitems+=( "${iface_hotkey[$n]}" "${iface_name[$n]} (${iface_ipaddr[$n]})" "${iface_status[$n]}" ) else if [ "${iface_name[$n]}" == "$PrimaryWlanDevice" ]; then menuitems+=( "${iface_hotkey[$n]}" "${iface_name[$n]} (Primary Client-Device)" "${iface_status[$n]}" ) elif [ "${iface_type[$n]}" == "ssid" ] && [ -n "${iface_linkto[$n]}" ]; then menuitems+=( "${iface_hotkey[$n]}" "${iface_name[$n]} (${iface_linkto[$n]})" "${iface_status[$n]}" ) else menuitems+=( "${iface_hotkey[$n]}" "${iface_name[$n]}" "${iface_status[$n]}" ) fi fi done # --checklist ... dialog --backtitle "Selnic Vers. $Version - Select Network-Interfaces/Accesspoints" \ --checklist "Mit Hotkey oder Auf-/Abwärtspfeiltasten auswählen,\nmit Leertaste ein/ausschalten, mit Enter bestätigen:" 19 70 12 "${menuitems[@]}" 2>$TempFileName if [ ! $? -eq 0 ]; then # 0=ok, 1=cancel, 255 Win-Close [ -f $TempFileName ] && rm $TempFileName [ $RequestSaveSettings == true ] && SaveSettings AppExit 0 fi } #============================================================================================== AppExit() { rc=$1 [ $rc -eq 0 ] && clear [ $rc -eq 2 ] && (($Trace)) && printf "%-30s %-s\n" "WLAN failed" "Missing iw" >>$TraceFileName [ $rc -eq 5 ] && (($Trace)) && printf "%-30s %-s\n" "WLAN failed" "Missing wpa_supplicant" >>$TraceFileName [ $rc -eq 7 ] && (($Trace)) && printf "%-30s %-s\n" "Connect failed" "SSID-wpa-conf not found" >>$TraceFileName [ $rc -eq 8 ] && (($Trace)) && printf "%-30s %-s\n" "Connect failed" "Network-Interface not found" >>$TraceFileName [ $rc -eq -1 ] && rc=0 [ -f $TempFileName ] && rm $TempFileName if [ $Trace -eq 1 ]; then # printf "%-30s %-s\n" "AppExit(1)" "Exec: pkill -f 'tail $TraceFileName'" >>$TraceFileName # sleep 1 && [ $TracePID -ne 0 ] && pkill -f "tail $TraceFileName" printf "%-30s %-s\n" "AppExit(1)" "Selnic terminated with RC: $rc" >>$TraceFileName [[ $Wait4Key == true ]] && read -p "AppExit-Breakpoint - Enter zum Schließen des Trace-Windows" ( [ -f $TraceFileName ] && [ $Hold == false ]) && rm $TraceFileName fi d=`date +%H:%M:%S` tEnd=$(date +%s) tDiff=$((tEnd-tStart)) echo "$d Selnic terminated with Exit-Code: $rc, after $tDiff Runtime-Seconds" | systemd-cat -t "thlu:$(basename $0)" -p "info" exit $rc } #============================================================================================== # Init App tStart=$(date +%s) d=`date +%H:%M:%S` echo "$d Selnic started" | systemd-cat -t "thlu:$(basename $0)" -p "info" while getopts c:e:w:u:afhmnktx? opts; do case ${opts} in c) ConnectTo=${OPTARG} ;; e) PrimaryEthDevice=${OPTARG} ;; u) CurrUser=${OPTARG} ;; w) PrimaryWlanDevice=${OPTARG} ;; a) AutoConnect=true ;; f) Favorites=true ;; h) Hold=true ;; m) DoMounts=true ;; n) RequestSaveSettings=false ;; k) Wait4Key=true ;; t) Trace=1 ;; x) AutoClose=true ;; *) ahelp=( "Usage:" " " "selnic { -c SSID | -e ethnicname | -w wlannicname | -a | -f | -h | -m | -n | -k | -t | -u | -x | -? }" " " "-c NIC/SSID = Connect to NIC/SSID Mit LAN oder AP verbinden ({AP}.conf ist vorhanden)" "-e NIC = Set ETH-NIC Setze primäres Default-Interface für eth" "-w NIC = Set WLAN-NIC Setze primäres Default-Interface für wlan " "-u Username = Set current user User-credentials für mountctl@.service verwenden" "-a = Automode start, no GUI Connect Network + Mounts und beenden" "-f = Favorites Favorisiertes WLAN-Netzwerk erreichbar?" "-h = Hold Trace-File bei Programmende nicht löschen" "-m = Mount Mount Samba-Shares via mountctl@.service" "-n = No Request Keine Frage Einstellungen speichern?" "-k = Wait for Key Warte auf Tastendruck bei Exit im Trace-Mode" "-t = Trace-Mode Trace-Fenster" "-x = Automode stop, no GUI Umount + disconnect Network und beenden" "-? = Help Zeigt diese Hilfe" " " " " "Return-Codes:" "0 = Keine Fehler" "1 = Programm ip nicht gefunden" "2 = Programm iw nicht gefunden" "3 = Programm dhclient nicht gefunden" "4 = Programm dialog nicht gefunden" "5 = Programm wpa_supplicant nicht gefunden" "6 = Netzwerk ist bereits verbunden" "7 = SSID-wpa-conf nicht gefunden" "8 = Netzwerk-Interface nicht gefunden" "9 = AutoConnect durch selnic.conf fehlgeschlagen" ) printf '%s\n' "${ahelp[@]}" exit 0 ;; esac done if [ -z "$CurrUser" ];then if [ -s /var/run/mountctl.user ]; then CurrUser=$(cat /var/run/mountctl.user) elif [ -s /var/run/sessionctl.user ]; then CurrUser=$(grep -i pam_user /var/run/sessionctl.user | awk -F '=' '{ print $2 }') CurrUser=${CurrUser// /} else CurrUser=$USER fi fi [ -n "$CurrUser" ] && [ -z "$(cat /etc/passwd | grep ^$CurrUser:)" ] && CurrUser="" [ "$CurrUser" == "root" ] && CurrUser="" #---------------------------------------------------------------------------------------------- ipApp=$(which ip) iwApp=$(which iw) dhclientApp=$(which dhclient) dialogApp=$(which dialog) wpasupplApp=$(which wpa_supplicant) TerminalApp=$(which xterm) while read line do if [ -n "$line" ]; then [ -d "/sys/class/net/$line/wireless" ] && WlanIF=true fi done < <(ip link show | grep state | awk -F ': ' '{ print $2 }' | sort -b -g) [ -z "$TerminalApp" ] && TerminalApp=$(which urxvt) [ -z "$ipApp" ] && echo "Fehlendes Prog.: ip nicht gefunden" && AppExit 1 [ -z "$dhclientApp" ] && echo "Fehlendes Prog.: dhclient nicht gefunden" && AppExit 3 [ -z "$dialogApp" ] && echo "Fehlendes Prog.: dialog nicht gefunden" && AppExit 4 [ -z "$TerminalApp" ] && echo "Fehlendes Prog.: Terminal-App nicht gefunden! (xterm empfohlen)" && sleep 5 [ -z "$iwApp" ] && (( WlanSW+=1 )) [ -z "$wpasupplApp" ] && (( WlanSW+=2 )) [ $WlanIF == true ] && [ $WlanSW -eq 0 ] && WlanOK=true [ $WlanOK == true ] && [ ! -d "/etc/wpa_supplicant" ] && mkdir -p /etc/wpa_supplicant [ -f $0.conf ] && SavedSettings=$(cat $0.conf) || SavedSettings="" [ ! -f "$TerminalApp" ] && Trace=0 (($Trace)) && TraceOn (($Trace)) && printf "%-30s %-s\n" "Init(1)" "Cmdline-Parm: $*" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "Init(1)" "TempFileName=$TempFileName SavedSettings=$SavedSettings" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "Init(1)" "AutoConnect=$AutoConnect AutoClose=$AutoClose ConnectTo=$ConnectTo Favorites=$Favorites" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "Init(1)" "WlanIF=$WlanIF WlanSW=$WlanSW WlanOK=$WlanOK" >>$TraceFileName (($Trace)) && printf "%-30s %-s\n" "Init(1)" "CurrUser=$CurrUser" >>$TraceFileName #---------------------------------------------------------------------------------------------- # Main-Loop GetDefinedInterfaces if $Favorites; then Quiet=true (($Trace)) && printf "%-30s %-s\n" "Main(6)" "Connect to favorite network?" >>$TraceFileName GetInterfaceStatus [ $WlanIF == false ] && (($Trace)) && printf "%-30s %-s\n" "Main(5)" "Connect to Wlan failed! NIC not found" >>$TraceFileName [ $WlanIF == false ] && AppExit 8 [ $(( $WlanSW & 0x1 )) -eq 1 ] && AppExit 2 [ $(( $WlanSW & 0x2 )) -eq 2 ] && AppExit 5 CheckFavorites [ $? -ne 0 ] && AppExit 7 fi if [ -n "$ConnectTo" ]; then Quiet=true (($Trace)) && printf "%-30s %-s\n" "Main(2)" "Try autoconnect to=$ConnectTo" >>$TraceFileName GetInterfaceStatus for ((n=0;n<6;n++)); do # 5 Sekunden lang auf konstante Verbindung prüfen for ((a=0; a<$iface_count;a++)); do if ([ "${iface_status[$a]}" == "on" ] && [ -n "${iface_ipaddr[$a]}" ]); then if [ $n -eq 5 ]; then (($Trace)) && printf "%-30s %-s\n" "Main(3)" "Connect to $ConnectTo failed! Network is already connected." >>$TraceFileName AppExit 6 else sleep 1 break fi fi done done result="" for ((a=0; a<$iface_count;a++)); do if [ "${iface_name[$a]}" == "$ConnectTo" ]; then (($Trace)) && printf "%-30s %-s\n" "Main(4)" "Connect to=$ConnectTo: found type=${iface_type[$a]} name=${iface_name[$a]}" >>$TraceFileName result="$a" fi done if [ -n "$result" ]; then CheckSetInterfaces $result if [ $? -eq 0 ];then [ $DoMounts == true ] && CheckDoMounts "M" AppExit 0 fi else (($Trace)) && printf "%-30s %-s\n" "Main(5)" "Connect to $ConnectTo failed! NIC not found" >>$TraceFileName fi AppExit 8 fi if $AutoConnect; then Quiet=true (($Trace)) && printf "%-30s %-s\n" "Main(7)" "AutoConnect from conf" >>$TraceFileName if [[ ! -z "$SavedSettings" ]]; then GetInterfaceStatus result=$(cat $0.conf) CheckSetInterfaces "$result" if [ $? -eq 0 ];then [[ -n "$CurrUser" ]] && CheckDoMounts "$result" AppExit 0 fi fi AppExit 9 elif $AutoClose; then Quiet=true (($Trace)) && printf "%-30s %-s\n" "Main(8)" "AutoClose" >>$TraceFileName GetInterfaceStatus CheckDoMounts "X" CheckDoVPN "X" CheckSetInterfaces "X" AppExit -1 fi GetInterfaceStatus while true; do MainMenu result="" [ -f $TempFileName ] && result=`cat $TempFileName` && rm $TempFileName [[ "$result" =~ "X" ]] && result="" # schließt 1. mounts, 2. openvpn, 3. netzwerkverbindung GetMenuOptPos "M"; mpos=$? [[ $mpos -ne -1 ]] && mountstateold="${iface_status[$mpos]}" || mountstateold="off" GetMenuOptPos "O"; mpos=$? [[ $mpos -ne -1 ]] && vpnstateold="${iface_status[$mpos]}" || vpnstateold="off" CheckSetInterfaces "$result" # kann auch mounts und vpn beenden, wenn NIC getrennt wird! GetInterfaceStatus if [ "$mountstateold" == "on" ]; then GetMenuOptPos "M"; mpos=$? [ "${iface_status[$mpos]}" == "off" ] && result="${result//M/}" fi if [ "$vpnstateold" == "on" ]; then GetMenuOptPos "O"; mpos=$? [ "${iface_status[$mpos]}" == "off" ] && result="${result//O/}" fi CheckDoMounts "$result" CheckDoVPN "$result" if [[ "$result" =~ "L" ]]; then ListWisp if [ $? -eq 0 ]; then GetDefinedInterfaces GetInterfaceStatus fi fi done #============================================================================================== selnic/usr/local/share/0000770000175000017500000000000013140624466014713 5ustar thomasthomasselnic/usr/local/share/Icons/0000770000175000017500000000000013140624116015756 5ustar thomasthomasselnic/usr/local/share/Icons/network2.png0000644000175000017500000002637712631307371020266 0ustar thomasthomasPNG  IHDR>a IDATx} TՙݪYU%L4јڀ"QBHpW b2QI2ә3DŨQH$APYE8.74 е}uvu? jI&jI&jI&jI&jI&jI&jI&>0?INbP cG}ol$QJY~>^x>Q\14~pH$ 4l&o~CﮆOC#_pP"9hiv/ò ?5_m)ϛ{#[> ^v477[4*N49"DŽcRܿ?0LWraa V]hӶa ess^7(s'v}a]_[N{0ę<3<Թ<+*) scgBN~Gkod%SF?,4rUB;0)ݳN;]C6z0,6-㯛6?c$϶/73Ȧ'Fôv/oZ2dgS `b;a駱G/IkBJ9 ώGR੯aJ/a²|;1cഝP8=mߜK5y9*b((>.\`ZrIJڅ)(^GCYX)앴޴`;8;0e3ӊe 8Ci7TOʁWL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W= Wi*uH$z뭍8H'"n}ݷ)L޽nB9BlOHIDATh ݹOI?`!yܟH$صk硵;)i!0 DN8ezV% MIeM8eڂR%fyK/***t?g6^3~-"L*@'|৞(ٺu?/OF)TTT0~xoAbXZ^C6B`?N+x-KQfY#G8_)ɓ'y&T߫aǎ'@[f#T*euwwo?Rʦ&bƍ\h4J,K@lAr%n]g5,X,ƈ#$m۴{!>'wqǖ, lVb8\b_W.\reC$ 0k,.]B<g$ܗd?~'?5#l@.,ڳgOg,{˲*;::8x J)ƌ#4"Ė-[ػwj>? 3=U->ׯѣƑHZjjj0ai*!ux|u+0[:\DN8~8g/&So{_&;'r\OKeUx_;w73R*?|޽{O 7Ing\ 鑠qƍ\nʙ3g^6vBaPb;~y'z&'0Ƀ\`ِ1~lSL6&LF#1 y J%Dɓ'v}`M8z0~5l]hL wdhh(h#owpp4$ɴDP n|A;$a-NKIENDB`selnic/usr/share/0000770000175000017500000000000013140616371013615 5ustar thomasthomasselnic/usr/share/polkit-1/0000770000175000017500000000000013140616371015255 5ustar thomasthomasselnic/usr/share/polkit-1/actions/0000770000175000017500000000000013631221261016710 5ustar thomasthomasselnic/usr/share/polkit-1/actions/ReadMe0000644000175000017500000000075013500447710020001 0ustar thomasthomasDie Rechte MÜSSEN wie folgt gesetzt sein. Die Policies sind normalerweise "monitored" und Veränderungen werden meistens automatisch erkannt. Unter Umständen, falls es nicht funktioniert, ist ggf. nach der Einrichtung ein Re-Login oder auch ein Neustart erforderlich. ls /usr/share/polkit-1/actions insgesamt 804K drwxr-xr-x 2 root root 4,0K 2017-07-28 10:30 . drwxr-xr-x 3 root root 4,0K 2017-03-05 16:52 .. -rw-r--r-- 1 root root 5,9K 2016-12-29 18:29 LocalExtPermissions.policy selnic/usr/share/polkit-1/actions/LocalExtPermissions.policy0000644000175000017500000000203313631221261024101 0ustar thomasthomas auth_admin auth_admin yes /usr/local/bin/selnic true selnic/ReadMe0000644000175000017500000003042013631221066012762 0ustar thomasthomasSiehe auch: http://www.thlu.de/selnic.html Selnic ist ein Bash-Script mit dem Ziel, eine grundlegende Unterstützung beim Öffnen und Schließen eines Netzwerk-Adapters sowie beim Herstellen einer Netzwerkverbindung zu bieten. In gewisser Weise übernimmt Selnic einen Teil der Aufgaben eines traditionellen Netzwerk-Managers, ohne aber selber ein Netzwerk-Manager sein zu wollen. Selnic ist ein Terminalprogramm, es kann aber trotzdem auch via Desktopstarter gestartet werden. Weil selnic wegen dem Öffnen und Schließen von Netzwerkadaptern root-Rechte benötigt, ist hier eine Polkit-Policy plus einer Berechtigungsregel notwendig und auch sinnvoll. Selnic ist im Gegensatz zu den bekannten Netzwerk-Managern KEIN Daemon, sondern ein einfaches Bash- Script, eine reine Vordergrund-Anwendung, die bei Programmende auch wirklich beendet wird. Das gilt auch, wenn Selnic z.B. bei Systemstart im "stillen Mode" eine Verbindung herstellt. Im stillen Mode gibt es halt nur keine Bildschirmausgabe und das Programm beendet sich sofort nach Herstellung oder Trennen einer Verbindung. Das bedeutet aber auch, eine zur Rechnerlaufzeit abgerissene Verbindung wird von selnic NICHT wieder automatisch hergestellt. ========================================================================================================== Abhängigkeiten: Die obligarotischen Abhängigkeiten, wenn via Ethernet oder Wifi eine Netzwerkverbindung hergestellt werden soll: iw, wpasupplicant, isc-dhcp-client, iproute2 Darüber hinaus sind erforderlich: dialog, xterm (oder alternativ urxvt, lxterminal, xfce4-terminal) Prüfen der Abhängigkeiten: dpkg -l iw wpasupplicant isc-dhcp-client iproute2 dialog xterm ||/ Name Version Architektur Beschreibung ---------------------------------------------------------------------------------------------------------- ii dialog 1.3-20160828-2 amd64 Displays user-friendly dialog boxes from shell scripts ii iproute2 4.9.0-1 amd64 networking and traffic control tools ii isc-dhcp-client 4.3.5-3 amd64 DHCP client for automatically obtaining an IP address ii iw 4.9-0.1 amd64 tool for configuring Linux wireless devices ii wpasupplicant 2:2.4-1 amd64 client support for WPA and WPA2 (IEEE 802.11i) ii xterm 327-2 amd64 X terminal emulator ========================================================================================================== $ selnic -? Usage: selnic { -c SSID | -e ethnicname | -w wlannicname | -a | -f | -h | -m | -n | -k | -t | -u | -x | -? } -c NIC/SSID = Connect to NIC/SSID Mit LAN oder AP verbinden ({AP}.conf ist vorhanden) -e NIC = Set ETH-NIC Setze primäres Default-Interface für eth -w NIC = Set WLAN-NIC Setze primäres Default-Interface für wlan -u Username = Set current user User-credentials für mountctl@.service verwenden -a = Automode start, no GUI Connect Network + Mounts und beenden -f = Favorites Favorisiertes WLAN-Netzwerk erreichbar? -h = Hold Trace-File bei Programmende nicht löschen -m = Mount Mount Samba-Shares via mountctl@.service -n = No Request Keine Frage Einstellungen speichern? -k = Wait for Key Warte auf Tastendruck bei Exit im Trace-Mode -t = Trace-Mode Trace-Fenster -x = Automode stop, no GUI Umount + disconnect Network und beenden -? = Help Zeigt diese Hilfe Return-Codes: 0 = Keine Fehler 1 = Programm ip nicht gefunden 2 = Programm iw nicht gefunden 3 = Programm dhclient nicht gefunden 4 = Programm dialog nicht gefunden 5 = Programm wpa_supplicant nicht gefunden 6 = Netzwerk ist bereits verbunden 7 = SSID-wpa-conf nicht gefunden 8 = Netzwerk-Interface nicht gefunden 9 = AutoConnect durch selnic.conf fehlgeschlagen Ausführung Manuell: selnic -c Toms_WLAN_AP -w wlxec086b1e82ae Verbindet mit der SSID Toms_WLAN_AP und verwendet das NIC wlxec086b1e82ae selnic -c enp2s0 Verbindet mit dem Netzwerk und verwendet das ETH-NIC enp2s0 ei via desktop-starter: pkexec /usr/local/bin/selnic {parms} (Polkit-Authentication notwendig!) aliasing in ~/.bash.rc: alias selnic="pkexec /usr/local/bin/selnic" (dto.) via systemd-unit at boot /etc/systemd/system/selnic.service. ========================================================================================================== Wenn die folgenden Service-Units installiert sind, - /etc/systemd/system/mountctl.service - /etc/systemd/system/openvpn@.service ist Voraussetzung, dass auch die (bzw. eine alternative) mountctl-Infrastruktur installiert ist. Ebenso ist Voraussetzung, dass OpenVPN installiert ist. Zur interaktiven Anzeige der OpenVPN-Verbindung ist es darüber hinaus notwendig, in den OpenVPN-Client-Conf-Files das Log in der Datei /var/run/openvpn/client.log zu aktivieren. Die OpenVPN-Client-Conf-Files werden im Verzeichnis /etc/openvpn erwartet und nur dort gesucht. Wenn Selnic bereits im Boot-Prozess über eine Service-Unit gestartet werden und sofort auch Netzwerk-Mounts über die mountctl-Infrastruktur durchführen soll, so ist zwingend die Angabe des Usernamens erforderlich, unter dem die Mounts durchgeführt werden sollen. Das reguläre Verfahren ist, dass mountctl erst nach dem Login eines Users aktiv wird und zum Mount den Namen und die Credentials dieses Users verwendet. In der Boot-Phase ist jedoch kein Sambaberechtigter User bekannt. In dem Fall muss der User in der Service-Unit explizit angegeben werden, z.B.: ExecStart=/usr/local/bin/mountctl start thomas Wenn mountctl.service jedoch planmäßig von sessionctl oder von selnic im Vordergrund-Dialog gestartet wird, ist das nicht notwendig, weil in beiden Fällen durch sessionctl der angemeldete User bekannt ist. Wenn die Funktionen mountctl und openvpn nicht verwendet werden und die entsprechenden Service-Units nicht vorhanden sind, findet im Programm auch keine weitere Berücksichtigung statt. Ganz wichtig: selnic kann nicht konfliktfrei gleichzeitig mit dem dhcpd-Daemon und dem networkmanager-Daemon betrieben werden! ========================================================================================================== Start des Programmes: selnic Startet Programm mit Bedienoberfläche Mit den Auf- und Abwärtspfeiltasten wird der Cursor/Srcollbar bewegt. Die Leertaste setzt eine Option [*] oder entfernt eine Option [ ]. Mit Mouse-Klick auf OK, Auswahl OK oder Drücken der Enter-Taste werden die gewählten oder abgewählten Optionen ausgeführt. Zur Herstellung einer neuen SSID-Verbindung wird zuerst das "Primary" (s.u.) WLAN-Nic geöffnet und dann über die Option "verfügbare Netzwerke anzeigen" der gewünschte AP ausgewählt. Beide Optionen können auch gleichzeitig ausge- wählt und mit OK ausgeführt werden. Dann Verschlüsselung auswählen, Passwort eingeben und das ausgewählte Netz erscheint in der Liste im Main-Menü und kann ab jetzt zur wiederholten Herstellung einer Verbindung ausgewählt werden. Für jedes SSID-Netz wird im Verzeichnis /etc/wpa_supplicant eine eigene AccessPoint.conf angelegt. Sofern Selnic nicht in der Lage ist die passenden Netzwerkparameter herzustellen, kann die Conf problemlos von Hand bearbeitet und angepasst werden. Selnic verwendet selbstverständlich bei nächster Auswahl dieses AP die korrigierte Conf. selnic -c enp2s0 Öffnet Ethernet-NIC (Predictable NIC-Name) und versucht eine IP zu beziehen selnic -c eth0 Öffnet Ethernet-Adapter und versucht eine IP zu beziehen (Dieser Parameter ist nicht erforderlich, wenn nur eth0 existiert) selnic -c wlxec0834bc343 Öffnet WLAN-Adapter (Predictable NIC-Name) ohne Connect-Versuch selnic -c wlan0 Öffnet WLAN-Adapter wlan0 (alte Schreibweise) ohne Connect-Versuch (Dieser Parameter ist nicht erforderlich, wenn wlan0 existiert oder die WLAN-Adapter in alter Notation benannt sind: wlan0, wlan1) selnic -c Toms_AP Öffnet Primary-WLAN-NIC (wlan0) und versucht eine IP vom AP beziehen selnic -c Toms_AP -w wlxec08... Setzt wlxec0834bc343 als Primary-Nic und versucht eine Verbindung zu Toms_AP. Wenn mehrere WLAN-NICs vorhanden sind und wg. predictable NIC-Names keines als primäres NIC (analog wlan0) erkannt werden kann, muss immer -w {name} übergeben werden. Existiert nur 1 WLAN-NIC wird dieses automatisch als Primary deklariert. Client-Connects sind grundsätzlich nur via Primary-NIC möglich. selnic -e NIC Setzt primary ETH-NIC (wenn eth0 wg. Predictable NIC-Name nicht erkennbar ist) selnic -w NIC Setzt primary WLAN-NIC (wenn wlan0 wg. Predictable NIC-Name nicht erkennbar ist selnic -a Versucht anhand der Parameter in selnic.conf zu verbinden, öffnet ggf. auch NFS-Mounts, sofern diese in conf enthalten sind. Stiller Mode, kein GUI. Die Option -a eignet sich besonders, wenn es sich um eine quasi-statische Verbindung handelt, die bei jedem Start hergestellt werden soll. Die gültige Einstellung ist die letzte, bei der bei Programm-Ende die Frage "Speichern" mit "ja" beantwortet wurde. Verändern sich die definierten NICs oder AP muss aufgrund der Einfachheit der Conf-Struktur einmal neu gespeichert werden. Die Optionen -a und -x können idealerweise auch in einer Systemd-Service-Unit verwendet werden, um eine Verbindung bei Systemstart herzustellen (s.u.) Die Optionen -c SSID und -x eignen sich, wenn keine Net-Mounts hergestellt werden müssen. selnic -x Schließt NFS-Mount und trennt Netzwerkverbindung, stiller Mode, kein GUI Wenn die Verbindung zuvor via Systemd-Service-Unit erstellt wurde, ist in die Unit "ExecStop /usr/local/bin/selnic -x" einzutragen, um Mounts und Connection ordentlich zu schließen. selnic -t Öffnet zeitgleich zur Bedienoberfläche ein zusätzliches Trace-Fenster, in dem der Programm-Ablauf sowie die Systemkommandos verfolgt werden können. Der Trace-Ablauf ist in "/tmp/selnic_trace.$$" enthalten. Die Traceausgabe ist eineseits eine Debug-Hilfe, sie dient aber auch zur Anschauung, wann welcher Schritt bei der Netzwerkverbindung bearbitet wird. selnic -h Hold, löscht die mit Parameter -t angelegte Trace-Datei nicht bei Programmende. selnic -k Keypress, wartet auf einen Tastendruck bei Programmende, um die Traceausgabe bis zum endgültigen Programmende zu halten. selnic -n Unterdrückt nach Änderungen bei Programm-Ende die Frage, ob die Änderungen gespeichert werden sollen.