From 3b8b237c32dea2eeb79bf5f8adc6309f14e87c1e Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 17 Aug 2022 16:24:06 +0200 Subject: [PATCH] create_key_config.sh,build_key-pass.sh: some minor changes on naming 'ta.key' and 'ca.cert'. --- build_key-pass.sh | 25 ++++++++++++++++++------- create_key_config.sh | 25 ++++++++++++++++++------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/build_key-pass.sh b/build_key-pass.sh index 17d56ef..e83e83d 100755 --- a/build_key-pass.sh +++ b/build_key-pass.sh @@ -800,13 +800,24 @@ if $_copy_to_user_home_dir ; then if [[ $? -ne 0 ]] ; then _failed=true fi - cp -a "${_CA_CERT}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_CA_CERT})" >> $log_file 2>&1 - if [[ $? -ne 0 ]] ; then - _failed=true - fi - cp -a "${_TA_KEY}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_TA_KEY})" >> $log_file 2>&1 - if [[ $? -ne 0 ]] ; then - _failed=true + if [[ -n "$ORG_SHORTCUT" ]]; then + cp -a "${_CA_CERT}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_CA_CERT})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi + cp -a "${_TA_KEY}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_TA_KEY})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi + else + cp -a "${_CA_CERT}" "${_target_dir}/VPN-${KEY_CN/VPN-/}-$(basename ${_CA_CERT})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi + cp -a "${_TA_KEY}" "${_target_dir}/VPN-${KEY_CN/VPN-KEY_CN/VPN-/basename ${_TA_KEY})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi fi cat << EOF > "${_target_dir}/passwd.txt" key...............: $(basename "$_CLIENT_KEY") diff --git a/create_key_config.sh b/create_key_config.sh index b3cf7ca..baebe59 100755 --- a/create_key_config.sh +++ b/create_key_config.sh @@ -695,13 +695,24 @@ cp -a "${_CLIENT_CERT}" "${_target_dir}/" >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi -cp -a "${_CA_CERT}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_CA_CERT})" >> $log_file 2>&1 -if [[ $? -ne 0 ]] ; then - _failed=true -fi -cp -a "${_TA_KEY}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_TA_KEY})" >> $log_file 2>&1 -if [[ $? -ne 0 ]] ; then - _failed=true +if [[ -n "$ORG_SHORTCUT" ]]; then + cp -a "${_CA_CERT}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_CA_CERT})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi + cp -a "${_TA_KEY}" "${_target_dir}/VPN-${ORG_SHORTCUT}-$(basename ${_TA_KEY})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi +else + cp -a "${_CA_CERT}" "${_target_dir}/VPN-${KEY_CN/VPN-/}-$(basename ${_CA_CERT})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi + cp -a "${_TA_KEY}" "${_target_dir}/VPN-${KEY_CN/VPN-/}-$(basename ${_TA_KEY})" >> $log_file 2>&1 + if [[ $? -ne 0 ]] ; then + _failed=true + fi fi cat << EOF > "${_target_dir}/passwd.txt" key...............: $(basename "$_CLIENT_KEY")