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

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