diff --git a/conf/install_openvpn.conf.sample b/conf/install_openvpn.conf.sample index 44db1c4..5a8d05a 100644 --- a/conf/install_openvpn.conf.sample +++ b/conf/install_openvpn.conf.sample @@ -13,4 +13,4 @@ DEFAULT_KEY_EMAIL='support@oopen.de' DEFAULT_KEY_OU="Network Services" DEFAULT_KEY_ORG="O.OPEN" -DEFAULT_SERVER_CIPHER="" +DEFAULT_SERVER_CIPHER="AES-256-CBC" diff --git a/install_openvpn.sh b/install_openvpn.sh index 29aef93..ca130eb 100755 --- a/install_openvpn.sh +++ b/install_openvpn.sh @@ -603,26 +603,32 @@ echo -e "\033[32m--\033[m" echo "" echo "" -echo "Default Domain to push from OpenVPN server to the client." +echo "Search Domain(s) to push from OpenVPN server to the client." +echo "" +echo " - multiple domains are possible: use blank separated list of search domains" echo "" echo -e "Type \"\033[33mNone\033[m\" if no default domain should be pushed." echo "" -DEFAULT_DOMAIN="" +SEARCH_DOMAINS="" echononl "Default Domain to push to clients: " -while [[ "X$DEFAULT_DOMAIN" = "X" ]]; do - read DEFAULT_DOMAIN - if [[ "X$DEFAULT_DOMAIN" = "X" ]]; then +while [[ "X$SEARCH_DOMAINS" = "X" ]]; do + read SEARCH_DOMAINS + if [[ "X$SEARCH_DOMAINS" = "X" ]]; then echo -e "\n\t\033[33m\033[1mWrong Entry!\033[m\n" - echononl "Default Domain to pusch to clients" + echononl "Search Domain(s) to pusch to clients" continue else - _to_lower_default_domain="$(trim ${DEFAULT_DOMAIN,,})" - if [[ "$_to_lower_default_domain" = "none" ]]; then - DEFAULT_DOMAIN="" + _to_lower_search_domains="$(trim ${SEARCH_DOMAINS,,})" + if [[ "$_to_lower_search_domains" = "none" ]]; then + SEARCH_DOMAINS="" break; fi fi done +declare -a SEARCH_DOMAINS_ARR=() +for _domain in ${SEARCH_DOMAINS} ; do + SEARCH_DOMAINS_ARR+=("$_domain") +done echo "" echo -e "\033[32m--\033[m" @@ -726,8 +732,8 @@ if [[ -n "$DNS_SERVER" ]]; then else echo -e "\tDNS Server (push from server).......: \033[33mNone\033[m" fi -if [[ -n "$DEFAULT_DOMAIN" ]]; then - echo -e "\tDefault Domain (push from server)...: $DEFAULT_DOMAIN" +if [[ ${#SEARCH_DOMAINS_ARR[@]} -gt 0 ]]; then + echo -e "\tDefault Domain (push from server)...: ${SEARCH_DOMAINS_ARR[@]}" else echo -e "\tDefault Domain (push from server)...: \033[33mNone\033[m" fi @@ -886,14 +892,14 @@ DNS_SERVER="none" EOF fi -if [[ -n "$DEFAULT_DOMAIN" ]] ; then +if [[ ${#SEARCH_DOMAINS_ARR[@]} -gt 0 ]] ; then cat << EOF >> $_openvpn_name_conf_file 2> $log_file -DEFAULT_DOMAIN="$DEFAULT_DOMAIN" +SEARCH_DOMAINS="${SEARCH_DOMAINS_ARR[@]}" EOF else cat << EOF >> $_openvpn_name_conf_file 2> $log_file -DEFAULT_DOMAIN="none" +SEARCH_DOMAINS="none" EOF fi @@ -1709,10 +1715,13 @@ if [[ -n "$DNS_SERVER" ]]; then push "dhcp-option DNS ${DNS_SERVER}" EOF fi -if [[ -n "$DEFAULT_DOMAIN" ]]; then - cat <> ${_server_conf_file} 2>> "$log_file" -push "dhcp-option DOMAIN ${DEFAULT_DOMAIN}" + +if [[ ${#SEARCH_DOMAINS_ARR[@]} -gt 0 ]]; then + for _domain in ${SEARCH_DOMAINS_ARR[@]} ; do + cat <> ${_server_conf_file} 2>> "$log_file" +push "dhcp-option DOMAIN ${_domain}" EOF + done fi cat <> ${_server_conf_file} 2>> "$log_file"