summaryrefslogtreecommitdiffstats
path: root/ftp.replicant.us_stage1.scm
diff options
context:
space:
mode:
Diffstat (limited to 'ftp.replicant.us_stage1.scm')
-rw-r--r--ftp.replicant.us_stage1.scm144
1 files changed, 144 insertions, 0 deletions
diff --git a/ftp.replicant.us_stage1.scm b/ftp.replicant.us_stage1.scm
new file mode 100644
index 0000000..c464d02
--- /dev/null
+++ b/ftp.replicant.us_stage1.scm
@@ -0,0 +1,144 @@
+;; TODO before migration
+;; - Change the IP address
+;; - Change the domain name with the certificates
+;; TODO after:
+;; - rsync from osuosl
+;; - rsync service
+
+(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")
+;; TODO:
+;; - Define IPv4 and IPv6 configuration here
+
+;; 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 "eth0" "192.168.10.43"
+ #:gateway "192.168.10.1"
+ #:netmask "255.255.255.0"
+ #:name-servers '("192.168.10.1"
+ "192.168.10.2"))
+
+ (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 '("80"))
+ (root "/srv/ftp/"))
+ )
+ )
+ )
+ )
+ )
+ %base-services)
+ )
+ )