Browse Source

Add time syncing before launching openvpn, to avoid issues due to 'certificate not yet valid'

Julien Vaubourg 7 years ago
parent
commit
355b24ea0c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      conf/ynh-vpnclient

+ 8 - 0
conf/ynh-vpnclient

@@ -129,6 +129,8 @@ start_openvpn() {
     [ "${ynh_server_proto}" == tcp ] && proto=tcp-client
     [ "${ynh_server_proto}" == tcp ] && proto=tcp-client
   fi
   fi
 
 
+  sync_time
+
   cp /etc/openvpn/client.conf{.tpl,}
   cp /etc/openvpn/client.conf{.tpl,}
 
 
   sed "s|<TPL:SERVER_NAME>|${ynh_server_name}|g" -i /etc/openvpn/client.conf
   sed "s|<TPL:SERVER_NAME>|${ynh_server_name}|g" -i /etc/openvpn/client.conf
@@ -195,6 +197,12 @@ stop_openvpn() {
 
 
 ## Tools
 ## Tools
 
 
+sync_time() {
+  systemctl stop ntp
+  ntpd -qg &> /dev/null
+  systemctl start ntp
+}
+
 ynh_setting_get() {
 ynh_setting_get() {
   app=${1}
   app=${1}
   setting=${2}
   setting=${2}