aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystems/firewall/nas.pp
blob: c6eaf720e8a3ecff8d8da01cd41c225f2d18d510 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
class firewall::nas {
  # Basic firewall rules
  include shorewall::rules::ftp
  include shorewall::rules::tftp
  include shorewall::rules::http
  include shorewall::rules::nfsd
  include shorewall::rules::rsync
  include firewall::printer
  include firewall::torrent
  include firewall::mpd

  # Additional ports needed by NFS
  # Got using rpcinfo -p and netstat -ap
  shorewall::rule { 'nfs-1':
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'tcp',
    destinationport => '35150,43902,46661,46661,46661,50340,54814,57170,58403,59780',
    ratelimit       => '-',
    order           => 100,
  }

  shorewall::rule { 'nfs-2':
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'udp',
    destinationport => '938,38511,43195,53081,53081,53081,38521,45238,52664,52400,60331',
    ratelimit       => '-',
    order           => 100,
  }

  # See http://www.shorewall.net/samba.htm
  shorewall::rule { 'samba':
    action          => 'SMB/ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => '-',
    destinationport => '-',
    ratelimit       => '-',
    order           => 100,
  }

  shorewall::rule { 'netbios-1':
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'tcp',
    destinationport => '137,138,139',
    ratelimit       => '-',
    order           => 100,
  }

  shorewall::rule { 'netbios-2':
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'udp',
    destinationport => '137,138,139',
    ratelimit       => '-',
    order           => 100,
  }

  # DLNA
  #
  # https://wiki.archlinux.org/index.php/MiniDLNA
  # http://netpatia.blogspot.co.uk/2011/03/setup-your-own-dlna-server.html
  # http://wiki.alpinelinux.org/wiki/IPTV_How_To
  # http://mediatomb.cc/dokuwiki/faq:faq
  # http://packages.debian.org/wheezy/djmount
  # http://packages.debian.org/wheezy/gupnp-tools
  #
  # Optional:
  #
  # http://www.shorewall.net/UPnP.html
  #
  #   linux-igd package
  #   /etc/default/linux-igd
  #   /etc/upnpd.conf

  shorewall::rule { "dlna-1":
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'tcp,udp',
    destinationport => "1900",
    ratelimit       => '-',
    order           => 102,
  }

  shorewall::rule { "dlna-2":
    action          => 'ACCEPT',
    source          => 'net',
    destination     => '$FW',
    proto           => 'tcp,udp',
    destinationport => "8200",
    ratelimit       => '-',
    order           => 103,
  }

  shorewall::rule { "dlna-3":
    action          => 'allowinUPnP',
    source          => 'net',
    destination     => '$FW',
    order           => 104,
  }

  shorewall::rule { "dlna-4":
    action          => 'forwardUPnP',
    source          => 'net',
    destination     => '$FW',
    order           => 105,
  }

  # Enable multicast
  augeas { 'enable_multicast':
    changes => 'set /files/etc/shorewall/shorewall.conf/MULTICAST Yes',
    lens    => 'Shellvars.lns',
    incl    => '/etc/shorewall/shorewall.conf',
    notify  => Service[shorewall];
  }

  # DAAP
  shorewall::rule { 'daap-1':
    source          => 'net',
    destination     => '$FW',
    proto           => 'tcp',
    destinationport => '3689',
    order           => 300,
    action          => 'ACCEPT';
  }

  shorewall::rule { 'daap-2':
    source          => 'net',
    destination     => '$FW',
    proto           => 'udp',
    destinationport => '3689',
    order           => 301,
    action          => 'ACCEPT';
  }

  # Avahi/mDNS
  shorewall::rule { 'mdns':
    source          => 'net',
    destination     => '$FW',
    proto           => 'udp',
    destinationport => '5353',
    order           => 400,
    action          => 'ACCEPT';
  }
}