This guide covers a concept to allow a Synology NAS to automatically mount encrypted shared folders on boot or reboot after a power failure. The keystore should be made unavailable, which prevents the NAS from mounting the encrypted shared folder(s). This guide assumes you are familiar with the encryption and keystore concepts of a Synology NAS running DSM 6.2 or above. In my setup, all shared folders which contain sensitive data are protected through a volume key. The key is served from a key server on a different location, which serves the key on condition that the correct machine key (stored on the machine to protect) and the correct IP address, from which the request originates, is provided.
This guide covers a concept to allow a Debian machine to automatically mount encrypted volumes on boot or reboot after a power failure. This guide assumes you are familiar with LUKS encryption and concepts of Debian. In my setup, I put the entire /home directory on a 4TB RAID1 partition, which is protected through a volume key. The key is served from a key server on a different location, which serves the key on condition that the correct machine key (stored on the machine to protect) and the correct IP address, from which the request originates, is provided.
The key server sends the volume string upon demand from a trusted IP address. The volume string can be decripted with the machine key to obtain the volume key. To obtain a valid volume key, all 3 conditions must be met: valid requester IP address, matching volume string, and matching machine key.
bash /volume1/homes/bco/batch/cryptmount.sh https://your.server.tld/synology.php encrypted <machine key> pingable.server.tld 60 10
echo -n "<encryption key>" | openssl enc -aes-256-cbc -a -salt -pass pass:<machine key>
Make sure to allow sufficient time on boot of the machine to mount the encrypted volume and auto-logon a user, if the user home directory resides on the encrypted volume. 30 seconds should be sufficient, depending on the maximum time your machine needs to get access to the network, but might be longer. The following steps must be completed in sequence during machine boot: