You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
555 B
24 lines
555 B
#!/usr/bin/env bash
|
|
|
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
source $DIR/env.sh
|
|
|
|
if [[ ! -e $SECRETSFILE ]] || [[ ! -r $SECRETSFILE ]] || [[ ! -w $SECRETSFILE ]]; then
|
|
echo "$SECRETSFILE is not exist or not accessible (are you root?)"
|
|
exit 1
|
|
fi
|
|
|
|
unset PSK
|
|
|
|
while [[ -z "$PSK" ]];
|
|
do
|
|
read -p "Enter preferred IPsec pre-shared key (PSK) : " PSK
|
|
echo
|
|
done
|
|
|
|
# comment existing PSK
|
|
sed -i -e "/[[:space:]]\+PSK[[:space:]]\+/s/^/# /" $SECRETSFILE
|
|
|
|
echo -e "\n%any %any : PSK \"$PSK\"" >> $SECRETSFILE
|
|
|
|
echo "$SECRETSFILE updated!"
|
|
|