Browse Source

add script-security when upgrading config

HgO 1 year ago
parent
commit
0ec70e1bf6
1 changed files with 7 additions and 0 deletions
  1. 7 0
      scripts/_common.sh

+ 7 - 0
scripts/_common.sh

@@ -198,6 +198,13 @@ function convert_ovpn_file()
   sed -i 's@^\s*key\s.*$@key /etc/openvpn/keys/user.key@g' ${config_file}
   sed -i 's@^\s*tls-auth\s.*$@tls-auth /etc/openvpn/keys/user_ta.key 1@g' ${config_file}
 
+  script_security="script-security 2"
+  if grep -q '^\s*script-security\s.*$' ${config_file}; then
+    sed -i "s@^\s*script-security\s.*\$@$script_security@g" ${config_file}
+  else
+    echo "$script_security" >> ${config_file}
+  fi
+
   route_up='route-up "/etc/openvpn/scripts/run-parts.sh route-up"'
   if grep -q '^\s*route-up\s.*$' ${config_file}; then
     sed -i "s@^\s*route-up\s.*\$@$route_up@g" ${config_file}