Category: DSM4.1

Synology DSM4.x change OpenVpn Server default port and protocol

The OpenVPN GUI configuration of my DS209 and DS109 has limited options. For instance, it is not possible to change the port and protocol, but we can manually modify its configuration file. My purposes is to change the port from 1194 to 1199 and the protocol from UDP to TCP.

Mainly everything is located here: /usr/syno/etc/packages/VPNCenter/openvpn, there is the configuration file and the keys folder.

Open openvpn.conf and

  • to change the default port add the line “port <n>” where <n> is the port number
  • to change the default protocol UDP to TCP add the line “proto tcp

Here is my configuration:

DS109> cat /usr/syno/etc/packages/VPNCenter/openvpn/openvpn.conf
push "route 192.168.1.0 255.255.255.0"
push "route 10.8.0.0 255.255.255.0"

dev tun

#these two are manually added
port 1199
proto tcp

management 127.0.0.1 1195

server 10.8.0.0 255.255.255.0

dh /var/packages/VPNCenter/target/etc/openvpn/keys/dh1024.pem
ca /var/packages/VPNCenter/target/etc/openvpn/keys/ca.crt
cert /var/packages/VPNCenter/target/etc/openvpn/keys/server.crt
key /var/packages/VPNCenter/target/etc/openvpn/keys/server.key

max-clients 3

persist-tun
persist-key

verb 3

#log-append /var/log/openvpn.log

keepalive 10 60
reneg-sec 0

plugin /var/packages/VPNCenter/target/lib/radiusplugin.so /var/packages/VPNCenter/target/etc/openvpn/radiusplugin.cnf 
client-cert-not-required 
username-as-common-name
duplicate-cn

You can now restart the OpenVPN server using the DSM GUI or manually as follows. Verify where the script openvpn.sh is located, in fact on previous versions of Synology DSMs the command was completely different (VPNCenter.sh)

DS109> find . -name openvpn.sh
./volume1/@appstore/VPNCenter/scripts/openvpn.sh

stop and start again the OpenVpn server

DS109> ./volume1/@appstore/VPNCenter/scripts/openvpn.sh stop
Stopping openvpn ...
Stopping FreeRADIUS: radiusd.

DS109> ./volume1/@appstore/VPNCenter/scripts/openvpn.sh start
Starting FreeRADIUS:radiusd
Starting openvpn ...
Fri Mar 15 12:13:10 2013 RADIUS-PLUGIN: Configfile name: /var/packages/VPNCenter/target/etc/openvpn/radiusplugin.cnf.
DS109> Fri Mar 15 12:13:13 2013 RADIUS-PLUGIN: No attributes Acct Interim Interval or bad length.
Fri Mar 15 12:13:13 2013 RADIUS-PLUGIN: Client config file was not written, overwriteccfiles is false

Enjoy now your VPN

 

How to reset the password of MySQL database on your Synology

I forgot the password to access the database on my NAS Synology DS209. Here how to reset it:

  • Go to the Main Menu > Control Panel > Restore Defaults page of the web management UI (actually DSM v4.0).
  • Click Reset MySQL Database Password and then click Apply.

synology_how_to_reset_mysql_password

 Password of MySQL database will be reset to blank.

Install IPKG on Synology DS209 and similar models based on DSM4.0/DSM4.1/DSM4.2

Since DSM4.0 has been released, the usual procedure to install the ipkg package manager doesn’t work anymore. Following is my procedure to install ipkg on my Synology DS209, tested with DSM4.0-2228, DSM 4.1-2636, DSM 4.2-3248, but it should work also on different models.

First, which cpu has my DS209? It’s a Marvel KirkWood mv6281 (link). Go on with the bootstrap script.

cd /volume1/@tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/syno-mvkw-bootstrap_1.2-7_arm.xsh
sh syno-mvkw-bootstrap_1.2-7_arm.xsh

Edit /root/.profile and add immediately after the line starting with PATH= /opt/bin:/opt/sbin: in order to obtain

PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
export PATH

Do not add that at the end of the PATH because actually there are two wget binaries, one in /opt/bin and the original by Synology in /usr/syno/bin/wget. When you run the ipkg update command an instance of wget is open and only the first one must the invoked.

Reload the profile and delete the bootstrap script.

. /root/.profile
rm syno-mvkw-bootstrap_1.2-7_arm.xsh

 

One additional step if you have a previous release than DSM4.0-2228

Ipkg works inside /opt while on Synology that directory is called @optoware instead, so edit /etc/rc.local in order to obtain

#!/bin/sh
mount -o bind /volume1/@optware /opt
# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start
exit 0

Reload rc.local setting

/etc/rc.local

Check if the binding is correctly set, with a simple

mount | grep bind

you should get

/volume1/@optware on /opt type bind (bind)

 

Use of ipkg

We can download the packages list

ipkg update

To know all the packages available:

ipkg list

Now we can install one of the available package, for example nano and wakelan

ipkg install nano
ipkg install wakelan

To uninstall a package

ipkg remove <package name>

To know all the packages installed:

ipkg list_installed

 

WordPress Themes