diff options
-rw-r--r-- | CHANGELOG | 7 | ||||
-rw-r--r-- | Storage/Network.hs | 2 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | UI.hs | 3 | ||||
-rw-r--r-- | UI/NonInteractive.hs | 42 | ||||
-rw-r--r-- | keysafe.cabal | 1 |
6 files changed, 55 insertions, 2 deletions
@@ -1,3 +1,10 @@ +keysafe (0.20160832) UNRELEASED; urgency=medium + + * Fix bug that prevented keysafe --server from running when there was no + controlling terminal and zenity was not installed. + + -- Joey Hess <id@joeyh.name> Thu, 01 Sep 2016 11:42:27 -0400 + keysafe (0.20160831) unstable; urgency=medium * Server implementation is ready for initial deployment. diff --git a/Storage/Network.hs b/Storage/Network.hs index d16d693..ef6d86e 100644 --- a/Storage/Network.hs +++ b/Storage/Network.hs @@ -42,7 +42,7 @@ serverUrl srv = BaseUrl Http (serverName srv) (serverPort srv) "" -- Using tor is highly recommended, to avoid correlation attacks. networkServers :: IO [Server] networkServers = return - [ Server "localhost" 4242 + [ Server "vzgrspuxbtnlrtup.onion" 4242 -- keysafe.joeyh.name , Server "localhost" 4242 , Server "localhost" 4242 ] @@ -2,6 +2,8 @@ Soon: * Run a key restore and make sure it takes 35 to 50 minutes. * client/server Proof Of Work +* 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. * Include an example tor hidden service config * Get some keysafe servers set up. @@ -11,6 +11,7 @@ import Types.UI import Control.Monad import UI.Zenity import UI.Readline +import UI.NonInteractive import Control.Concurrent.MVar availableUIs :: IO [UI] @@ -27,7 +28,7 @@ selectUI needgui l <- availableUIs case l of (u:_) -> return u - [] -> error "Neither zenity nor the readline UI are available" + [] -> return noninteractiveUI -- Adds a percent to whatever amount the progress bar is at. type AddPercent = Percent -> IO () diff --git a/UI/NonInteractive.hs b/UI/NonInteractive.hs new file mode 100644 index 0000000..f0010eb --- /dev/null +++ b/UI/NonInteractive.hs @@ -0,0 +1,42 @@ +{- Copyright 2016 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU AGPL version 3 or higher. + -} + +module UI.NonInteractive (noninteractiveUI) where + +import Types.UI +import System.IO +import Control.Exception + +noninteractiveUI :: UI +noninteractiveUI = UI + { isAvailable = return True + , showError = myShowError + , showInfo = myShowInfo + , promptQuestion = myPrompt + , promptName = \t d _ -> myPrompt t d + , promptPassword = \b t d -> myPrompt t d b + , promptKeyId = myPrompt + , withProgress = myWithProgress + } + +myShowError :: Desc -> IO () +myShowError desc = hPutStrLn stderr $ "Error: " ++ desc + +myShowInfo :: Title -> Desc -> IO () +myShowInfo _title desc = putStrLn desc + +myPrompt :: Title -> Desc -> x -> IO a +myPrompt _title desc _ = do + putStrLn desc + error "Not running at a terminal and zenity is not installed; cannot interact with user." + +myWithProgress :: Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a +myWithProgress _title desc a = bracket_ setup cleanup (a sendpercent) + where + setup = putStrLn desc + sendpercent p = do + putStr (show p ++ "% ") + hFlush stdout + cleanup = putStrLn "done" diff --git a/keysafe.cabal b/keysafe.cabal index bffd362..9c0b1a6 100644 --- a/keysafe.cabal +++ b/keysafe.cabal @@ -89,6 +89,7 @@ Executable keysafe Types.UI UI UI.Readline + UI.NonInteractive UI.Zenity source-repository head |