-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use random wifi password by default, make country code configurable
- Dynamically generate and use /var/run/hostapd.conf using /etc/hostapd.conf.in and config - Generate random wifi password if not set, this will be the default - Introduce AAWG_WIFI_PASSWORD and AAWG_COUNTRY_CODE configurations in /etc/aawgd.conf.sh
- Loading branch information
1 parent
84ca61d
commit 2fd94ed
Showing
7 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/S39hostapd_conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
# | ||
# Setup hostapd configuration | ||
# | ||
|
||
case "$1" in | ||
start) | ||
if [ -z "$AAWG_CONF_SOURCED" ]; then | ||
echo "Source /etc/aawgd.conf.sh" | ||
source /etc/aawgd.conf.sh | ||
fi | ||
|
||
echo "Generate hostapd configuration at /var/run/hostapd.conf" | ||
|
||
cp /etc/hostapd.conf.in /var/run/hostapd.conf | ||
|
||
echo >> /var/run/hostapd.conf | ||
|
||
# Add Wifi password | ||
if [ -n "${AAWG_WIFI_PASSWORD}" ]; then | ||
echo "wpa_passphrase=${AAWG_WIFI_PASSWORD}" >> /var/run/hostapd.conf | ||
fi | ||
|
||
# Add Wifi country code if set | ||
if [ -n "${AAWG_COUNTRY_CODE}" ]; then | ||
echo "country_code=${AAWG_COUNTRY_CODE}" >> /var/run/hostapd.conf | ||
fi | ||
;; | ||
*) | ||
echo "Usage: $0 {start}" | ||
exit 1 | ||
esac | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/rcS_aawgd_conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
# | ||
# Setup AAWG configuration | ||
# | ||
set -o allexport | ||
|
||
if [ -z "$AAWG_CONF_SOURCED" ]; then | ||
echo "Source /etc/aawgd.conf.sh" | ||
source /etc/aawgd.conf.sh | ||
export AAWG_CONF_SOURCED=1 | ||
fi | ||
|
||
|
||
## Setup Wifi password | ||
if [ -z "${AAWG_WIFI_PASSWORD}" ]; then | ||
export AAWG_WIFI_PASSWORD="$(cat /dev/urandom | tr -dc 'A-Za-z0-9@#' | head -c 16)" | ||
fi | ||
|
||
set +o allexport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters