Merci pour la réponse.
J'ai avancé sur le sujet. En fait, bêta que je suis, je m'étais connecté en SSH avec un compte du group admin (comme évoqué dans la release note). Et j'avais tenté de lancer la commande en pensant qu'elle s'exécuterait en root. En le faisant avec un sudo je n'avais plus l'access denied.
Par contre le script ne fonctionnait tout de même pour plusieurs raisons. Notamment, le "ps" dans les tests qui ne suffit plus, j'ai du modifier pour faire un ps -aux. Voici le script qui fonctionne désormais correctement pour moi.
#!/bin/ash
# script for managing firewall, VPN connection and Download station scheduler #
#
# iptables binary path
iptables="/sbin/iptables"
# DLStation
DLStation="/var/packages/DownloadStation/scripts/start-stop-status"
#VPN interface
interface_vpn="tun0"
# Log file
logfile="/volume1/scripts/script_logs/vpn.log"
# TCP port authorized - to complete
vpn_tcp_port=5000,5001
# UDP port authorized
vpn_udp_port=
# OpenVPN configuration
## Rotterdam
openvpn_confid=oxxxxx
openvpn_configname=xxxxx
############### START SCRIPT ###################
# Is there a VPN connection ?
if [ -z "$(ifconfig | grep "$interface_vpn")" ]; then
echo $(date) ": VPN not started" >> $logfile
#No VPN, No Download station
$DLStation stop >> $logfile
if [ -n "$(ps -aux | grep -v "grep" | grep "/sbin/scheduler")" ] ; then
echo $(date) ": ERROR, DownloadStation is always on :/" >> $logfile
else
echo $(date) ": DownloadStation is stopped" >> $logfile
fi
# Trying to start VPN connection
echo $(date) ": Trying to start VPN connection..." >> $logfile
echo conf_id=$openvpn_confid > /usr/syno/etc/synovpnclient/vpnc_connecting
echo conf_name=$openvpn_configname >> /usr/syno/etc/synovpnclient/vpnc_connecting
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting
synovpnc connect --id=$openvpn_confid --retry=4 --interval=10 >> $logfile
fi
# Is there a VPN connection and can we ping google ?
if [ -z "$(ping -c 4 www.google.fr -4 | grep "64 bytes")" ] && [ -n "$(ifconfig | grep "$interface_vpn")" ] ; then
echo $(date) ": Ping failed to www.google.fr..." >> $logfile
#VPN is going to be stopped, stop Download station
$DLStation stop >> $logfile
if [ -n "$(ps -aux | grep -v "grep" | grep "/sbin/scheduler")" ]; then
echo $(date) ": ERROR, DownloadStation is always on :/" >> $logfile
else
echo $(date) ": DownloadStation is stopped" >> $logfile
fi
# kill the failed VPN connection
synovpnc kill_client >> $logfile
echo $(date) ": VPN connection closed" >> $logfile
wait 10000
# Trying to start VPN connection
echo $(date) ": Trying to start VPN connection..." >> $logfile
echo conf_id=$openvpn_confid > /usr/syno/etc/synovpnclient/vpnc_connecting
echo conf_name=$openvpn_configname >> /usr/syno/etc/synovpnclient/vpnc_connecting
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting
synovpnc connect --id=$openvpn_confid --retry=4 --interval=10 >> $logfile
else
# Firewall is up ?
if [ -n "$(ifconfig | grep "$interface_vpn")" ] && [ -z "$($iptables -L -v | grep "$interface_vpn")" ]; then
echo $(date) ": Interface " $interface_vpn " found but firewall is not configured..." >> $logfile
#Incoming tcp vpn connections ACCEPT
if [ -n "$vpn_tcp_port" ]; then
$iptables -A INPUT -i $interface_vpn -p tcp -m multiport --dports $vpn_tcp_port -j ACCEPT
fi
#Incoming udp vpn connections ACCEPT
if [ -n "$vpn_udp_port" ]; then
$iptables -A INPUT -i $interface_vpn -p udp -m multiport --dports $vpn_udp_port -j ACCEPT
fi
$iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#if none of the rules were matched DROP #
$iptables -A INPUT -i $interface_vpn -p tcp -j DROP
$iptables -A INPUT -i $interface_vpn -p udp -j DROP
$iptables -A INPUT -i $interface_vpn -p icmp -j DROP
echo $(date) ": Firewall configured successfully" >> $logfile
#VPN Connection and firewall are Ok, starting Download station
$DLStation start >> $logfile
if [ -n "$(ps -aux | grep -v "grep" | grep "/sbin/scheduler")" ] ; then
echo $(date) ": DownloadStation is started" >> $logfile
else
echo $(date) ": ERROR, DownloadStation is stopped (1)" >> $logfile
fi
else
# Firewall ok, last check
if [ -n "$(ifconfig | grep "$interface_vpn")" ] && [ -n "$($iptables -L -v | grep "$interface_vpn")" ]; then
#VPN Connection and firewall are Ok,
if [ -n "$(ps -aux | grep -v "grep" | grep "/sbin/scheduler")" ] ; then
#VPN Connection, firewall and Download station are Ok
echo $(date) ": All network configuration is OK" >> $logfile
else
#VPN Connection and firewall are Ok but not Download station
#try to start it
echo $(date) ": ERROR, DownloadStation is stopped (2)" >> $logfile
$DLStation start >> $logfile
if [ -n "$(ps -aux | grep -v "grep" | grep "/sbin/scheduler")" ] ; then
echo $(date) ": DownloadStation is started" >> $logfile
else
echo $(date) ": ERROR, DownloadStation is stopped (3)" >> $logfile
fi
fi
fi
fi
fi
exit 0;