-
Notifications
You must be signed in to change notification settings - Fork 1
/
berate_radius.sh
60 lines (51 loc) · 1.57 KB
/
berate_radius.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
export LC_ALL=C
PROGNAME="$(basename $0)"
usage() {
echo "Usage: "$PROGNAME" [-h] [--domain example.com] [--radius-password P@ssw0rd] [--radius-client-ip-range 0.0.0.0/0]"
echo
echo "Options:"
echo " -h, --help Show this help"
echo " -d, --domain <domain> Domain of the certificate (default: \"example.com\")"
echo " -p, --radius-password <password> Radius client password (default: \"P@ssw0rd\")"
echo " -r, --radius-client-ip-range <ip range> Radius client allowed IP range (default: \"0.0.0.0/0\")"
echo
}
# defaults
export PASSWORD="P@ssw0rd"
export RANGE="0.0.0.0/0"
export DOMAIN="example.com"
GETOPT_ARGS=$(getopt -o hd:p:r: -l "help","domain:","radius-password:","radius-client-ip-range:" -n "$PROGNAME" -- "$@")
[ $? -ne 0 ] && exit 1
eval set -- "$GETOPT_ARGS"
while :; do
case "$1" in
-h|--help)
usage
exit 0
;;
-d|--domain)
shift
DOMAIN="$1"
shift
;;
-p|--radius-password)
shift
PASSWORD="$1"
shift
;;
-r|--radius-client-ip-range)
shift
RANGE="$1"
shift
;;
--)
shift
break
;;
esac
done
/hostapd_configs/hostapd.conf.template > /hostapd_configs/hostapd.conf
/hostapd_configs/hostapd.radius_client.template > /hostapd_configs/hostapd.radius_client
# Add flag for verbosity
hostapd-mana /hostapd_configs/hostapd.conf