Add variable 'ORG_SHORTCUT'. Change name of service output-files.

This commit is contained in:
Christoph 2019-07-15 15:01:41 +02:00
parent 20f0ebddd6
commit dda55a4cf4
3 changed files with 37 additions and 16 deletions

View File

@ -640,7 +640,16 @@ if $_copy_to_user_home_dir ; then
if [[ $? -ne 0 ]] ; then
_failed=true
fi
cp -a "$_client_conf_file" "${_home_dir}/VPN/${KEY_CN}-${NEW_KEY_NAME}/client-$(basename $_client_conf_file)"
if [[ -n "$ORG_SHORTCUT" ]]; then
cp -a "$_client_conf_file" \
"${_home_dir}/VPN/${KEY_CN}-${NEW_KEY_NAME}/client-${ORG_SHORTCUT}-$(basename $_client_conf_file)" \
>> $log_file 2>&1
else
cp -a "$_client_conf_file" \
"${_home_dir}/VPN/${KEY_CN}-${NEW_KEY_NAME}/client-${KEY_CN/VPN-/}-$(basename $_client_conf_file)" \
>> $log_file 2>&1
fi
if [[ $? -ne 0 ]] ; then
_failed=true
fi
@ -668,6 +677,10 @@ if $_copy_to_user_home_dir ; then
common name.......: ${KEY_CN}-${NEW_KEY_NAME}
password..........: ${KEY_PW}
EOF
echo "${KEY_PW}" > "${_home_dir}/VPN/${KEY_CN}-${NEW_KEY_NAME}/ovpn_pass"
if [[ $? -ne 0 ]] ; then
_failed=true
fi
if [[ $? -ne 0 ]] ; then
_failed=true
fi

View File

@ -597,14 +597,18 @@ cp -a "${OPENVPN_BASE_DIR}/keys/${NEW_KEY_NAME}.key" "${target_dir}/${KEY_CN}-${
if [[ $? -ne 0 ]] ; then
_failed=true
fi
cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/$(trim ${KEY_NAME/VPN/}) ${NEW_KEY_NAME}.conf"
if [[ $? -ne 0 ]] ; then
_failed=true
fi
cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/client-$(basename $_client_conf_file)"
if [[ -n "$ORG_SHORTCUT" ]]; then
cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/client-${ORG_SHORTCUT}-${NEW_KEY_NAME}.conf"
else
cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/client-${KEY_CN/VPN-/}-${NEW_KEY_NAME}.conf"
fi
if [[ $? -ne 0 ]] ; then
_failed=true
fi
#cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/client-$(basename $_client_conf_file)"
#if [[ $? -ne 0 ]] ; then
# _failed=true
#fi
cp -a "$_client_conf_file" "${target_dir}/${KEY_CN}-${NEW_KEY_NAME}/${KEY_CN}-${NEW_KEY_NAME}.ovpn"
if [[ $? -ne 0 ]] ; then
_failed=true

View File

@ -319,22 +319,22 @@ if $(grep -q -E "SERVER_PORT=$SERVER_PORT" ${script_dir}/conf/server-*.conf 2> /
fi
echo ""
echo "Insert abbreviation (acronym) for the company or organisation"
echo "Insert shortcut (acronym) for the company or organisation"
echo ""
echo " Example: 'AKB' or 'FLR' or 'OPP' or.."
echo ""
ORG_ACRONYM=""
ORG_SHORTCUT=""
echononl "Organisations acronym: "
read ORG_ACRONYM
while [ "X$ORG_ACRONYM" = "X" ] ; do
read ORG_SHORTCUT
while [ "X$ORG_SHORTCUT" = "X" ] ; do
echo -e "\n\t\033[33m\033[1mSetting 'OpenVPN Name' is required!\033[m\n"
echononl "Organisations acronym: "
read ORG_ACRONYM
echononl "Organisations shortcut: "
read ORG_SHORTCUT
done
DEFAULT_KEY_NAME="VPN $ORG_ACRONYM"
DEFAULT_KEY_CN="VPN-$ORG_ACRONYM"
DEFAULT_KEY_ALTNAMES="VPN $ORG_ACRONYM"
DEFAULT_KEY_NAME="VPN $ORG_SHORTCUT"
DEFAULT_KEY_CN="VPN-$ORG_SHORTCUT"
DEFAULT_KEY_ALTNAMES="VPN $ORG_SHORTCUT"
echo ""
@ -742,7 +742,9 @@ echo ""
echo -e "\tOpenVPN IP-Address/Hostname.........: $OPENVPN_SERVER"
echo -e "\tOpenVPN Server.Port.................: $SERVER_PORT"
echo ""
echo -e "\tOpenVPN Servive Name................: $OPENVPN_NAME"
echo -e "\tOrganisation shortcut...............: $ORG_SHORTCUT"
echo ""
echo -e "\tOpenVPN Service Name................: $OPENVPN_NAME"
echo -e "\tOpenVPN Base Directory..............: $OPENVPN_BASE_DIR"
echo -e "\tOpenVPN 'easy-rsa' Directory........: $EASY_RSA_DIR"
echo -e "\tOpenVPN 'ccd' Directory.............: $OPENVPN_CCD_DIR"
@ -844,6 +846,8 @@ cat << EOF > $_openvpn_name_conf_file 2> $log_file
OPENVPN_SERVER="$OPENVPN_SERVER"
SERVER_PORT=$SERVER_PORT
ORG_SHORTCUT="$ORG_SHORTCUT"
OPENVPN_NAME="$OPENVPN_NAME"
OPENVPN_BASE_DIR="$OPENVPN_BASE_DIR"