summaryrefslogtreecommitdiffhomepage
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-14 15:51:59 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-14 15:51:59 -0400
commit92f0a9c8b6c676281dcbee6e4bce938b969ef7c2 (patch)
treeb5fb0fee6d476db3b6658c5d7ec07e9387658fb2 /CmdLine.hs
parent0709306afeaba998d8f0a76e37517d4c227ac1c3 (diff)
downloadkeysafe-92f0a9c8b6c676281dcbee6e4bce938b969ef7c2.tar.gz
Added --chaff mode which uploads random junk to servers.
This is useful both to test the server throttling of uploads, and to make it harder for servers to know if an object actually contains secret key information. This commit was sponsored by Brock Spratlen on Patreon.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 67af2da..51bfa5c 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -8,6 +8,7 @@ module CmdLine where
import Types
import Types.Storage
import Tunables
+import Servers (HostName)
import qualified Gpg
import Options.Applicative
import qualified Data.ByteString.UTF8 as BU8
@@ -27,7 +28,7 @@ data CmdLine = CmdLine
, serverConfig :: ServerConfig
}
-data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test
+data Mode = Backup | Restore | UploadQueued | Server | Chaff HostName | Benchmark | Test
deriving (Show)
data ServerConfig = ServerConfig
@@ -38,7 +39,7 @@ data ServerConfig = ServerConfig
parse :: Parser CmdLine
parse = CmdLine
- <$> optional (backup <|> restore <|> uploadqueued <|> server <|> benchmark <|> test)
+ <$> optional (backup <|> restore <|> uploadqueued <|> server <|> chaff <|> benchmark <|> test)
<*> optional (gpgswitch <|> fileswitch)
<*> localstorageswitch
<*> localstoragedirectoryopt
@@ -65,6 +66,11 @@ parse = CmdLine
( long "server"
<> help "Run as a keysafe server, accepting objects and storing them to ~/.keysafe/objects/local/"
)
+ chaff = Chaff <$> strOption
+ ( long "chaff"
+ <> metavar "HOSTNAME"
+ <> help "Upload random data to a keysafe server."
+ )
benchmark = flag' Benchmark
( long "benchmark"
<> help "Benchmark speed of keysafe's cryptographic primitives."