summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2017-07-27 00:02:23 -0400
committerJoey Hess2017-07-27 00:02:23 -0400
commit973a18d822c002c1e8c0d64017a37821d760ed48 (patch)
treea9758232dc91e417fc58c9a5eb5d4007f2ec0a69
parent24fe88f64069bd7463cb49d923a36abadae8a127 (diff)
propellor spin
-rw-r--r--joeyconfig.hs48
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs53
2 files changed, 54 insertions, 47 deletions
diff --git a/joeyconfig.hs b/joeyconfig.hs
index c0f4f4db..7ed23dfb 100644
--- a/joeyconfig.hs
+++ b/joeyconfig.hs
@@ -201,53 +201,7 @@ honeybee = host "honeybee.kitenet.net" $ props
-- No hardware clock
& Apt.serviceInstalledRunning "ntp"
- -- Home router
- & Network.static "wlan0" (IPv4 "10.1.1.1") Nothing
- `requires` Network.cleanInterfacesFile
- & Apt.serviceInstalledRunning "hostapd"
- `requires` File.hasContent "/etc/hostapd/hostapd.conf"
- [ "interface=wlan0"
- , "ssid=house"
- , "hw_mode=g"
- , "channel=8"
- ]
- `requires` File.dirExists "/lib/hostapd"
- & Apt.serviceInstalledRunning "dnsmasq"
- `requires` File.hasContent "/etc/dnsmasq.conf"
- [ "domain-needed"
- , "bogus-priv"
- , "interface=wlan0"
- , "domain=kitenet.net"
- , "dhcp-range=10.1.1.100,10.1.1.150,24h"
- , "no-hosts"
- , "address=/honeybee.kitenet.net/10.1.1.1"
- ]
- `requires` File.hasContent "/etc/resolv.conf"
- [ "domain kitenet.net"
- , "search kitenet.net"
- , "nameserver 8.8.8.8"
- , "nameserver 8.8.4.4"
- ]
- & JoeySites.ipmasq "wlan0"
- & Network.static' "eth0" (IPv4 "192.168.1.42")
- (Just (Network.Gateway (IPv4 "192.168.1.1")))
- -- When satellite is down, fall back to dialup
- [ ("pre-up", "poff -a || true")
- , ("post-down", "pon")
- ]
- `requires` Network.cleanInterfacesFile
- & Apt.installed ["ppp"]
- `before` File.hasContent "/etc/ppp/peers/provider"
- [ "user \"joeyh@arczip.com\""
- , "connect \"/usr/sbin/chat -v -f /etc/chatscripts/pap -T 9734111\""
- , "/dev/ttyACM0"
- , "115200"
- , "noipdefault"
- , "defaultroute"
- , "persist"
- , "noauth"
- ]
- `before` File.hasPrivContent "/etc/ppp/pap-secrets" (Context "joeyh@arczip.com")
+ & JoeySites.homeRouter
& Apt.installed ["mtr-tiny", "iftop", "screen"]
& Postfix.satellite
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs
index 3f3f657f..a9bceafa 100644
--- a/src/Propellor/Property/SiteSpecific/JoeySites.hs
+++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs
@@ -19,6 +19,7 @@ import qualified Propellor.Property.Obnam as Obnam
import qualified Propellor.Property.Apache as Apache
import qualified Propellor.Property.Postfix as Postfix
import qualified Propellor.Property.Systemd as Systemd
+import qualified Propellor.Property.Network as Network
import qualified Propellor.Property.Fail2Ban as Fail2Ban
import qualified Propellor.Property.LetsEncrypt as LetsEncrypt
import Utility.FileMode
@@ -930,6 +931,58 @@ alarmClock oncalendar (User user) command = combineProperties "goodmorning timer
& "/etc/systemd/logind.conf" `ConfFile.containsIniSetting`
("Login", "LidSwitchIgnoreInhibited", "no")
+-- My home router, running hostapd and dnsmasq for wlan0,
+-- with eth0 connected to a satellite modem, and a fallback ppp connection.
+homeRouter :: Property (HasInfo + DebianLike)
+homeRouter = combineProperties "home router" $ props
+ & Network.static "wlan0" (IPv4 "10.1.1.1") Nothing
+ `requires` Network.cleanInterfacesFile
+ & Apt.serviceInstalledRunning "hostapd"
+ `requires` File.hasContent "/etc/hostapd/hostapd.conf"
+ [ "interface=wlan0"
+ , "ssid=house"
+ , "hw_mode=g"
+ , "channel=8"
+ ]
+ `requires` File.dirExists "/lib/hostapd"
+ & Apt.serviceInstalledRunning "dnsmasq"
+ `requires` File.hasContent "/etc/dnsmasq.conf"
+ [ "domain-needed"
+ , "bogus-priv"
+ , "interface=wlan0"
+ , "domain=kitenet.net"
+ , "dhcp-range=10.1.1.100,10.1.1.150,24h"
+ , "no-hosts"
+ , "address=/honeybee.kitenet.net/10.1.1.1"
+ ]
+ `requires` File.hasContent "/etc/resolv.conf"
+ [ "domain kitenet.net"
+ , "search kitenet.net"
+ , "nameserver 8.8.8.8"
+ , "nameserver 8.8.4.4"
+ ]
+ & ipmasq "wlan0"
+ & Apt.serviceInstalledRunning "netplug"
+ & Network.static' "eth0" (IPv4 "192.168.1.42")
+ (Just (Network.Gateway (IPv4 "192.168.1.1")))
+ -- When satellite is down, fall back to dialup
+ [ ("pre-up", "poff -a || true")
+ , ("post-down", "pon")
+ ]
+ `requires` Network.cleanInterfacesFile
+ & Apt.installed ["ppp"]
+ `before` File.hasContent "/etc/ppp/peers/provider"
+ [ "user \"joeyh@arczip.com\""
+ , "connect \"/usr/sbin/chat -v -f /etc/chatscripts/pap -T 9734111\""
+ , "/dev/ttyACM0"
+ , "115200"
+ , "noipdefault"
+ , "defaultroute"
+ , "persist"
+ , "noauth"
+ ]
+ `before` File.hasPrivContent "/etc/ppp/pap-secrets" (Context "joeyh@arczip.com")
+
-- | Enable IP masqerading, on whatever other interfaces come up.
ipmasq :: String -> Property DebianLike
ipmasq intif = script `File.hasContent`