commit
681946dd6c
@ -47,6 +47,9 @@ _create_ap() {
|
|||||||
-m)
|
-m)
|
||||||
opts="nat bridge none"
|
opts="nat bridge none"
|
||||||
;;
|
;;
|
||||||
|
--psk)
|
||||||
|
# No Options
|
||||||
|
;;
|
||||||
--hidden)
|
--hidden)
|
||||||
# No Options
|
# No Options
|
||||||
;;
|
;;
|
||||||
|
29
create_ap
29
create_ap
@ -40,6 +40,7 @@ usage() {
|
|||||||
echo " Use: 'nat' for NAT (default)"
|
echo " Use: 'nat' for NAT (default)"
|
||||||
echo " 'bridge' for bridging"
|
echo " 'bridge' for bridging"
|
||||||
echo " 'none' for no Internet sharing (equivalent to -n)"
|
echo " 'none' for no Internet sharing (equivalent to -n)"
|
||||||
|
echo " --psk Use 64 hex digits pre-shared-key instead of passphrase"
|
||||||
echo " --hidden Make the Access Point hidden (do not broadcast the SSID)"
|
echo " --hidden Make the Access Point hidden (do not broadcast the SSID)"
|
||||||
echo " --ieee80211n Enable IEEE 802.11n (HT)"
|
echo " --ieee80211n Enable IEEE 802.11n (HT)"
|
||||||
echo " --ht_capab <HT> HT capabilities (default: [HT40+])"
|
echo " --ht_capab <HT> HT capabilities (default: [HT40+])"
|
||||||
@ -582,6 +583,7 @@ DAEMONIZE=0
|
|||||||
LIST_RUNNING=0
|
LIST_RUNNING=0
|
||||||
STOP_ID=
|
STOP_ID=
|
||||||
NO_HAVEGED=0
|
NO_HAVEGED=0
|
||||||
|
USE_PSK=0
|
||||||
|
|
||||||
CONFDIR=
|
CONFDIR=
|
||||||
WIFI_IFACE=
|
WIFI_IFACE=
|
||||||
@ -807,7 +809,7 @@ send_stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ARGS=( "$@" )
|
ARGS=( "$@" )
|
||||||
GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","version","no-haveged" -n "$PROGNAME" -- "$@")
|
GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","version","psk","no-haveged" -n "$PROGNAME" -- "$@")
|
||||||
[[ $? -ne 0 ]] && exit 1
|
[[ $? -ne 0 ]] && exit 1
|
||||||
eval set -- "$GETOPT_ARGS"
|
eval set -- "$GETOPT_ARGS"
|
||||||
|
|
||||||
@ -908,6 +910,10 @@ while :; do
|
|||||||
shift
|
shift
|
||||||
NO_HAVEGED=1
|
NO_HAVEGED=1
|
||||||
;;
|
;;
|
||||||
|
--psk)
|
||||||
|
shift
|
||||||
|
USE_PSK=1
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -1081,6 +1087,7 @@ else
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
while :; do
|
while :; do
|
||||||
|
if [[ $USE_PSK -eq 0 ]]; then
|
||||||
read -p "Passphrase: " -s PASSPHRASE
|
read -p "Passphrase: " -s PASSPHRASE
|
||||||
echo
|
echo
|
||||||
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then
|
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then
|
||||||
@ -1094,6 +1101,14 @@ else
|
|||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
read -p "PSK: " PASSPHRASE
|
||||||
|
echo
|
||||||
|
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -ne 64 ]]; then
|
||||||
|
echo "ERROR: Invalid pre-shared-key length ${#PASSPHRASE} (expected 64)" >&2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
read SSID
|
read SSID
|
||||||
@ -1111,10 +1126,15 @@ if [[ ${#SSID} -lt 1 || ${#SSID} -gt 32 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $USE_PSK -eq 0 ]]; then
|
||||||
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then
|
if [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -lt 8 ]] || [[ ${#PASSPHRASE} -gt 63 ]]; then
|
||||||
echo "ERROR: Invalid passphrase length ${#PASSPHRASE} (expected 8..63)" >&2
|
echo "ERROR: Invalid passphrase length ${#PASSPHRASE} (expected 8..63)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
elif [[ ${#PASSPHRASE} -gt 0 && ${#PASSPHRASE} -ne 64 ]]; then
|
||||||
|
echo "ERROR: Invalid pre-shared-key length ${#PASSPHRASE} (expected 64)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $(get_adapter_kernel_module ${WIFI_IFACE}) =~ ^rtl[0-9].*$ ]]; then
|
if [[ $(get_adapter_kernel_module ${WIFI_IFACE}) =~ ^rtl[0-9].*$ ]]; then
|
||||||
if [[ -n "$PASSPHRASE" ]]; then
|
if [[ -n "$PASSPHRASE" ]]; then
|
||||||
@ -1259,9 +1279,14 @@ fi
|
|||||||
|
|
||||||
if [[ -n "$PASSPHRASE" ]]; then
|
if [[ -n "$PASSPHRASE" ]]; then
|
||||||
[[ "$WPA_VERSION" == "1+2" ]] && WPA_VERSION=3
|
[[ "$WPA_VERSION" == "1+2" ]] && WPA_VERSION=3
|
||||||
|
if [[ $USE_PSK -eq 0 ]]; then
|
||||||
|
WPA_KEY_TYPE=passphrase
|
||||||
|
else
|
||||||
|
WPA_KEY_TYPE=psk
|
||||||
|
fi
|
||||||
cat << EOF >> $CONFDIR/hostapd.conf
|
cat << EOF >> $CONFDIR/hostapd.conf
|
||||||
wpa=${WPA_VERSION}
|
wpa=${WPA_VERSION}
|
||||||
wpa_passphrase=$PASSPHRASE
|
wpa_${WPA_KEY_TYPE}=${PASSPHRASE}
|
||||||
wpa_key_mgmt=WPA-PSK
|
wpa_key_mgmt=WPA-PSK
|
||||||
wpa_pairwise=TKIP CCMP
|
wpa_pairwise=TKIP CCMP
|
||||||
rsn_pairwise=CCMP
|
rsn_pairwise=CCMP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user