blob: c557d453ac14e1dfd11033acd2cc16a4306730aa (
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
|
module Propellor.Property.Network where
import Propellor
import Propellor.Property.File
type Interface = String
interfaces :: FilePath
interfaces = "/etc/network/interfaces"
interfaceFile :: Interface -> FilePath
interfaceFile iface = "/etc/network/interfaces.d" </> iface
-- | Enable source-directory interfaces.d
interfacesD :: Property
interfacesD = containsLine interfaces "source-directory interfaces.d"
`describe` "interfaces.d directory enabled"
-- | 6to4 ipv6 connection, should work anywhere
ipv6to4 :: Property
ipv6to4 = hasContent (interfaceFile "sit0")
[ "# Automatically added by propeller"
, "iface sit0 inet6 static"
, "\taddress 2002:5044:5531::1"
, "\tnetmask 64"
, "\tgateway ::192.88.99.1"
, "auto sit0"
]
`describe` "ipv6to4"
`requires` interfacesD
`onChange` ifUp "sit0"
ifUp :: Interface -> Property
ifUp iface = cmdProperty "ifup" [iface]
|