<Guide> Enabling OpenVPN/iptables combo in Custom Firmware

Thanks very much for the write-ups TCWORLD.

On your 5th section about setting up OpenVPN, the issue you mentioned about being unable to permanently save changes because the OS gets refreshed from the flash everytime on reboot, is the part that I can definitely help you with (hopefully I understood your issue correctly). In fact, everything that I have done in the past year in my custom compiled firmware, has been primarily to bake-in all my custom scripts and other custom config files into the firmware, before I compiled it.

So the three things that you need to know are:

  1. you can put all your custom shell scripts along with other shells scripts in /path_to_extracted_source/WDMyCloud_EX2_GPL_vXX/module/crfs/scripts

  2. the startup script is system_init in that directory. If you want to add/modify behavior during startup, just edit that (invoking any custom scripts where needed)

  3. most of the config files that are pulled into /etc/ come from one file default.tar.gz inside /firmware/merge directory (although I am running a couple firmware versions behind and don’t see that mentioned in your list of files in the merge directory when you compile the firmware so I am not sure if WD changed things up a bit in last couple most recent firmware versions and removed it from there and put it elsewhere). Inside this tarball is the very important config.xml (among other default config files), where you can hardcode any config changes you like and it then gets copied to /usr/local/config/config.xml during firmware upgrade and then on each subsequent reboot /usr/local/config/config.xml gets copied to /etc/NAS_CFG/config.xml. Any changes you make to config via the dashboard like say ftp configs, etc. gets saved to the /usr/local/config/config.xml

Those 3 places where I have a lot (but not all) of my changes located. I do have a few other places where I updated things And yes, I too have been using the /usr/local/config directory to store my custom configs to preserve between reboots :slight_smile:

Once you compile the firmware, that script directory (/module/crfs/scripts) will be located at /usr/local/modules/scripts/ on the NAS.

Hope this helps. Feel free to PM me if you have any questions.