;; TODO before migration ;; - Change the IP address ;; - Change the domain name with the certificates (use-modules (gnu)) (use-service-modules certbot networking ssh web) (use-package-modules admin base emacs rsync screen tls version-control vim web) ;; Variables specific to the vm ;; Change them when deploying this configuration in production (define %vm-domain-name "ftp.replicant.cyberdimension.org") (define %ethernet-interface-name "eth0") (define %ipv4-interface-address "192.168.10.43") (define %ipv4-interface-netmask "255.255.255.0") (define %ipv4-interface-gateway "192.168.10.1") (define %ipv4-interface-dns1 "192.168.10.1") (define %ipv4-interface-dns2 "192.168.10.1") ;; Hack to Add IPv6 support (write "Hack to Add static IPv6 support:") (system "ip addr add 2001:910:1314:ffff:ffff::43/80 dev eth0 || true") (system "ip route add default via 2001:910:1314:ffff:ffff::1 || true") (define %nginx-deploy-hook (program-file "nginx-deploy-hook" #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read))) (kill pid SIGHUP)))) (operating-system (host-name %vm-domain-name) (locale "en_US.utf8") (timezone "America/New_York") (bootloader (bootloader-configuration (bootloader grub-bootloader) (target "/dev/vda"))) (file-systems (cons* (file-system (mount-point "/") (device (uuid "b1ecb69d-4bb6-4bcf-9ab6-6a4d40c227f8" 'ext4)) (type "ext4")) %base-file-systems)) (users (cons* (user-account (name "gnutoo") (comment "GNUtoo") (group "users") (home-directory "/home/gnutoo") (supplementary-groups '("wheel"))) (user-account (name "putti") (comment "Putti") (group "users") (home-directory "/home/putti") (supplementary-groups '("wheel"))) %base-user-accounts)) (packages (append (list (specification->package "nss-certs") certbot emacs-no-x git htop rsync screen vim) %base-packages)) (services (append (list (service openssh-service-type (openssh-configuration (port-number 222) (permit-root-login #t) (password-authentication? #f) (challenge-response-authentication? #f) (authorized-keys `(("root", (local-file "keys/gnutoo.pub"), (local-file "keys/putti.pub")) ("gnutoo", (local-file "keys/gnutoo.pub")) ("putti", (local-file "keys/putti.pub")) ) ) (use-pam? #f))) ;; A public IP address is needed to test that configuration file as ;; things like letsencrypt depends on it. ;; The vm will have a public IPv4 IP address when deployed, however ;; for testing we still need some sort of public IP address. ;; As the static-networking-service doesn't have ipv6 support yet, ;; because a netlink guile binding would be required to add support ;; for it in a clean way. It will eventually get done as it seem ;; important for GuiX to get it done. ;; In the mean time, we either need to switch to DHCP for testing and ;; get a public IPv6 address through that, or use some OpenVPN service ;; to get a public IPv4 address. (static-networking-service %ethernet-interface-name %ipv4-interface-address #:gateway %ipv4-interface-gateway #:netmask %ipv4-interface-netmask #:name-servers `( (unquote %ipv4-interface-dns1) (unquote %ipv4-interface-dns2) )) (service certbot-service-type (certbot-configuration (email "contact@replicant.us") (default-location #f) ;; /!\ When deploying rsync, Only act as an rsync master ;; and not client, else any person controlling the server ;; from which we rsync may be able to get certificates issues ;; for ftp.replicant.us (webroot "/srv/ftp") (certificates (list (certificate-configuration (domains `((unquote %vm-domain-name))) (deploy-hook %nginx-deploy-hook) (challenge #f) ) ) ) ) ) ;; Nginx has more of its configuration available through GuiX than ;; apache (service nginx-service-type (nginx-configuration (server-blocks (list (nginx-server-configuration (listen '("443 ssl")) (server-name `((unquote %vm-domain-name))) (ssl-certificate (string-append "/etc/letsencrypt/live/" %vm-domain-name "/fullchain.pem") ) (ssl-certificate-key (string-append "/etc/letsencrypt/live/" %vm-domain-name "/privkey.pem") ) (root "/srv/ftp/")) ) ) ) ) ) %base-services) ) )