From 6965602fe27a795a6494c9c2657c2abe83803496 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 25 Nov 2016 12:37:44 +0100 Subject: Drop lmu.li --- ymir/zones/index.nix | 1 - ymir/zones/li.lmu.soa | 31 ------------------------------- 2 files changed, 32 deletions(-) delete mode 100644 ymir/zones/li.lmu.soa (limited to 'ymir') diff --git a/ymir/zones/index.nix b/ymir/zones/index.nix index 8424a0e0..9bde25e9 100644 --- a/ymir/zones/index.nix +++ b/ymir/zones/index.nix @@ -5,7 +5,6 @@ with lib; rec { "141.li" = { data = readFile ./li.141.soa; }; "dirty-haskell.org" = { data = readFile ./org.dirty-haskell.soa; }; - "lmu.li" = { data = readFile ./li.lmu.soa; }; "praseodym.org" = { data = readFile ./org.praseodym.soa; }; "xmpp.li" = { data = readFile ./li.xmpp.soa; }; "yggdrasil.li" = { data = readFile ./li.yggdrasil.soa; }; diff --git a/ymir/zones/li.lmu.soa b/ymir/zones/li.lmu.soa deleted file mode 100644 index d1e05738..00000000 --- a/ymir/zones/li.lmu.soa +++ /dev/null @@ -1,31 +0,0 @@ -$ORIGIN lmu.li. -$TTL 3600 -@ IN SOA ns.yggdrasil.li. root.yggdrasil.li. ( - 2016111011 ; serial - 10800 ; refresh - 3600 ; retry - 604800 ; expire - 3600 ; min TTL -) - IN NS ns.yggdrasil.li. - IN NS ns.inwx.de. - IN NS ns2.inwx.de. - IN NS ns3.inwx.eu. - IN NS ns4.inwx.com. - IN NS ns5.inwx.net. - -@ IN A 188.68.51.254 -@ IN AAAA 2a03:4000:6:d004:: -@ IN MX 10 ymir.yggdrasil.li. -@ IN TXT "v=spf1 redirect=yggdrasil.li" - -* IN A 188.68.51.254 -* IN AAAA 2a03:4000:6:d004:: -* IN MX 0 ymir.yggdrasil.li. -* IN TXT "v=spf1 redirect=yggdrasil.li" - -ymir._domainkey IN TXT ( - "v=DKIM1;k=rsa;p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq3cCKlk+VPhyAanLZTM0BCzUT/+fmxHioZcFk0uJk1akBYj7BRofR7eVNcLKpm3rwYMQgE+9vJH9p8SV6tws9EcWc8SMCqqGZlREYM7PmLDiTSK/vjCzkygfgFCb0EBNsY2A/fpP4rTeoxrbcBSvMkq97iY5rwyw4wXZVZXLiDaCj23s8POoxTk1ClqUJZJQ5x2" - "qzrC0RfN5kLZ9A7Gq2jB09vNxpXHYqABA0bJv88JiZM7hfkp9IafJZ+yCVMaBcJs4DAxnTjNAuFD9gm+qSFVY8+yeXqL6Qjo5PbruhyZRBW8RgRYT8t5n07XRglMGKKGMwOGLanrltcyXqB+GsDZBD36RAAwjFadnxdpDyRv4SgRP7ff2tKRrORYpmpN+mKdqw5j3J/nP6bXV1oAkyh9XQkPEIDi81WT87EZziTElDzVp6A2qFOxqucAovoRk24" - "7vlsns1FApFRsp9mja0UZNObyKD1M6tP9Ep7lS76tFGMk+WDvXRJH5LEsyCpu7sSyl1r/O0M4K+KldRCqLlZd7rf8F5P8T0dn1azk05g7F4p0N/y9GNdzXbPZ9u0eZdI7SEdh8ZoOZp7NVZiBFfbWLSS5ZtyA2kbBa4i7GJ/cuAbEKOmqAkeQPiu96TGIcyjkXjS6mTPI+9UmKZYZC+OM8XdJ02y5KRoonCc19ZS8CAwEAAQ==" -) -- cgit v1.2.3 From 2c4603c01a36b4ed54ada906879f1c02956cd4c2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 10:50:38 +0100 Subject: List all subscribers --- ymir/mlmmj-expose.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index 0873b0f7..122fafa4 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix @@ -69,6 +69,11 @@ let "mlmmj-get-exposed" -> do args <- getArgs case args of + [(dropTrailingPathSeperator -> listDir), (map toLower -> ident)] -> do + setCurrentDirectory listDir + identities <- getIdentities + unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" + mapM_ (\sub -> putStrLn $ sub ++ " " ++ takeFileName listDir ++ "+" ++ hash' (ident, sub) ++ "@subs.lists.yggdrasil.li") =<< getSubscribers (dropTrailingPathSeparator -> listDir) : (map toLower -> ident) : (map (map toLower) -> recipients) -> do setCurrentDirectory listDir identities <- getIdentities -- cgit v1.2.3 From e90f3e6aa3853a17c0d33aef5306739cb36269b6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 10:52:34 +0100 Subject: typo --- ymir/mlmmj-expose.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index 122fafa4..2bdcf619 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix @@ -69,7 +69,7 @@ let "mlmmj-get-exposed" -> do args <- getArgs case args of - [(dropTrailingPathSeperator -> listDir), (map toLower -> ident)] -> do + [(dropTrailingPathSeparator -> listDir), (map toLower -> ident)] -> do setCurrentDirectory listDir identities <- getIdentities unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" -- cgit v1.2.3 From 692a3961f1788abe8fd284d744e7389888dc2353 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:21:04 +0100 Subject: mlmmj-serve-exposed --- ymir/mlmmj-expose.hs | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++ ymir/mlmmj-expose.nix | 114 ++++---------------------------- 2 files changed, 194 insertions(+), 100 deletions(-) create mode 100644 ymir/mlmmj-expose.hs (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs new file mode 100644 index 00000000..faf4e3b6 --- /dev/null +++ b/ymir/mlmmj-expose.hs @@ -0,0 +1,180 @@ +{-# LANGUAGE ViewPatterns, RecordWildCards #-} + +import System.IO +import System.IO.Error +import System.FilePath +import System.Environment +import System.Exit +import System.Directory +import System.Process +import Text.Printf + +import Data.Char + +import Control.Monad + +import Crypto.Hash + +import qualified Data.ByteString.Lazy as LBS +import qualified Data.ByteString.Char8 as CBS + +import qualified Data.UUID as UUID (toString) +import qualified Data.UUID.V4 as UUID (nextRandom) + +import Data.Aeson +import Data.Aeson.Encode.Pretty + +import Data.Set (Set) +import qualified Data.Set as Set + +newtype FoxReplace = FoxReplace (Set FoxReplaceGroup) + deriving (Ord, Eq) + +data FoxReplaceGroup = FoxReplaceGroup + { groupName :: String + , groupUrls :: Set String + , groupSubs :: Set FoxReplaceSub + , groupHtmlMode :: FoxReplaceHTML + } + deriving (Ord, Eq) + +data FoxReplaceHTML = NoHTML | OutputOnlyHTML | BothHTML + deriving (Ord, Eq, Enum) + +data FoxReplaceSub = FoxReplaceSub + { rInput, rOutput :: String + , rInputType :: SubInput + , rCaseSensitive :: Bool + } + deriving (Ord, Eq) + +data SubInput = TextInput | WordInput | RegexpInput + deriving (Ord, Eq, Enum) + + +instance ToJSON FoxReplace where + toJSON (FoxReplace groupSet) = object + [ "version" .= "0.15" + , "groups" .= groupSet + ] + +instance ToJSON FoxReplaceGroup where + toJSON FoxReplaceGroup{..} = object + [ "name" .= groupName + , "html" .= groupHtmlMode + , "enabled" .= True + , "urls" .= groupUrls + , "substitutions" .= groupSubs + ] + +instance ToJSON FoxReplaceHTML where + toJSON NoHTML = String "none" + toJSON OutputOnlyHTML = String "output" + toJSON BothHTML = String "inputoutput" + +instance ToJSON FoxReplaceSub where + toJSON FoxReplaceSub{..} = object + [ "input" .= rInput + , "output" .= rOutput + , "inputType" .= rInputType + , "caseSensitive" .= rCaseSensitive + ] + +instance ToJSON SubInput where + toJSON TextInput = String "text" + toJSON WordInput = String "wholewords" + toJSON RegexpInput = String "regexp" + + +main :: IO () +main = do + progName <- takeFileName <$> getProgName + case progName of + "mlmmj-exposed" -> do + args <- getArgs + case args of + [listDir, (map toLower -> extension)] -> do + setCurrentDirectory listDir + identities <- getIdentities + subscribers <- getSubscribers + let hashes = filter ((==) extension . snd) [((ident, sub), hash' (ident, sub)) | ident <- identities, sub <- subscribers] + case hashes of + [((_, recipient), _)] -> do + uuid <- UUID.nextRandom + let fName = "queue" "exposed" <.> uuidTrans uuid + uuidTrans = uuidTrans' . UUID.toString + where + uuidTrans' [] = [] + uuidTrans' ('-':xs) = uuidTrans' xs + uuidTrans' (x:xs) = x : uuidTrans' xs + getContents >>= writeFile fName + hPrintf stdout "Forwarding mail to <%s>, subscribed to %s\n" recipient (takeBaseName listDir) + callProcess "${pkgs.mlmmj}/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", fName, "-T", recipient] + removeFile fName + [] -> die "Unknown extension" + _ -> die "Ambiguous extension" + _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) + "mlmmj-expose" -> do + args <- getArgs + case args of + [listDir, (map toLower -> ident)] -> do + setCurrentDirectory listDir + identities <- getIdentities + case ident `elem` identities of + True -> putStrLn "Identity is already known" + False -> writeFile "exposed.ids" . unlines $ ident : identities + _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) + "mlmmj-get-exposed" -> do + args <- getArgs + case args of + [(dropTrailingPathSeparator -> listDir), (map toLower -> ident)] -> do + setCurrentDirectory listDir + identities <- getIdentities + unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" + mapM_ (\sub -> putStrLn $ sub ++ " " ++ takeFileName listDir ++ "+" ++ hash' (ident, sub) ++ "@subs.lists.yggdrasil.li") =<< getSubscribers + (dropTrailingPathSeparator -> listDir) : (map toLower -> ident) : (map (map toLower) -> recipients) -> do + setCurrentDirectory listDir + identities <- getIdentities + unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" + subscribers <- getSubscribers + forM_ recipients $ \recipient -> do + unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’"; + putStrLn $ takeFileName listDir ++ "+" ++ hash' (ident, recipient) ++ "@subs.lists.yggdrasil.li"; + _ -> hPutStrLn stderr ("Called without expected arguments ( [ [...]])") >> exitWith (ExitFailure 2) + "mlmmj-serve-exposed" -> do + args <- getArgs + case args of + [(dropTrailingPathSeparator -> listDir)] -> do + subscribers <- getSubscribers + identities <- getIdentities + + let + listName = takeBaseName listDir + replaceGroup ident = FoxReplaceGroup { groupName = ident ++ "." ++ listName + , groupHtmlMode = False + , groupUrls = Set.empty + , groupSubs = Set.fromList $ map (replaceSub ident) subscribers + } + replaceSub ident sub = FoxReplaceSub { rInput = hash' (ident, sub) + , rOutput = sub + , rInputType = WordInput + , rCaseSensitive = True + } + + CLBS.putStrLn . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities + _ -> hPutStrLn stderr "Called without expected arguments ()" >> exitWith (ExitFailure 2) + _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) + +getIdentities :: IO [String] +getIdentities = (filter (not . null) . lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) + +getSubscribers :: IO [String] +getSubscribers = map (map toLower) . concat <$> mapM (flip catchIOError (\e -> if isDoesNotExistError e then return [] else ioError e) . readDir) ["subscribers.d", "digesters.d"] + where + readDir dir = concat <$> (mapM (fmap lines . readFile) . map (dir ) . filter (not . (`elem` [".", ".."]))=<< (getDirectoryContents dir)) + +hash' :: Show a => a -> String +hash' = take len . map toLower . show . (hash :: CBS.ByteString -> Digest SHA256) . CBS.pack . map toLower . show + +len :: Int +len = 32 diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index 2bdcf619..370219d3 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix @@ -1,110 +1,24 @@ { config, pkgs, ... }: let - haskellEnv = pkgs.haskellPackages.ghcWithPackages (pkgs: with pkgs; [ filepath directory cryptonite bytestring uuid ]); + haskellEnv = pkgs.haskellPackages.ghcWithPackages dependencies; + dependencies = pkgs: with pkgs; [ filepath + directory + cryptonite + bytestring + uuid + aeson + aeson-pretty + ]; mlmmj-exposed = pkgs.stdenv.mkDerivation { - name = "mlmmj-exposed"; - src = pkgs.writeText "mlmmj-exposed.hs" '' - {-# LANGUAGE ViewPatterns #-} - - import System.IO - import System.IO.Error - import System.FilePath - import System.Environment - import System.Exit - import System.Directory - import System.Process - import Text.Printf - - import Data.Char - - import Control.Monad - - import Crypto.Hash - - import qualified Data.ByteString.Lazy as LBS - import qualified Data.ByteString.Char8 as CBS - - import qualified Data.UUID as UUID (toString) - import qualified Data.UUID.V4 as UUID (nextRandom) - - main :: IO () - main = do - progName <- takeFileName <$> getProgName - case progName of - "mlmmj-exposed" -> do - args <- getArgs - case args of - [listDir, (map toLower -> extension)] -> do - setCurrentDirectory listDir - identities <- getIdentities - subscribers <- getSubscribers - let hashes = filter ((==) extension . snd) [((ident, sub), hash' (ident, sub)) | ident <- identities, sub <- subscribers] - case hashes of - [((_, recipient), _)] -> do - uuid <- UUID.nextRandom - let fName = "queue" "exposed" <.> uuidTrans uuid - uuidTrans = uuidTrans' . UUID.toString - where - uuidTrans' [] = [] - uuidTrans' ('-':xs) = uuidTrans' xs - uuidTrans' (x:xs) = x : uuidTrans' xs - getContents >>= writeFile fName - hPrintf stdout "Forwarding mail to <%s>, subscribed to %s\n" recipient (takeBaseName listDir) - callProcess "${pkgs.mlmmj}/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", fName, "-T", recipient] - removeFile fName - [] -> die "Unknown extension" - _ -> die "Ambiguous extension" - _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) - "mlmmj-expose" -> do - args <- getArgs - case args of - [listDir, (map toLower -> ident)] -> do - setCurrentDirectory listDir - identities <- getIdentities - case ident `elem` identities of - True -> putStrLn "Identity is already known" - False -> writeFile "exposed.ids" . unlines $ ident : identities - _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) - "mlmmj-get-exposed" -> do - args <- getArgs - case args of - [(dropTrailingPathSeparator -> listDir), (map toLower -> ident)] -> do - setCurrentDirectory listDir - identities <- getIdentities - unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" - mapM_ (\sub -> putStrLn $ sub ++ " " ++ takeFileName listDir ++ "+" ++ hash' (ident, sub) ++ "@subs.lists.yggdrasil.li") =<< getSubscribers - (dropTrailingPathSeparator -> listDir) : (map toLower -> ident) : (map (map toLower) -> recipients) -> do - setCurrentDirectory listDir - identities <- getIdentities - unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" - subscribers <- getSubscribers - forM_ recipients (\recipient -> do { - unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’"; - putStrLn $ takeFileName listDir ++ "+" ++ hash' (ident, recipient) ++ "@subs.lists.yggdrasil.li"; - }) - _ -> hPutStrLn stderr ("Called without expected arguments ( [ [...]])") >> exitWith (ExitFailure 2) - _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) - getIdentities :: IO [String] - getIdentities = (filter (not . null) . lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) - - getSubscribers :: IO [String] - getSubscribers = map (map toLower) . concat <$> mapM (flip catchIOError (\e -> if isDoesNotExistError e then return [] else ioError e) . readDir) ["subscribers.d", "digesters.d"] - where - readDir dir = concat <$> (mapM (fmap lines . readFile) . map (dir ) . filter (not . (`elem` [".", ".."]))=<< (getDirectoryContents dir)) - - hash' :: Show a => a -> String - hash' = take len . map toLower . show . (hash :: CBS.ByteString -> Digest SHA256) . CBS.pack . map toLower . show - - len :: Int - len = 32 - ''; + name = "mlmmj-expose"; + src = ./mlmmj-expose.hs; buildCommand = '' mkdir -p $out/bin #cp $src $out/bin/.mlmmj-exposed - ${haskellEnv}/bin/ghc -o $out/bin/.mlmmj-exposed -odir . -hidir . $src - for f in mlmmj-exposed mlmmj-expose mlmmj-get-exposed; do - ln -s .mlmmj-exposed $out/bin/$f + ${haskellEnv}/bin/ghc -o $out/bin/.mlmmj-expose -odir . -hidir . $src + for f in mlmmj-exposed mlmmj-expose mlmmj-get-exposed mlmmj-serve-exposed; do + ln -s .mlmmj-expose $out/bin/$f done ''; }; -- cgit v1.2.3 From 446086a87736caf0ca12e21f637fb7a3c86bd051 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:21:46 +0100 Subject: syntax --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index faf4e3b6..7255f404 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -161,7 +161,7 @@ main = do , rCaseSensitive = True } - CLBS.putStrLn . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities + CBS.putStrLn . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities _ -> hPutStrLn stderr "Called without expected arguments ()" >> exitWith (ExitFailure 2) _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) -- cgit v1.2.3 From 7ff8e88f35ea789a86a134dba790af3ac3693a12 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:22:20 +0100 Subject: Overload strings --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 7255f404..6747ebc5 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ViewPatterns, RecordWildCards #-} +{-# LANGUAGE ViewPatterns, RecordWildCards, OverloadedStrings #-} import System.IO import System.IO.Error -- cgit v1.2.3 From fd80a539306d367ab8b228b30a024328cbd88f22 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:26:28 +0100 Subject: Bytestring flavours --- ymir/mlmmj-expose.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 6747ebc5..2819462e 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -151,7 +151,7 @@ main = do let listName = takeBaseName listDir replaceGroup ident = FoxReplaceGroup { groupName = ident ++ "." ++ listName - , groupHtmlMode = False + , groupHtmlMode = NoHTML , groupUrls = Set.empty , groupSubs = Set.fromList $ map (replaceSub ident) subscribers } @@ -161,7 +161,8 @@ main = do , rCaseSensitive = True } - CBS.putStrLn . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities + LBS.putStr . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities + putChar '\n' _ -> hPutStrLn stderr "Called without expected arguments ()" >> exitWith (ExitFailure 2) _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) -- cgit v1.2.3 From 531b41944a1bef7d95f94bc267698b5db6777305 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:27:13 +0100 Subject: Need type annotation for overloaded strings --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 2819462e..ef8d076b 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -54,7 +54,7 @@ data SubInput = TextInput | WordInput | RegexpInput instance ToJSON FoxReplace where toJSON (FoxReplace groupSet) = object - [ "version" .= "0.15" + [ "version" .= ("0.15" :: String) , "groups" .= groupSet ] -- cgit v1.2.3 From 5fab29b4ffc801eba2d8747fa51bb82f102a5e14 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:27:43 +0100 Subject: fix indentation --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index ef8d076b..73e329d8 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -123,7 +123,7 @@ main = do case ident `elem` identities of True -> putStrLn "Identity is already known" False -> writeFile "exposed.ids" . unlines $ ident : identities - _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) + _ -> hPutStrLn stderr ("Called without expected arguments ( )") >> exitWith (ExitFailure 2) "mlmmj-get-exposed" -> do args <- getArgs case args of -- cgit v1.2.3 From 87e9b7a54ae50398e3c93d8808ade354be035be3 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:32:35 +0100 Subject: Debug output --- ymir/mlmmj-expose.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 73e329d8..b5fc9cab 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -28,7 +28,7 @@ import Data.Set (Set) import qualified Data.Set as Set newtype FoxReplace = FoxReplace (Set FoxReplaceGroup) - deriving (Ord, Eq) + deriving (Ord, Eq, Show) data FoxReplaceGroup = FoxReplaceGroup { groupName :: String @@ -36,20 +36,20 @@ data FoxReplaceGroup = FoxReplaceGroup , groupSubs :: Set FoxReplaceSub , groupHtmlMode :: FoxReplaceHTML } - deriving (Ord, Eq) + deriving (Ord, Eq, Show) data FoxReplaceHTML = NoHTML | OutputOnlyHTML | BothHTML - deriving (Ord, Eq, Enum) + deriving (Ord, Eq, Enum, Show) data FoxReplaceSub = FoxReplaceSub { rInput, rOutput :: String , rInputType :: SubInput , rCaseSensitive :: Bool } - deriving (Ord, Eq) + deriving (Ord, Eq, Show) data SubInput = TextInput | WordInput | RegexpInput - deriving (Ord, Eq, Enum) + deriving (Ord, Eq, Enum, Show) instance ToJSON FoxReplace where @@ -160,6 +160,7 @@ main = do , rInputType = WordInput , rCaseSensitive = True } + hPutStrLn stderr . show $ map replaceGroup identities LBS.putStr . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities putChar '\n' -- cgit v1.2.3 From 49d1fd08abe933a6caacbe7e105facb76b4fa3b5 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:34:24 +0100 Subject: chdir --- ymir/mlmmj-expose.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index b5fc9cab..3d19035c 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -145,6 +145,7 @@ main = do args <- getArgs case args of [(dropTrailingPathSeparator -> listDir)] -> do + setCurrentDirectory listDir subscribers <- getSubscribers identities <- getIdentities -- cgit v1.2.3 From 6ab9fbd771ec4f62c73f8040f664a091c3fa642d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:34:47 +0100 Subject: remove debug output --- ymir/mlmmj-expose.hs | 1 - 1 file changed, 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 3d19035c..b6309825 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -161,7 +161,6 @@ main = do , rInputType = WordInput , rCaseSensitive = True } - hPutStrLn stderr . show $ map replaceGroup identities LBS.putStr . encodePretty . FoxReplace . Set.fromList $ map replaceGroup identities putChar '\n' -- cgit v1.2.3 From e242fa09afdf2d7763c3c99b900406eb1f7b287d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:36:05 +0100 Subject: replace whole emails --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index b6309825..03af3c4b 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -156,7 +156,7 @@ main = do , groupUrls = Set.empty , groupSubs = Set.fromList $ map (replaceSub ident) subscribers } - replaceSub ident sub = FoxReplaceSub { rInput = hash' (ident, sub) + replaceSub ident sub = FoxReplaceSub { rInput = listName ++ "+" ++ hash' (ident, sub) ++ "@subs.lists.yggdrasil.li" , rOutput = sub , rInputType = WordInput , rCaseSensitive = True -- cgit v1.2.3 From cc962485bf418451f528f2240a23f878898b6acd Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:38:19 +0100 Subject: Regexp replacements --- ymir/mlmmj-expose.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 03af3c4b..56a70bba 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -156,9 +156,9 @@ main = do , groupUrls = Set.empty , groupSubs = Set.fromList $ map (replaceSub ident) subscribers } - replaceSub ident sub = FoxReplaceSub { rInput = listName ++ "+" ++ hash' (ident, sub) ++ "@subs.lists.yggdrasil.li" + replaceSub ident sub = FoxReplaceSub { rInput = listName ++ "\\+" ++ hash' (ident, sub) ++ "(@[^ ]+)?" , rOutput = sub - , rInputType = WordInput + , rInputType = RegexpInput , rCaseSensitive = True } -- cgit v1.2.3 From 29362a81efcc6c3145b999e2324090b12eb2ecb4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 12 Dec 2016 15:40:17 +0100 Subject: more precise regexps --- ymir/mlmmj-expose.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 56a70bba..169fbb42 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -156,7 +156,7 @@ main = do , groupUrls = Set.empty , groupSubs = Set.fromList $ map (replaceSub ident) subscribers } - replaceSub ident sub = FoxReplaceSub { rInput = listName ++ "\\+" ++ hash' (ident, sub) ++ "(@[^ ]+)?" + replaceSub ident sub = FoxReplaceSub { rInput = listName ++ "\\+" ++ hash' (ident, sub) ++ "(@subs\\.lists\\.yggdrasil\\.li)?" , rOutput = sub , rInputType = RegexpInput , rCaseSensitive = True -- cgit v1.2.3 From 8b8f8d3b6e15b9121373d27b51e2edee561dc2d2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 16 Dec 2016 21:51:32 +0100 Subject: Fix path to mlmmj --- ymir/mlmmj-expose.hs | 2 +- ymir/mlmmj-expose.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.hs b/ymir/mlmmj-expose.hs index 169fbb42..f074659b 100644 --- a/ymir/mlmmj-expose.hs +++ b/ymir/mlmmj-expose.hs @@ -109,7 +109,7 @@ main = do uuidTrans' (x:xs) = x : uuidTrans' xs getContents >>= writeFile fName hPrintf stdout "Forwarding mail to <%s>, subscribed to %s\n" recipient (takeBaseName listDir) - callProcess "${pkgs.mlmmj}/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", fName, "-T", recipient] + callProcess "@mlmmj@/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", fName, "-T", recipient] removeFile fName [] -> die "Unknown extension" _ -> die "Ambiguous extension" diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index 370219d3..1eac7c7b 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix @@ -12,7 +12,7 @@ let ]; mlmmj-exposed = pkgs.stdenv.mkDerivation { name = "mlmmj-expose"; - src = ./mlmmj-expose.hs; + src = (pkgs.substituteAll { src = ./mlmmj-expose.hs; inherit (pkgs) mlmmj; }); buildCommand = '' mkdir -p $out/bin #cp $src $out/bin/.mlmmj-exposed -- cgit v1.2.3 From 1b63b3ec308f5d8974153281ee38b8847709408e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 16 Dec 2016 22:12:21 +0100 Subject: Cleanup code --- ymir/mlmmj-expose.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ymir') diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index 1eac7c7b..b3f7499c 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix @@ -12,7 +12,10 @@ let ]; mlmmj-exposed = pkgs.stdenv.mkDerivation { name = "mlmmj-expose"; - src = (pkgs.substituteAll { src = ./mlmmj-expose.hs; inherit (pkgs) mlmmj; }); + src = pkgs.substituteAll { + src = ./mlmmj-expose.hs; + inherit (pkgs) mlmmj; + }; buildCommand = '' mkdir -p $out/bin #cp $src $out/bin/.mlmmj-exposed -- cgit v1.2.3 From ab58cbc6ac0e958bf204c4aa93b16a073c8f4250 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 26 Jan 2017 23:57:15 +0100 Subject: Kleen.li --- ymir/zones/index.nix | 1 + ymir/zones/li.kleen.soa | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ymir/zones/li.kleen.soa (limited to 'ymir') diff --git a/ymir/zones/index.nix b/ymir/zones/index.nix index 9bde25e9..b81df783 100644 --- a/ymir/zones/index.nix +++ b/ymir/zones/index.nix @@ -8,4 +8,5 @@ rec { "praseodym.org" = { data = readFile ./org.praseodym.soa; }; "xmpp.li" = { data = readFile ./li.xmpp.soa; }; "yggdrasil.li" = { data = readFile ./li.yggdrasil.soa; }; + "kleen.li" = { data = readFile ./li.kleen.soa; }; } diff --git a/ymir/zones/li.kleen.soa b/ymir/zones/li.kleen.soa new file mode 100644 index 00000000..8c5af16e --- /dev/null +++ b/ymir/zones/li.kleen.soa @@ -0,0 +1,34 @@ +$ORIGIN kleen.li. +$TTL 3600 +@ IN SOA ns.yggdrasil.li. root.yggdrasil.li. ( + 2017012601 ; serial + 10800 ; refresh + 3600 ; retry + 604800 ; expire + 3600 ; min TTL +) + IN NS ns.yggdrasil.li. + IN NS ns.inwx.de. + IN NS ns2.inwx.de. + IN NS ns3.inwx.eu. + IN NS ns4.inwx.com. + IN NS ns5.inwx.net. + +@ IN A 188.68.51.254 +@ IN AAAA 2a03:4000:6:d004:: +@ IN MX 0 ymir.yggdrasil.li. +@ IN TXT "v=spf1 redirect=yggdrasil.li" + +* IN A 188.68.51.254 +* IN AAAA 2a03:4000:6:d004:: +* IN MX 0 ymir.yggdrasil.li. +* IN TXT "v=spf1 redirect=yggdrasil.li" + +ymir._domainkey IN TXT ( + "v=DKIM1;k=rsa;p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq3cCKlk+VPhyAanLZTM0BCzUT/+fmxHioZcFk0uJk1akBYj7BRofR7eVNcLKpm3rwYMQgE+9vJH9p8SV6tws9EcWc8SMCqqGZlREYM7PmLDiTSK/vjCzkygfgFCb0EBNsY2A/fpP4rTeoxrbcBSvMkq97iY5rwyw4wXZVZXLiDaCj23s8POoxTk1ClqUJZJQ5x2" + "qzrC0RfN5kLZ9A7Gq2jB09vNxpXHYqABA0bJv88JiZM7hfkp9IafJZ+yCVMaBcJs4DAxnTjNAuFD9gm+qSFVY8+yeXqL6Qjo5PbruhyZRBW8RgRYT8t5n07XRglMGKKGMwOGLanrltcyXqB+GsDZBD36RAAwjFadnxdpDyRv4SgRP7ff2tKRrORYpmpN+mKdqw5j3J/nP6bXV1oAkyh9XQkPEIDi81WT87EZziTElDzVp6A2qFOxqucAovoRk24" + "7vlsns1FApFRsp9mja0UZNObyKD1M6tP9Ep7lS76tFGMk+WDvXRJH5LEsyCpu7sSyl1r/O0M4K+KldRCqLlZd7rf8F5P8T0dn1azk05g7F4p0N/y9GNdzXbPZ9u0eZdI7SEdh8ZoOZp7NVZiBFfbWLSS5ZtyA2kbBa4i7GJ/cuAbEKOmqAkeQPiu96TGIcyjkXjS6mTPI+9UmKZYZC+OM8XdJ02y5KRoonCc19ZS8CAwEAAQ==" +) + +_xmpp-client._tcp IN SRV 5 0 5222 ymir.yggdrasil.li. +_xmpp-server._tcp IN SRV 5 0 5269 ymir.yggdrasil.li. -- cgit v1.2.3 From 5ca14bd4b643ffba6be3fcb93af436462e9b982e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 27 Jan 2017 00:56:26 +0100 Subject: nights.email --- ymir/zones/email.nights.soa | 34 ++++++++++++++++++++++++++++++++++ ymir/zones/index.nix | 1 + 2 files changed, 35 insertions(+) create mode 100644 ymir/zones/email.nights.soa (limited to 'ymir') diff --git a/ymir/zones/email.nights.soa b/ymir/zones/email.nights.soa new file mode 100644 index 00000000..ac31f254 --- /dev/null +++ b/ymir/zones/email.nights.soa @@ -0,0 +1,34 @@ +$ORIGIN nights.email. +$TTL 3600 +@ IN SOA ns.yggdrasil.li. root.yggdrasil.li. ( + 2017012701 ; serial + 10800 ; refresh + 3600 ; retry + 604800 ; expire + 3600 ; min TTL +) + IN NS ns.yggdrasil.li. + IN NS ns.inwx.de. + IN NS ns2.inwx.de. + IN NS ns3.inwx.eu. + IN NS ns4.inwx.com. + IN NS ns5.inwx.net. + +@ IN A 188.68.51.254 +@ IN AAAA 2a03:4000:6:d004:: +@ IN MX 0 ymir.yggdrasil.li. +@ IN TXT "v=spf1 redirect=yggdrasil.li" + +* IN A 188.68.51.254 +* IN AAAA 2a03:4000:6:d004:: +* IN MX 0 ymir.yggdrasil.li. +* IN TXT "v=spf1 redirect=yggdrasil.li" + +ymir._domainkey IN TXT ( + "v=DKIM1;k=rsa;p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq3cCKlk+VPhyAanLZTM0BCzUT/+fmxHioZcFk0uJk1akBYj7BRofR7eVNcLKpm3rwYMQgE+9vJH9p8SV6tws9EcWc8SMCqqGZlREYM7PmLDiTSK/vjCzkygfgFCb0EBNsY2A/fpP4rTeoxrbcBSvMkq97iY5rwyw4wXZVZXLiDaCj23s8POoxTk1ClqUJZJQ5x2" + "qzrC0RfN5kLZ9A7Gq2jB09vNxpXHYqABA0bJv88JiZM7hfkp9IafJZ+yCVMaBcJs4DAxnTjNAuFD9gm+qSFVY8+yeXqL6Qjo5PbruhyZRBW8RgRYT8t5n07XRglMGKKGMwOGLanrltcyXqB+GsDZBD36RAAwjFadnxdpDyRv4SgRP7ff2tKRrORYpmpN+mKdqw5j3J/nP6bXV1oAkyh9XQkPEIDi81WT87EZziTElDzVp6A2qFOxqucAovoRk24" + "7vlsns1FApFRsp9mja0UZNObyKD1M6tP9Ep7lS76tFGMk+WDvXRJH5LEsyCpu7sSyl1r/O0M4K+KldRCqLlZd7rf8F5P8T0dn1azk05g7F4p0N/y9GNdzXbPZ9u0eZdI7SEdh8ZoOZp7NVZiBFfbWLSS5ZtyA2kbBa4i7GJ/cuAbEKOmqAkeQPiu96TGIcyjkXjS6mTPI+9UmKZYZC+OM8XdJ02y5KRoonCc19ZS8CAwEAAQ==" +) + +_xmpp-client._tcp IN SRV 5 0 5222 ymir.yggdrasil.li. +_xmpp-server._tcp IN SRV 5 0 5269 ymir.yggdrasil.li. diff --git a/ymir/zones/index.nix b/ymir/zones/index.nix index b81df783..05da73f1 100644 --- a/ymir/zones/index.nix +++ b/ymir/zones/index.nix @@ -9,4 +9,5 @@ rec { "xmpp.li" = { data = readFile ./li.xmpp.soa; }; "yggdrasil.li" = { data = readFile ./li.yggdrasil.soa; }; "kleen.li" = { data = readFile ./li.kleen.soa; }; + "nights.email" = { data = readFile ./email.nights.soa; }; } -- cgit v1.2.3