Limit number of characters in ESSID and password

This commit is contained in:
Bob Mottram 2014-12-25 16:57:00 +00:00
parent a6406fda29
commit 19be45ced7
1 changed files with 11 additions and 3 deletions

View File

@ -7155,11 +7155,13 @@ function enable_wifi_hotspot {
# Create an ESSID if one doesn't exist # Create an ESSID if one doesn't exist
if [ ! $WIFI_ESSID ]; then if [ ! $WIFI_ESSID ]; then
WIFI_ESSID="Freedom"$(openssl rand -base64 4) TEMP_WIFI_ESSID="Freedom"$(openssl rand -base64 8)
WIFI_ESSID=${$TEMP_WIFI_ESSID:0:3}
fi fi
# Add a password # Add a password
if [ ! $WIFI_PASSWORD ]; then if [ ! $WIFI_PASSWORD ]; then
WIFI_PASSWORD=$(openssl rand -base64 8) TEMP_WIFI_PASSWORD=$(openssl rand -base64 8)
WIFI_PASSWORD=$($TEMP_WIFI_PASSWORD:0:8}
fi fi
sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd
@ -7261,9 +7263,15 @@ function enable_wifi {
# Create an ESSID if one doesn't exist # Create an ESSID if one doesn't exist
if [ ! $WIFI_ESSID ]; then if [ ! $WIFI_ESSID ]; then
WIFI_ESSID="Freedom"$(openssl rand -base64 4) TEMP_WIFI_ESSID="Freedom"$(openssl rand -base64 8)
WIFI_ESSID=${$TEMP_WIFI_ESSID:0:3}
fi fi
sed -i "s/essid/$WIFI_ESSID/g" /etc/network/interfaces sed -i "s/essid/$WIFI_ESSID/g" /etc/network/interfaces
# Add a password
if [ ! $WIFI_PASSWORD ]; then
TEMP_WIFI_PASSWORD=$(openssl rand -base64 8)
WIFI_PASSWORD=$($TEMP_WIFI_PASSWORD:0:8}
fi
# Add a password # Add a password
if [ $WIFI_PASSWORD ]; then if [ $WIFI_PASSWORD ]; then