From a0409b439901668e478f3da0cd7ff0ff0daa5e9d Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Wed, 21 Jul 2021 23:12:06 -0500 Subject: [PATCH] Cleanup - In rare cases, if a parent process traps SIGPIPE, the 'tr' command in the VPN setup scripts could output an error 'tr: write error: Broken pipe'. This is a cosmetic error that does NOT affect the functionality of the scripts. This commit hides the error in such cases. --- extras/ikev2setup.sh | 2 +- vpnsetup.sh | 4 ++-- vpnsetup_amzn.sh | 4 ++-- vpnsetup_centos.sh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index 9be5596..c6190ea 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -701,7 +701,7 @@ create_client_cert() { export_p12_file() { bigecho2 "Creating client configuration..." - p12_password=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 18) + p12_password=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 18) [ -z "$p12_password" ] && exiterr "Could not generate a random password for .p12 file." p12_file="$export_dir$client_name.p12" diff --git a/vpnsetup.sh b/vpnsetup.sh index e79200e..a21f559 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -111,9 +111,9 @@ fi if [ -z "$VPN_IPSEC_PSK" ] && [ -z "$VPN_USER" ] && [ -z "$VPN_PASSWORD" ]; then bigecho "VPN credentials not set by user. Generating random PSK and password..." - VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 20) + VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 20) VPN_USER=vpnuser - VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 16) + VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 16) fi if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then diff --git a/vpnsetup_amzn.sh b/vpnsetup_amzn.sh index 7988894..788a43c 100755 --- a/vpnsetup_amzn.sh +++ b/vpnsetup_amzn.sh @@ -84,9 +84,9 @@ fi if [ -z "$VPN_IPSEC_PSK" ] && [ -z "$VPN_USER" ] && [ -z "$VPN_PASSWORD" ]; then bigecho "VPN credentials not set by user. Generating random PSK and password..." - VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 20) + VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 20) VPN_USER=vpnuser - VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 16) + VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 16) fi if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 43482a6..9109b9e 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -100,9 +100,9 @@ fi if [ -z "$VPN_IPSEC_PSK" ] && [ -z "$VPN_USER" ] && [ -z "$VPN_PASSWORD" ]; then bigecho "VPN credentials not set by user. Generating random PSK and password..." - VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 20) + VPN_IPSEC_PSK=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 20) VPN_USER=vpnuser - VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' < /dev/urandom | head -c 16) + VPN_PASSWORD=$(LC_CTYPE=C tr -dc 'A-HJ-NPR-Za-km-z2-9' /dev/null | head -c 16) fi if [ -z "$VPN_IPSEC_PSK" ] || [ -z "$VPN_USER" ] || [ -z "$VPN_PASSWORD" ]; then