howto, IOS openVPN client & Synology
Posted: Fri Mar 29, 2013 3:28 pm
I know there are a lot of people here struggling (including myself) to get the IOS OpenVpn client working with their Synology server. Yesterday I finally found out (after days of trial and error) how it works...
There are several steps to follow and a bit of modding in the Synology server via Telnet.
1. First, we will generate new keys and certs, I used this website (http://www.carbonwind.net/VPN/XCA_OpenV ... N.htm#toMm), very easy!! Here, you can download the tool to make the CA, certs and keys.
Please follow all steps, first you will create a CA.
With this CA you will create certs and keys. You can skip the Netscape part(s) and the Diffie-Hellman part.
After doing this, you export the PEM and CERT files you just created. Rename the PEM files to KEY files.
2. Now you need to copy all those files in two directories. (/var/packages/VPNCenter/target/etc/openvpn/keys AND /usr/syno/etc/packages/VPNCenter/openvpn/keys). I have DSM4.2, don't know if other versions have other paths to the 'key and cert' directories. I used the USB port on the Synology to copy/transfer the files from my pc. I advise to firstly create a new directory on a USB stick, in this case I created 'keys'. Here you can store all keys and certs you just made with the tool. So copy the files to the keys directory on the stick.
First, enable the Telnet access in your Control Panel by going to Terminal.
Log in your Synology with 'root' and use your admin password.
Go to the USB directory: cd /volumeUSB1/usbshare/keys
Copy all the files to the 2 directories:
cp *.key *.cert /var/packages/VPNCenter/target/etc/openvpn/keys
cp *.key *.cert /usr/syno/etc/packages/VPNCenter/openvpn/keys
3. Now we have to tell the server where the new files are located and which certs and keys he's got to use
Those parameters are located in the openvpn.conf file in this directory: /usr/syno/etc/packages/VPNCenter/openvpn
Type, cd /usr/syno/etc/packages/VPNCenter/openvpn I made a backup of this file by renaming to openvpnOLD.conf.
To do this, you type: mv openvpn.conf openvpnOLD.conf
Now, we got to edit this file, it is easier to edit on a pc, so we got to copy this file to the USB stick to transfer to the pc.
Type, cp openvpnOLD.conf /volumeUSB1/usbshare/
Next step, edit this file with notepad on your pc. Two parts must be edited, tell the server where keys and certs are located.
ca /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of CA you created'
cert /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of server crt you created'
key /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of server key you created'
AND change the reneg-sec 0 parameter to renege-sec 3600.
Now save this file to openvpn.conf
Insert the USB stick with the edited file in your Synology and go back to telnet.
Copy this file to the directory: cp openvpn.conf /usr/syno/etc/packages/VPNCenter/openvpn
4. Now, we are going to edit the client openvpn.conf file. (you will retrieve this file while doing an export in the config screen of VPN server, OpenVPN settings, export settings. The other files that come with the export can be deleted). We will copy/paste the newly generated keys and certs and CA in this file. Again, this is easier on the pc in notepad. 3 things are edited:
First the server address where the client has to connect to. remote 'ip address' 'portnumber'
Secondly we change reneg-sec 0 parameter to renege-sec 3600.
And lastly we copy the CA, cert and key files into this single file. These are the client files you created in the beginning.
Again, open in notepad the .key .crt and CA client files. Copy the content like this:
<ca>
------BEGIN CERTIFICATE-----
------END CERTIFICATE------
</ca>
<cert>
------BEGIN CERTIFICATE-----
------END CERTIFICATE------
</cert>
<key>
-------BEGIN RSA PRIVATE KEY------
-------END RSA PRIVATE KEY-------
</key>
Save your file. Now, put this file on your iPhone via iTunes.
Stop/Start your OpenVpn Server in your Control Panel (VERY IMPORTANT, otherwise he will not take the right config) et voilĂ this should work!!
Now enjoy your app!
There are several steps to follow and a bit of modding in the Synology server via Telnet.
1. First, we will generate new keys and certs, I used this website (http://www.carbonwind.net/VPN/XCA_OpenV ... N.htm#toMm), very easy!! Here, you can download the tool to make the CA, certs and keys.
Please follow all steps, first you will create a CA.
With this CA you will create certs and keys. You can skip the Netscape part(s) and the Diffie-Hellman part.
After doing this, you export the PEM and CERT files you just created. Rename the PEM files to KEY files.
2. Now you need to copy all those files in two directories. (/var/packages/VPNCenter/target/etc/openvpn/keys AND /usr/syno/etc/packages/VPNCenter/openvpn/keys). I have DSM4.2, don't know if other versions have other paths to the 'key and cert' directories. I used the USB port on the Synology to copy/transfer the files from my pc. I advise to firstly create a new directory on a USB stick, in this case I created 'keys'. Here you can store all keys and certs you just made with the tool. So copy the files to the keys directory on the stick.
First, enable the Telnet access in your Control Panel by going to Terminal.
Log in your Synology with 'root' and use your admin password.
Go to the USB directory: cd /volumeUSB1/usbshare/keys
Copy all the files to the 2 directories:
cp *.key *.cert /var/packages/VPNCenter/target/etc/openvpn/keys
cp *.key *.cert /usr/syno/etc/packages/VPNCenter/openvpn/keys
3. Now we have to tell the server where the new files are located and which certs and keys he's got to use
Those parameters are located in the openvpn.conf file in this directory: /usr/syno/etc/packages/VPNCenter/openvpn
Type, cd /usr/syno/etc/packages/VPNCenter/openvpn I made a backup of this file by renaming to openvpnOLD.conf.
To do this, you type: mv openvpn.conf openvpnOLD.conf
Now, we got to edit this file, it is easier to edit on a pc, so we got to copy this file to the USB stick to transfer to the pc.
Type, cp openvpnOLD.conf /volumeUSB1/usbshare/
Next step, edit this file with notepad on your pc. Two parts must be edited, tell the server where keys and certs are located.
ca /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of CA you created'
cert /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of server crt you created'
key /var/packages/VPNCenter/target/etc/openvpn/keys/'file name of server key you created'
AND change the reneg-sec 0 parameter to renege-sec 3600.
Now save this file to openvpn.conf
Insert the USB stick with the edited file in your Synology and go back to telnet.
Copy this file to the directory: cp openvpn.conf /usr/syno/etc/packages/VPNCenter/openvpn
4. Now, we are going to edit the client openvpn.conf file. (you will retrieve this file while doing an export in the config screen of VPN server, OpenVPN settings, export settings. The other files that come with the export can be deleted). We will copy/paste the newly generated keys and certs and CA in this file. Again, this is easier on the pc in notepad. 3 things are edited:
First the server address where the client has to connect to. remote 'ip address' 'portnumber'
Secondly we change reneg-sec 0 parameter to renege-sec 3600.
And lastly we copy the CA, cert and key files into this single file. These are the client files you created in the beginning.
Again, open in notepad the .key .crt and CA client files. Copy the content like this:
<ca>
------BEGIN CERTIFICATE-----
------END CERTIFICATE------
</ca>
<cert>
------BEGIN CERTIFICATE-----
------END CERTIFICATE------
</cert>
<key>
-------BEGIN RSA PRIVATE KEY------
-------END RSA PRIVATE KEY-------
</key>
Save your file. Now, put this file on your iPhone via iTunes.
Stop/Start your OpenVpn Server in your Control Panel (VERY IMPORTANT, otherwise he will not take the right config) et voilĂ this should work!!
Now enjoy your app!