I'm a long-time Linux user, but I'm not well-versed with the newer developments, esp. wrt Ubuntu and system(d) administration.
I have a very old PC that I want to use for a file server, Mercurial repo, FTP and WWW server, and a few other small company-internal webapps I made with Django.
Previously this all ran on an ancient Fedora, on an unencrypted disk, and all was launched from /etc/rc.local.
I've put a new HDD, and got Ubuntu 18.04 LTS on it. I'm now onto restoring the services, but I want to improve as well.
First, I want the valuable data (Django database, files in the file server, ...) to be on an encrypted partition. However my experience with disk encryption is that something asks you for the passphrase during bootup. I want to avoid that, since the server won't have a monitor or a keyboard attached. Second, I want to administer the services in a bit more official ("Ubuntian") way.
Current idea
- have the services' data on an encrypted partition, that is not listed in
/etc/fstab. - upon restart, the server will only have sshd, but the services won't be started and partition not mounted.
- I'd ssh to the machine, and run a script, that mounts the partition (asking me for the passphrase), and launches the services.
The machine is on an UPS, I expect to run the above procedure rarely (few times a year).
Question
Is the current idea any good? Better ways to do it?
If it's good, how to implement it? I can certainly go the "total DIY way" and write a huge script with the luks commands, iptables commands to open the ports, and invoke the services' daemons directly, but I want to learn something new here and do it the proper Ubuntu way™ :)
Any pointers or code/script examples are kindly appreciated!