summaryrefslogtreecommitdiffstats
path: root/lass/2configs/wordpress.nix
blob: 9458deb389f060db842df940bbde9fcf54c04a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ config, pkgs, ... }:

{
  containers.wordpress = {
    privateNetwork = true;
    hostAddress = "192.168.101.1";
    localAddress = "192.168.101.2";

    config = {
      imports = [
        ../3modules/iptables.nix
      ];

      lass.iptables = {
        enable = true;
        tables = {
          filter.INPUT.policy = "DROP";
          filter.FORWARD.policy = "DROP";
          filter.INPUT.rules = [
            { predicate = "-m conntrack --ctstate RELATED,ESTABLISHED"; target = "ACCEPT"; precedence = 10001; }
            { predicate = "-p icmp"; target = "ACCEPT"; precedence = 10000; }
            { predicate = "-i lo"; target = "ACCEPT"; precedence = 9999; }
            { predicate = "-p tcp --dport 22"; target = "ACCEPT"; precedence = 9998; }
            { predicate = "-p tcp --dport 80"; target = "ACCEPT"; precedence = 9998; }
          ];
        };
      };

      environment.systemPackages = with pkgs; [
        iptables
      ];

      services.postgresql = {
        enable = true;
        package = pkgs.postgresql;
      };

      services.httpd = {
        enable = true;
        adminAddr = "root@apanowicz.de";
        extraModules = [
          { name = "php5"; path = "${pkgs.php}/modules/libphp5.so"; }
        ];
        virtualHosts = [
          {
            hostName = "wordpress";
            serverAliases = [ "wordpress" "www.wordpress" ];

            extraSubservices = [
              {
                serviceName = "wordpress";
              }
            ];
          }
        ];
      };
    };
  };
}