|
@@ -129,6 +129,10 @@ start_openvpn() {
|
|
[ "${ynh_server_proto}" == tcp ] && proto=tcp-client
|
|
[ "${ynh_server_proto}" == tcp ] && proto=tcp-client
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+ # Unset firewall to let DNS and NTP resolution works
|
|
|
|
+ # Firewall is reset after vpn is mounted (more details on #1016)
|
|
|
|
+ unset_firewall
|
|
|
|
+
|
|
sync_time
|
|
sync_time
|
|
|
|
|
|
cp /etc/openvpn/client.conf{.tpl,}
|
|
cp /etc/openvpn/client.conf{.tpl,}
|
|
@@ -199,7 +203,21 @@ stop_openvpn() {
|
|
|
|
|
|
sync_time() {
|
|
sync_time() {
|
|
systemctl stop ntp
|
|
systemctl stop ntp
|
|
- ntpd -qg &> /dev/null
|
|
|
|
|
|
+ timeout 20 ntpd -qg &> /dev/null
|
|
|
|
+
|
|
|
|
+ # Some networks drop ntp port (udp 123).
|
|
|
|
+ # Try to get the date with an http request on the internetcube web site
|
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
|
+ http_date=`curl -sD - labriqueinter.net | grep '^Date:' | cut -d' ' -f3-6`
|
|
|
|
+ http_date_seconds=`date -d "${http_date}" +%s`
|
|
|
|
+ curr_date_seconds=`date +%s`
|
|
|
|
+
|
|
|
|
+ # Set the new date if it's greater than the current date
|
|
|
|
+ # So it does if 1970 year or if old fake-hwclock date is used
|
|
|
|
+ if [ $http_date_seconds -ge $curr_date_seconds ]; then
|
|
|
|
+ date -s "${http_date}"
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
systemctl start ntp
|
|
systemctl start ntp
|
|
}
|
|
}
|
|
|
|
|