Skip to content

Commit

Permalink
Reduce cardano-node key file permissions for tests
Browse files Browse the repository at this point in the history
The node is now refusing to start with other-user-readable key files.
  • Loading branch information
rvl committed Nov 27, 2020
1 parent 8a82455 commit 2937383
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/shelley/cardano-wallet.cabal
Expand Up @@ -81,6 +81,7 @@ library
, text-class
, time
, transformers
, unix
, unordered-containers
, vector
, warp
Expand Down
10 changes: 9 additions & 1 deletion lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs
Expand Up @@ -195,6 +195,8 @@ import System.IO.Temp
( createTempDirectory, getCanonicalTemporaryDirectory, withTempDirectory )
import System.IO.Unsafe
( unsafePerformIO )
import System.Posix.Files
( ownerReadMode, setFileMode )
import System.Process
( readProcess, readProcessWithExitCode )
import Test.Utils.Paths
Expand Down Expand Up @@ -663,14 +665,20 @@ withBFTNode tr baseDir params action =
createDirectoryIfMissing False dir
source <- getShelleyTestDataPath

let copyKeyFile f = do
let dst = dir </> f
copyFile (source </> f) dst
setFileMode dst ownerReadMode
pure dst

[bftCert, bftPrv, vrfPrv, kesPrv, opCert] <- forM
[ "bft-leader" <> ".byron.cert"
, "bft-leader" <> ".byron.skey"
, "bft-leader" <> ".vrf.skey"
, "bft-leader" <> ".kes.skey"
, "bft-leader" <> ".opcert"
]
(\f -> copyFile (source </> f) (dir </> f) $> (dir </> f))
copyKeyFile

let extraLogFile = (fmap (first (</> (name ++ ".log"))) logDir)
(config, block0, networkParams, versionData)
Expand Down

0 comments on commit 2937383

Please sign in to comment.