summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-13 11:57:55 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-13 11:57:55 -0400
commitc8469290bde44a39863e64142ef40ea0fa040700 (patch)
tree372270ff07c56224a86a783e2a37460c16c07544
parent01c6543c27900764de2d68e65aebd51ea546bc88 (diff)
downloadkeysafe-c8469290bde44a39863e64142ef40ea0fa040700.tar.gz
adding some server disk usage tuning options
-rw-r--r--CmdLine.hs38
-rw-r--r--TODO1
-rw-r--r--keysafe.cabal1
3 files changed, 29 insertions, 11 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index c3b8256..067d726 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -22,9 +22,9 @@ data CmdLine = CmdLine
, gui :: Bool
, testMode :: Bool
, customShareParams :: Maybe ShareParams
- , serverConfig :: ServerConfig
, name :: Maybe Name
, othername :: Maybe Name
+ , serverConfig :: ServerConfig
}
data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test
@@ -33,6 +33,8 @@ data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test
data ServerConfig = ServerConfig
{ serverPort :: Port
, serverAddress :: String
+ , diskReserveMb :: Int
+ , monthsToFillHalfDisk :: Int
}
parse :: Parser CmdLine
@@ -109,6 +111,16 @@ parse = CmdLine
<> metavar "N"
<> help ("Configure the number of shares needed to restore. (default: " ++ show (neededObjects (shareParams defaultTunables)) ++ ") (When this option is used to back up a key, it must also be provided at restore time.)")
)
+ nameopt = optional $ Name . BU8.fromString <$> strOption
+ ( long "name"
+ <> metavar "N"
+ <> help "Specify name used for key backup/restore, avoiding the usual prompt."
+ )
+ othernameopt = optional $ Name . BU8.fromString <$> strOption
+ ( long "othername"
+ <> metavar "N"
+ <> help "Specify other name used for key backup/restore, avoiding the usual prompt."
+ )
serverconfig = ServerConfig
<$> option auto
( long "port"
@@ -124,16 +136,20 @@ parse = CmdLine
<> showDefault
<> help "Address for server to bind to. (Use \"*\" to bind to all addresses.)"
)
- nameopt = optional $ Name . BU8.fromString <$> strOption
- ( long "name"
- <> metavar "N"
- <> help "Specify name used for key backup/restore, avoiding the usual prompt."
- )
- othernameopt = optional $ Name . BU8.fromString <$> strOption
- ( long "othername"
- <> metavar "N"
- <> help "Specify other name used for key backup/restore, avoiding the usual prompt."
- )
+ <*> option auto
+ ( long "disk-reserve"
+ <> metavar "N"
+ <> value 256
+ <> showDefault
+ <> help "Server refuses to store objects if less than this much disk space (in megabytes) is free"
+ )
+ <*> option auto
+ ( long "months-to-fill-half-disk"
+ <> metavar "N"
+ <> value 12
+ <> showDefault
+ <> help "Server rate-limits requests and requires proof of work, to avoid too many objects being stored. This is an lower bound on how long it could possibly take for half of the current disk space to be filled."
+ )
get :: IO CmdLine
get = execParser opts
diff --git a/TODO b/TODO
index 2fcfcf6..fdf4e0a 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,7 @@
Soon:
* test client/server Proof Of Work
+* finish --months-to-fill-half-disk and --disk-reserve
* Add some random padding to http requests and responses, to make it
harder for traffic analysis to tell that it's keysafe traffic.
* Implement the different categories of servers in the server list.
diff --git a/keysafe.cabal b/keysafe.cabal
index 00bfd68..01f6fb5 100644
--- a/keysafe.cabal
+++ b/keysafe.cabal
@@ -62,6 +62,7 @@ Executable keysafe
, network == 2.6.*
, token-bucket == 0.1.*
, bloomfilter == 2.0.*
+ , disk-free-space == 0.1.*
-- Temporarily inlined due to https://github.com/ocharles/argon2/issues/3
-- argon2 == 1.1.*
Extra-Libraries: argon2