linode-locke-lamora-current-config.scm 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. ;; this is the current configuration for my linode "Guix System"
  2. (add-to-load-path (dirname (current-filename)))
  3. (use-modules (gnu)
  4. (guix modules)
  5. (secret nginx)
  6. (secret public-keys)
  7. ;;(gnucode-form)
  8. (mail)
  9. )
  10. (use-service-modules admin ; unattended-upgrades
  11. certbot
  12. mail
  13. messaging
  14. networking
  15. ssh
  16. web)
  17. (use-package-modules admin
  18. certs
  19. package-management
  20. ssh
  21. tls)
  22. (define %nginx-deploy-hook
  23. (program-file
  24. "nginx-deploy-hook"
  25. #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read)))
  26. (kill pid SIGHUP))))
  27. (define %user "joshua")
  28. (operating-system
  29. (host-name "locke-lamora")
  30. (timezone "America/Chicago")
  31. (locale "en_US.UTF-8")
  32. ;; This goofy code will generate the grub.cfg
  33. ;; without installing the grub bootloader on disk.
  34. (bootloader (bootloader-configuration
  35. (bootloader
  36. (bootloader
  37. (inherit grub-bootloader)
  38. (installer #~(const #t))))))
  39. (file-systems (cons (file-system
  40. (device "/dev/sda")
  41. (mount-point "/")
  42. (type "ext4"))
  43. %base-file-systems))
  44. (swap-devices (list "/dev/sdb"))
  45. (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
  46. %base-initrd-modules))
  47. (users (cons* (user-account
  48. (name "joshua")
  49. (group "users")
  50. ;; Adding the account to the "wheel" group
  51. ;; makes it a sudoer.
  52. (supplementary-groups '("wheel"))
  53. (home-directory "/home/joshua"))
  54. (user-account
  55. (name "andrew")
  56. (group "users")
  57. (supplementary-groups '("wheel"))
  58. (home-directory "/home/andrew"))
  59. %base-user-accounts))
  60. (sudoers-file
  61. (plain-file "sudoers"
  62. (string-append (plain-file-content %sudoers-specification)
  63. (format #f "~a ALL = NOPASSWD: ALL~%"
  64. "joshua"))))
  65. (packages (cons* nss-certs ;for HTTPS access
  66. openssh-sans-x
  67. %base-packages))
  68. (services (cons*
  69. (service dhcp-client-service-type)
  70. (service certbot-service-type
  71. (certbot-configuration
  72. (email "jbranso@dismail.de")
  73. (webroot "/srv/www")
  74. (certificates
  75. (list
  76. (certificate-configuration
  77. (name "gnucode.me")
  78. (domains '("gnucode.me" "www.gnucode.me" "mail.gnucode.me" "imap.gnucode.me" "smtp.gnucode.me"))
  79. (deploy-hook %nginx-deploy-hook))
  80. (certificate-configuration
  81. (name "gnu-hurd.com")
  82. (domains '("gnu-hurd.com" "www.gnu-hurd.com"))
  83. (deploy-hook %nginx-deploy-hook))
  84. (certificate-configuration
  85. (name "propernaming.org")
  86. (domains '("propernaming.org" "www.propernaming.org"))
  87. (deploy-hook %nginx-deploy-hook))
  88. ))))
  89. (dovecot-service #:config
  90. (dovecot-configuration
  91. (protocols
  92. (list
  93. (protocol-configuration
  94. (name "imap")
  95. (mail-max-userip-connections 3))))
  96. (services
  97. (list
  98. (service-configuration
  99. (kind "imap"))
  100. (service-configuration
  101. (kind "imap-login"))
  102. (service-configuration
  103. (kind "auth"))
  104. (service-configuration
  105. (kind "auth-worker"))
  106. (service-configuration
  107. (kind "dict"))))
  108. (ssl-cert "/etc/letsencrypt/live/gnucode.me/fullchain.pem")
  109. (ssl-key "/etc/letsencrypt/live/gnucode.me/privkey.pem")
  110. ))
  111. ;;(service gnucode-form-service-type)
  112. (service nginx-service-type
  113. (nginx-configuration
  114. (server-blocks
  115. (list
  116. (nginx-server-configuration
  117. (server-name '("gnucode.me"))
  118. (listen '("80" "443 ssl"))
  119. (root "/srv/www/html/gnucode.me/site/")
  120. ;; tell browsers my site supports HTTPS, and tell them that it will
  121. ;; at least work for 1/2 hour. Gradually, I will increase this number.
  122. (raw-content (list "add_header Strict-Transport-Security max-age=1800;"))
  123. (ssl-certificate "/etc/letsencrypt/live/gnucode.me/fullchain.pem")
  124. (ssl-certificate-key "/etc/letsencrypt/live/gnucode.me/privkey.pem")
  125. (locations
  126. (list
  127. (nginx-location-configuration ;certbot
  128. (uri "/.well-known")
  129. (body (list "root /srv/www;")))
  130. (nginx-location-configuration
  131. (uri "/form/")
  132. (body '("proxy_pass http://127.0.0.1:8081;")))
  133. %gnucode-location
  134. )))
  135. (nginx-server-configuration
  136. (server-name '("gnu-hurd.com"))
  137. (listen '("80" "443 ssl"))
  138. (root "/srv/www/html/gnu-hurd.com/")
  139. (ssl-certificate "/etc/letsencrypt/live/gnu-hurd.com/fullchain.pem")
  140. (ssl-certificate-key "/etc/letsencrypt/live/gnu-hurd.com/privkey.pem")
  141. ;; tell browsers my site supports HTTPS, and tell them that it will
  142. ;; at least work for 1/2 hour. Gradually, I will increase this number.
  143. (raw-content (list "add_header Strict-Transport-Security max-age=1800;"))
  144. (locations
  145. (list
  146. (nginx-location-configuration ;certbot
  147. (uri "/.well-known")
  148. (body (list "root /srv/www;"))))))
  149. (nginx-server-configuration
  150. (server-name '("propernaming.org"))
  151. (listen '("80" "443 ssl"))
  152. (root "/srv/www/html/propernaming.org/site/")
  153. (ssl-certificate "/etc/letsencrypt/live/propernaming.org/fullchain.pem")
  154. (ssl-certificate-key "/etc/letsencrypt/live/propernaming.org/privkey.pem")
  155. ;; tell browsers my site supports HTTPS, and tell them that it will
  156. ;; at least work for 1/2 hour. Gradually, I will increase this number.
  157. (raw-content (list "add_header Strict-Transport-Security max-age=1800;"))
  158. (locations
  159. (list
  160. (nginx-location-configuration ;certbot
  161. (uri "/.well-known")
  162. (body (list "root /srv/www;"))))))
  163. ))))
  164. (service openssh-service-type
  165. (openssh-configuration
  166. (openssh openssh-sans-x)
  167. (password-authentication? #f)
  168. (authorized-keys
  169. `(
  170. ;;("joshua" ,(local-file "/home/joshua/linode-guix-system-configuration/id_rsa.pub"))
  171. ("joshua" ,(plain-file "id_rsa.pub" %joshua-ssh-key))
  172. ;;("root" ,(local-file "/home/joshua/linode-guix-system-configuration/id_rsa.pub"))
  173. ("root" ,(plain-file "id_rsa.pub" %joshua-ssh-key))
  174. ("andrew" ,(plain-file "andrew_rsa.pub" %andrew-ssh-key))
  175. ))))
  176. ;; I've created the prosody admin user, and I imported the cert...
  177. ;; but pidgin tells me that I the XMPP server at gnucode.me does not support encryption.
  178. (service prosody-service-type
  179. (prosody-configuration
  180. (admins '("jbranso@dismail.de"))
  181. (virtualhosts
  182. (list
  183. (virtualhost-configuration
  184. (domain "gnucode.me"))))))
  185. (service mail-aliases-service-type
  186. '(("webmaster" "root")
  187. ("postmaster" "root")
  188. ("abuse" "root")))
  189. ;; I can test send an email from my ssh machine via:
  190. ;; cat test-email.txt | msmtp -- jbranso@dismail.de
  191. (service opensmtpd-service-type
  192. (opensmtpd-configuration
  193. (config-file %smtpd.conf)))
  194. (service unattended-upgrade-service-type)
  195. %base-services)))