From 5691537512d24aa542c7ae2d9225c46712e1e811 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 24 May 2016 22:46:41 +0200 Subject: l 2 websites fritz: prefix www. everywhere --- lass/2configs/websites/fritz.nix | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index e35615040..4b539bc10 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -13,26 +13,26 @@ in { ( manageCerts [ "biostase.de" "www.biostase.de" ]) #( serveWordpress [ "biostase.de" "www.biostase.de" ]) - ( manageCerts [ "radical-dreamers.de" ]) - ( serveWordpress [ "radical-dreamers.de" ]) + ( manageCerts [ "radical-dreamers.de" "www.radical-dreamers.de" ]) + ( serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ]) - ( manageCerts [ "gs-maubach.de" ]) - ( serveWordpress [ "gs-maubach.de" ]) + ( manageCerts [ "gs-maubach.de" "www.gs-maubach.de" ]) + ( serveWordpress [ "gs-maubach.de" "www.gs-maubach.de" ]) - ( manageCerts [ "spielwaren-kern.de" ]) - ( serveWordpress [ "spielwaren-kern.de" ]) + ( manageCerts [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) + ( serveWordpress [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) - ( manageCerts [ "familienpraxis-korntal.de" ]) - ( servePage [ "familienpraxis-korntal.de" ]) + ( manageCerts [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) + ( servePage [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) - ( manageCerts [ "ttf-kleinaspach.de" ]) - ( serveWordpress [ "ttf-kleinaspach.de" ]) + ( manageCerts [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) + ( serveWordpress [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) - ( ssl [ "eastuttgart.de" ]) - ( serveWordpress [ "eastuttgart.de" ]) + ( ssl [ "eastuttgart.de" "www.eastuttgart.de" ]) + ( serveWordpress [ "eastuttgart.de" "www.eastuttgart.de" ]) - ( ssl [ "habsys.de" "habsys.eu" ]) - ( servePage [ "habsys.de" "habsys.eu" ]) + ( ssl [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) + ( servePage [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) ]; services.mysql = { -- cgit v1.2.3 From f1cbe54717e4f8f1b648e22f644a32f1b9abf82a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 24 May 2016 23:20:11 +0200 Subject: l 2 websites fritz: serve biostase.de --- lass/2configs/websites/fritz.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index 4b539bc10..5ce2887c4 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -11,7 +11,7 @@ let in { imports = [ ( manageCerts [ "biostase.de" "www.biostase.de" ]) - #( serveWordpress [ "biostase.de" "www.biostase.de" ]) + ( serveWordpress [ "biostase.de" "www.biostase.de" ]) ( manageCerts [ "radical-dreamers.de" "www.radical-dreamers.de" ]) ( serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ]) -- cgit v1.2.3 From 5b4333f2a72b167d7640f15c68e3bbb0aab7809d Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 24 May 2016 23:21:43 +0200 Subject: l 2 websites fritz: add fritz root authorizedKeys --- lass/2configs/websites/fritz.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index 5ce2887c4..b0473c2ff 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -54,4 +54,7 @@ in { ]; }; }; + users.users.root.openssh.authorizedKeys.keys = [ + config.krebs.users.fritz.pubkey + ]; } -- cgit v1.2.3 From a8691101c61969736f227cd54b7c7bbf3514f1a0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:21:38 +0200 Subject: l 2: use nixos-16.03 with new ts3 server --- lass/2configs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index ee320b9c9..4f03748e6 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -55,8 +55,8 @@ with config.krebs.lib; #secrets-common = "/home/lass/secrets/common"; stockholm = "/home/lass/stockholm"; nixpkgs = { - url = https://github.com/NixOS/nixpkgs; - rev = "d541e0dc1c05f5514bf30f8039e687adddb45616"; + url = https://github.com/lassulus/nixpkgs; + rev = "e781dae17e5478426cc97a4ac3e520be2dd0cddd"; dev = "/home/lass/src/nixpkgs"; }; } // optionalAttrs config.krebs.build.host.secure { -- cgit v1.2.3 From 7f889eba6b086a95fc48afb56d9b09880122c74a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:22:05 +0200 Subject: l 2 git: add the_playlist without announcement --- lass/2configs/git.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lass/2configs') diff --git a/lass/2configs/git.nix b/lass/2configs/git.nix index 5cbe46351..aac3f6e02 100644 --- a/lass/2configs/git.nix +++ b/lass/2configs/git.nix @@ -37,6 +37,8 @@ let realwallpaper = {}; xmonad-stockholm = {}; the_playlist = {}; + } // mapAttrs make-public-repo-silent { + the_playlist = {}; }; restricted-repos = mapAttrs make-restricted-repo ( @@ -64,6 +66,11 @@ let }; }; + make-public-repo-silent = name: { desc ? null, ... }: { + inherit name desc; + public = true; + }; + make-restricted-repo = name: { collaborators ? [], desc ? null, ... }: { inherit name collaborators desc; public = false; -- cgit v1.2.3 From db98837af5aef7687b12ca7a8ab336a7ed2b80ed Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:22:48 +0200 Subject: l 2 radio: add and use utils --- lass/2configs/radio.nix | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 8cc2a2be7..518ab8fa5 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -1,4 +1,7 @@ { config, pkgs, ... }: + +with config.krebs.lib; + let name = "radio"; mainUser = config.users.extraUsers.mainUser; @@ -7,6 +10,20 @@ let admin-password = import ; source-password = import ; + add_random = pkgs.writeDashBin "add_random" '' + mpc add "$(mpc ls | shuf -n1)" + ''; + + skip_track = pkgs.writeDashBin "skip_track" '' + ${add_random}/bin/add_random + echo skipping: "$(${print_current}/bin/print_current)" + ${pkgs.mpc_cli}/bin/mpc -q next + ''; + + print_current = pkgs.writeDashBin "print_current" '' + ${pkgs.mpc_cli}/bin/mpc current -f %file% + ''; + in { users.users = { "${name}" = rec { @@ -28,6 +45,9 @@ in { }; krebs.per-user.${name}.packages = with pkgs; [ + add_random + skip_track + print_current ncmpcpp mpc_cli tmux @@ -100,10 +120,6 @@ in { autoAdd = pkgs.writeDash "autoAdd" '' LIMIT=$1 #in secconds - addRandom () { - mpc add "$(mpc ls | shuf -n1)" - } - timeLeft () { playlistDuration=$(mpc --format '%time%' playlist | awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}') currentTime=$(mpc status | awk '/^\[playing\]/ { sub(/\/.+/,"",$3); split($3,a,/:/); print a[1]*60+a[2] }') @@ -111,7 +127,7 @@ in { } if test $(timeLeft) -le $LIMIT; then - addRandom + ${add_random}/bin/add_random fi ''; in { -- cgit v1.2.3 From 9a8cfe0c2183242d53207e597e9bbb3a7ba91b0b Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:24:38 +0200 Subject: l 2 radio: add Reaktor config --- lass/2configs/radio.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lass/2configs') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 518ab8fa5..99a8c0859 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -146,4 +146,23 @@ in { ExecStart = "${autoAdd} 100"; }; }; + + krebs.Reaktor = { + enable = true; + nickname = "the_playlist|r"; + channels = [ "#the_playlist" ]; + extraEnviron = { + REAKTOR_HOST = "irc.freenode.org"; + }; + plugins = with pkgs.ReaktorPlugins; [ + (buildSimpleReaktorPlugin "skip" { + script = "${skip_track}/bin/skip_track"; + pattern = "^skip$"; + }) + (buildSimpleReaktorPlugin "current" { + script = "${print_current}/bin/print_current"; + pattern = "^current$"; + }) + ]; + }; } -- cgit v1.2.3 From e7f114ae090d6d2d0b9f11f03f58797feaef016a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:25:06 +0200 Subject: l 2 radio: add config for lassul.us/the_playlist --- lass/2configs/radio.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lass/2configs') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 99a8c0859..2d1596e3d 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -165,4 +165,29 @@ in { }) ]; }; + krebs.nginx.servers."lassul.us".locations = let + html = pkgs.writeText "index.html" '' + + + + + lassulus playlist + + +
+ +
+
+ +
+ + + + ''; + in [ + (nameValuePair "/the_playlist" '' + default_type "text/html"; + alias ${html}; + '') + ]; } -- cgit v1.2.3 From 565d06608e7eb4a51693f769e239861f48e3bf37 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:32:32 +0200 Subject: l 2 websites domsen: use old phpIni again --- lass/2configs/websites/domsen.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index f31fccd51..43f9b3924 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -79,9 +79,18 @@ in { createHome = true; }; - services.phpfpm.phpOptions = '' - extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so - sendmail_path = ${sendmail} -t + #services.phpfpm.phpOptions = '' + # extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so + # sendmail_path = ${sendmail} -t + #''; + services.phpfpm.phpIni = pkgs.runCommand "php.ini" { + options = '' + extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so + sendmail_path = ${sendmail} -t -i" + ''; + } '' + cat ${pkgs.php}/etc/php-recommended.ini > $out + echo "$options" >> $out ''; } -- cgit v1.2.3 From b78cafa686a4e01f815f75d1c815996e54fa4597 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 16:32:59 +0200 Subject: l 2 websites fritz: use ssl everywhere --- lass/2configs/websites/fritz.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index b0473c2ff..b063504f0 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -10,28 +10,28 @@ let in { imports = [ - ( manageCerts [ "biostase.de" "www.biostase.de" ]) + ( ssl [ "biostase.de" "www.biostase.de" ]) ( serveWordpress [ "biostase.de" "www.biostase.de" ]) - ( manageCerts [ "radical-dreamers.de" "www.radical-dreamers.de" ]) + ( ssl [ "radical-dreamers.de" "www.radical-dreamers.de" ]) ( serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ]) - ( manageCerts [ "gs-maubach.de" "www.gs-maubach.de" ]) + ( ssl [ "gs-maubach.de" "www.gs-maubach.de" ]) ( serveWordpress [ "gs-maubach.de" "www.gs-maubach.de" ]) - ( manageCerts [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) + ( ssl [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) ( serveWordpress [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) - ( manageCerts [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) + ( ssl [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) ( servePage [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) - ( manageCerts [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) + ( ssl [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) ( serveWordpress [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) ( ssl [ "eastuttgart.de" "www.eastuttgart.de" ]) ( serveWordpress [ "eastuttgart.de" "www.eastuttgart.de" ]) - ( ssl [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) + #( ssl [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) ( servePage [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) ]; -- cgit v1.2.3 From 39be633cf42aaaa4f8a6a992fd3af4e139ab8917 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 25 May 2016 20:57:08 +0200 Subject: l 2 radio print_current: show youtube link --- lass/2configs/radio.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 2d1596e3d..17be327b9 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -21,7 +21,9 @@ let ''; print_current = pkgs.writeDashBin "print_current" '' - ${pkgs.mpc_cli}/bin/mpc current -f %file% + echo "$(${pkgs.mpc_cli}/bin/mpc current -f %file%) \ + $(${pkgs.mpc_cli}/bin/mpc current -f %file% \ + | ${pkgs.gnused}/bin/sed 's@.*\(.\{11\}\)\.ogg@http://www.youtube.com/watch?v=\1@')" ''; in { -- cgit v1.2.3 From 80e50fd8a05192faaf0e6f87faa3ea9c0313aa32 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 31 May 2016 23:26:35 +0200 Subject: l: move websites libs to 2/websites/util --- lass/2configs/websites/domsen.nix | 8 +- lass/2configs/websites/fritz.nix | 12 +- lass/2configs/websites/util.nix | 228 ++++++++++++++++++++++++++ lass/2configs/websites/wohnprojekt-rhh.de.nix | 10 +- 4 files changed, 244 insertions(+), 14 deletions(-) create mode 100644 lass/2configs/websites/util.nix (limited to 'lass/2configs') diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 43f9b3924..35a391d1b 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -1,14 +1,10 @@ { config, pkgs, lib, ... }: let - inherit (config.krebs.lib) + inherit (import { config = {}; inherit lib; }) genid - readFile ; - inherit (import ../../4lib { inherit lib pkgs; }) - manageCert - manageCerts - activateACME + inherit (import {inherit lib pkgs;}) ssl servePage serveOwncloud diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index b063504f0..487c4644e 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -1,12 +1,16 @@ { config, pkgs, lib, ... }: let - inherit (import ../../4lib { inherit lib pkgs; }) - manageCerts - activateACME + inherit (import { config = {}; inherit lib; }) + genid + head + nameValuePair + ; + inherit (import {inherit lib pkgs;}) ssl servePage - serveWordpress; + serveWordpress + ; in { imports = [ diff --git a/lass/2configs/websites/util.nix b/lass/2configs/websites/util.nix new file mode 100644 index 000000000..84a20c711 --- /dev/null +++ b/lass/2configs/websites/util.nix @@ -0,0 +1,228 @@ +{ lib, pkgs, ... }: + +with lib; + +rec { + + manageCerts = domains: + let + domain = head domains; + in { + security.acme = { + certs."${domain}" = { + email = "lassulus@gmail.com"; + webroot = "/var/lib/acme/challenges/${domain}"; + plugins = [ + "account_key.json" + "key.pem" + "fullchain.pem" + ]; + group = "nginx"; + allowKeysForGroup = true; + extraDomains = genAttrs domains (_: null); + }; + }; + + krebs.nginx.servers."${domain}" = { + locations = [ + (nameValuePair "/.well-known/acme-challenge" '' + root /var/lib/acme/challenges/${domain}/; + '') + ]; + }; + }; + + ssl = domains: + { + imports = [ + ( manageCerts domains ) + ( activateACME (head domains) ) + ]; + }; + + activateACME = domain: + { + krebs.nginx.servers.${domain} = { + ssl = { + enable = true; + certificate = "/var/lib/acme/${domain}/fullchain.pem"; + certificate_key = "/var/lib/acme/${domain}/key.pem"; + }; + }; + }; + + servePage = domains: + let + domain = head domains; + in { + krebs.nginx.servers.${domain} = { + server-names = domains; + locations = [ + (nameValuePair "/" '' + root /srv/http/${domain}; + '') + ]; + }; + }; + + serveOwncloud = domains: + let + domain = head domains; + in { + krebs.nginx.servers."${domain}" = { + server-names = domains; + extraConfig = '' + # Add headers to serve security related headers + add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + + # Path to the root of your installation + root /srv/http/${domain}/; + # set max upload size + client_max_body_size 10G; + fastcgi_buffers 64 4K; + + # Disable gzip to avoid the removal of the ETag header + gzip off; + + # Uncomment if your server is build with the ngx_pagespeed module + # This module is currently not supported. + #pagespeed off; + + index index.php; + error_page 403 /core/templates/403.php; + error_page 404 /core/templates/404.php; + + rewrite ^/.well-known/carddav /remote.php/carddav/ permanent; + rewrite ^/.well-known/caldav /remote.php/caldav/ permanent; + + # The following 2 rules are only needed for the user_webfinger app. + # Uncomment it if you're planning to use this app. + rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; + ''; + locations = [ + (nameValuePair "/robots.txt" '' + allow all; + log_not_found off; + access_log off; + '') + (nameValuePair "~ ^/(build|tests|config|lib|3rdparty|templates|data)/" '' + deny all; + '') + + (nameValuePair "~ ^/(?:autotest|occ|issue|indie|db_|console)" '' + deny all; + '') + + (nameValuePair "/" '' + rewrite ^/remote/(.*) /remote.php last; + rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; + try_files $uri $uri/ =404; + '') + + (nameValuePair "~ \.php(?:$|/)" '' + fastcgi_split_path_info ^(.+\.php)(/.+)$; + include ${pkgs.nginx}/conf/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice + fastcgi_pass unix:/srv/http/${domain}/phpfpm.pool; + fastcgi_intercept_errors on; + '') + + # Adding the cache control header for js and css files + # Make sure it is BELOW the location ~ \.php(?:$|/) { block + (nameValuePair "~* \.(?:css|js)$" '' + add_header Cache-Control "public, max-age=7200"; + # Add headers to serve security related headers + add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; + add_header X-Content-Type-Options nosniff; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + # Optional: Don't log access to assets + access_log off; + '') + + # Optional: Don't log access to other assets + (nameValuePair "~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$" '' + access_log off; + '') + ]; + }; + services.phpfpm.poolConfigs."${domain}" = '' + listen = /srv/http/${domain}/phpfpm.pool + user = nginx + group = nginx + pm = dynamic + pm.max_children = 5 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 3 + listen.owner = nginx + listen.group = nginx + # errors to journal + php_admin_value[error_log] = 'stderr' + php_admin_flag[log_errors] = on + catch_workers_output = yes + ''; + }; + + serveWordpress = domains: + let + domain = head domains; + + in { + krebs.nginx.servers."${domain}" = { + server-names = domains; + extraConfig = '' + root /srv/http/${domain}/; + index index.php; + access_log /tmp/nginx_acc.log; + error_log /tmp/nginx_err.log; + error_page 404 /404.html; + error_page 500 502 503 504 /50x.html; + ''; + locations = [ + (nameValuePair "/" '' + try_files $uri $uri/ /index.php?$args; + '') + (nameValuePair "~ \.php$" '' + fastcgi_pass unix:/srv/http/${domain}/phpfpm.pool; + include ${pkgs.nginx}/conf/fastcgi.conf; + '') + #(nameValuePair "~ /\\." '' + # deny all; + #'') + #Directives to send expires headers and turn off 404 error logging. + (nameValuePair "~* ^.+\.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$" '' + access_log off; + log_not_found off; + expires max; + '') + ]; + }; + services.phpfpm.poolConfigs."${domain}" = '' + listen = /srv/http/${domain}/phpfpm.pool + user = nginx + group = nginx + pm = dynamic + pm.max_children = 5 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 3 + listen.owner = nginx + listen.group = nginx + # errors to journal + php_admin_value[error_log] = 'stderr' + php_admin_flag[log_errors] = on + catch_workers_output = yes + ''; + }; + +} diff --git a/lass/2configs/websites/wohnprojekt-rhh.de.nix b/lass/2configs/websites/wohnprojekt-rhh.de.nix index 858054531..fb1a58109 100644 --- a/lass/2configs/websites/wohnprojekt-rhh.de.nix +++ b/lass/2configs/websites/wohnprojekt-rhh.de.nix @@ -1,11 +1,13 @@ { config, pkgs, lib, ... }: let - inherit (config.krebs.lib) genid; - inherit (import ../../4lib { inherit lib pkgs; }) + inherit (import { config = {}; inherit lib; }) + genid + ; + inherit (import {inherit lib pkgs;}) ssl - servePage; - + servePage + ; in { imports = [ ( ssl [ "wohnprojekt-rhh.de" ]) -- cgit v1.2.3 From 5203694681829a664492c65cce6cfa2fbc06078b Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:10:40 +0200 Subject: l 2 browsers: add com browser --- lass/2configs/browsers.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix index e230fff43..ea79053ce 100644 --- a/lass/2configs/browsers.nix +++ b/lass/2configs/browsers.nix @@ -63,5 +63,6 @@ in { ( createChromiumUser "wk" [ "video" "audio" ] [ pkgs.chromium ] ) ( createChromiumUser "fb" [ "video" "audio" ] [ pkgs.chromium ] ) ( createChromiumUser "gm" [ "video" "audio" ] [ pkgs.chromium ] ) + ( createChromiumUser "com" [ "video" "audio" ] [ pkgs.chromium ] ) ]; } -- cgit v1.2.3 From afcfa65077f13f2388b44e2445246c0d9b470645 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:10:53 +0200 Subject: l 2: add mainUser to fuse for sshfs --- lass/2configs/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 4f03748e6..8d488e335 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -30,6 +30,7 @@ with config.krebs.lib; createHome = true; useDefaultShell = true; extraGroups = [ + "fuse" ]; openssh.authorizedKeys.keys = [ config.krebs.users.lass.pubkey -- cgit v1.2.3 From a0c1049638b969eb079c9e1ee93c417fba9c9730 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:11:15 +0200 Subject: l 2: bump nixpkgs e781dae -> f632f8e --- lass/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 8d488e335..1c06acf38 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -57,7 +57,7 @@ with config.krebs.lib; stockholm = "/home/lass/stockholm"; nixpkgs = { url = https://github.com/lassulus/nixpkgs; - rev = "e781dae17e5478426cc97a4ac3e520be2dd0cddd"; + rev = "f632f8edaf80ffa8bf0b8c9b9064cae3ccbe3894"; dev = "/home/lass/src/nixpkgs"; }; } // optionalAttrs config.krebs.build.host.secure { -- cgit v1.2.3 From 19c850339ad228c1da6e66017e2ab4643a3009d3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:11:54 +0200 Subject: l 2 exim-smarthost: add mail for finanzamt --- lass/2configs/exim-smarthost.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix index 84a57205b..995f025ee 100644 --- a/lass/2configs/exim-smarthost.nix +++ b/lass/2configs/exim-smarthost.nix @@ -26,6 +26,7 @@ with config.krebs.lib; { from = "steuer@aidsballs.de"; to = lass.mail; } { from = "lass@aidsballs.de"; to = lass.mail; } { from = "wordpress@ubikmedia.de"; to = lass.mail; } + { from = "finanzamt@lassul.us"; to = lass.mail; } ]; system-aliases = [ { from = "mailer-daemon"; to = "postmaster"; } -- cgit v1.2.3 From 18e602dc707cdd63e02459eb10845bb725763ddc Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:12:07 +0200 Subject: l 2 exim-smarthost: redirect dominik@apanowicz.de --- lass/2configs/exim-smarthost.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix index 995f025ee..8199f2bd7 100644 --- a/lass/2configs/exim-smarthost.nix +++ b/lass/2configs/exim-smarthost.nix @@ -27,6 +27,7 @@ with config.krebs.lib; { from = "lass@aidsballs.de"; to = lass.mail; } { from = "wordpress@ubikmedia.de"; to = lass.mail; } { from = "finanzamt@lassul.us"; to = lass.mail; } + { from = "dominik@apanowicz.de"; to = "dma@ubikmedia.eu"; } ]; system-aliases = [ { from = "mailer-daemon"; to = "postmaster"; } -- cgit v1.2.3 From 76296d5cc5f1ddb1108c3f213204bb386353ad93 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:13:19 +0200 Subject: l 2 websites: put sqlBackup in seperate file --- lass/2configs/websites/domsen.nix | 53 +++++++++++--------------------- lass/2configs/websites/fritz.nix | 58 +++++++++++++++--------------------- lass/2configs/websites/sqlBackup.nix | 28 +++++++++++++++++ 3 files changed, 69 insertions(+), 70 deletions(-) create mode 100644 lass/2configs/websites/sqlBackup.nix (limited to 'lass/2configs') diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 35a391d1b..45d09c3b9 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -22,49 +22,30 @@ let in { imports = [ - ( ssl [ "reich-gebaeudereinigung.de" ]) - ( servePage [ "reich-gebaeudereinigung.de" ]) + ./sqlBackup.nix + (ssl [ "reich-gebaeudereinigung.de" ]) + (servePage [ "reich-gebaeudereinigung.de" ]) - ( manageCerts [ "karlaskop.de" ]) - ( servePage [ "karlaskop.de" ]) + (ssl [ "karlaskop.de" ]) + (servePage [ "karlaskop.de" ]) - ( ssl [ "makeup.apanowicz.de" ]) - ( servePage [ "makeup.apanowicz.de" ]) + (ssl [ "makeup.apanowicz.de" ]) + (servePage [ "makeup.apanowicz.de" ]) - ( manageCerts [ "pixelpocket.de" ]) - ( servePage [ "pixelpocket.de" ]) + (ssl [ "pixelpocket.de" ]) + (servePage [ "pixelpocket.de" ]) - ( ssl [ "o.ubikmedia.de" ]) - ( serveOwncloud [ "o.ubikmedia.de" ]) + (ssl [ "o.ubikmedia.de" ]) + (serveOwncloud [ "o.ubikmedia.de" ]) - ( ssl [ "ubikmedia.de" "aldona.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ] ) - ( serveWordpress [ "ubikmedia.de" "*.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ] ) + (ssl [ "ubikmedia.de" "aldona.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ]) + (serveWordpress [ "ubikmedia.de" "*.ubikmedia.de" "apanowicz.de" "nirwanabluete.de" "aldonasiech.com" "360gradvideo.tv" "ubikmedia.eu" ]) ]; - services.mysql = { - enable = true; - package = pkgs.mariadb; - rootPassword = toString (); - }; - - lass.mysqlBackup = { - enable = true; - config.domsen = { - password = toString (); - databases = [ - "ubikmedia_de" - "o_ubikmedia_de" - ]; - }; - }; - services.mysqlBackup = { - enable = true; - databases = [ - "ubikmedia_de" - "o_ubikmedia_de" - ]; - location = "/bku/sql_dumps"; - }; + lass.mysqlBackup.config.all.databases = [ + "ubikmedia_de" + "o_ubikmedia_de" + ]; users.users.domsen = { uid = genid "domsen"; diff --git a/lass/2configs/websites/fritz.nix b/lass/2configs/websites/fritz.nix index 487c4644e..63efbecb6 100644 --- a/lass/2configs/websites/fritz.nix +++ b/lass/2configs/websites/fritz.nix @@ -14,50 +14,40 @@ let in { imports = [ - ( ssl [ "biostase.de" "www.biostase.de" ]) - ( serveWordpress [ "biostase.de" "www.biostase.de" ]) + ./sqlBackup.nix + (ssl [ "biostase.de" "www.biostase.de" ]) + (serveWordpress [ "biostase.de" "www.biostase.de" ]) - ( ssl [ "radical-dreamers.de" "www.radical-dreamers.de" ]) - ( serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ]) + (ssl [ "radical-dreamers.de" "www.radical-dreamers.de" ]) + (serveWordpress [ "radical-dreamers.de" "www.radical-dreamers.de" ]) - ( ssl [ "gs-maubach.de" "www.gs-maubach.de" ]) - ( serveWordpress [ "gs-maubach.de" "www.gs-maubach.de" ]) + (ssl [ "gs-maubach.de" "www.gs-maubach.de" ]) + (serveWordpress [ "gs-maubach.de" "www.gs-maubach.de" ]) - ( ssl [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) - ( serveWordpress [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) + (ssl [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) + (serveWordpress [ "spielwaren-kern.de" "www.spielwaren-kern.de" ]) - ( ssl [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) - ( servePage [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) + (ssl [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) + (servePage [ "familienpraxis-korntal.de" "www.familienpraxis-korntal.de" ]) - ( ssl [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) - ( serveWordpress [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) + (ssl [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) + (serveWordpress [ "ttf-kleinaspach.de" "www.ttf-kleinaspach.de" ]) - ( ssl [ "eastuttgart.de" "www.eastuttgart.de" ]) - ( serveWordpress [ "eastuttgart.de" "www.eastuttgart.de" ]) + (ssl [ "eastuttgart.de" "www.eastuttgart.de" ]) + (serveWordpress [ "eastuttgart.de" "www.eastuttgart.de" ]) - #( ssl [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) - ( servePage [ "www.habsys.de" "habsys.de" "www.habsys.eu" "habsys.eu" ]) + (ssl [ "habsys.de" "www.habsys.de" "habsys.eu" "www.habsys.eu" ]) + (servePage [ "habsys.de" "www.habsys.de" "habsys.eu" "www.habsys.eu" ]) ]; - services.mysql = { - enable = true; - package = pkgs.mariadb; - rootPassword = toString (); - }; + lass.mysqlBackup.config.all.databases = [ + "biostase_de" + "eastuttgart_de" + "radical_dreamers_de" + "spielwaren_kern_de" + "ttf_kleinaspach_de" + ]; - lass.mysqlBackup = { - enable = true; - config.fritz = { - password = toString (); - databases = [ - "biostase_de" - "eastuttgart_de" - "radical_dreamers_de" - "spielwaren_kern_de" - "ttf_kleinaspach_de" - ]; - }; - }; users.users.root.openssh.authorizedKeys.keys = [ config.krebs.users.fritz.pubkey ]; diff --git a/lass/2configs/websites/sqlBackup.nix b/lass/2configs/websites/sqlBackup.nix new file mode 100644 index 000000000..7cb4b320e --- /dev/null +++ b/lass/2configs/websites/sqlBackup.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +{ + krebs.secret.files.mysql_rootPassword = { + path = "${config.services.mysql.dataDir}/mysql_rootPassword"; + owner.name = "root"; + source-path = toString + "/mysql_rootPassword"; + }; + + services.mysql = { + enable = true; + package = pkgs.mariadb; + rootPassword = config.krebs.secret.files.mysql_rootPassword.path; + }; + + systemd.services.mysql = { + requires = [ "secret.service" ]; + after = [ "secret.service" ]; + }; + + lass.mysqlBackup = { + enable = true; + config.all = { + password = toString (); + }; + }; +} + -- cgit v1.2.3 From 26394051b339ab46cf7033663cc4a61036dbd6da Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 1 Jun 2016 00:14:11 +0200 Subject: l 2 websites util: add server-names to manageCerts --- lass/2configs/websites/util.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/websites/util.nix b/lass/2configs/websites/util.nix index 84a20c711..330d8ba86 100644 --- a/lass/2configs/websites/util.nix +++ b/lass/2configs/websites/util.nix @@ -24,6 +24,7 @@ rec { }; krebs.nginx.servers."${domain}" = { + server-names = domains; locations = [ (nameValuePair "/.well-known/acme-challenge" '' root /var/lib/acme/challenges/${domain}/; -- cgit v1.2.3