From 462cace44980691ad80973e2f187c961fd5bc359 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Mon, 30 Nov 2020 22:13:36 -0700 Subject: [PATCH] uncomments rsa replacement synchronizer, removes unused code --- agent/src/Lib/Synchronizers.hs | 39 +++++++++++----------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/agent/src/Lib/Synchronizers.hs b/agent/src/Lib/Synchronizers.hs index e526ca75e..7dfb6dbe0 100644 --- a/agent/src/Lib/Synchronizers.hs +++ b/agent/src/Lib/Synchronizers.hs @@ -61,6 +61,8 @@ import Settings import Util.File import qualified Lib.Algebra.Domain.AppMgr as AppMgr2 import Daemon.ZeroConf ( getStart9AgentHostname ) +import qualified Data.Text as T +import Handler.Register.Nginx ( replaceDerivativeCerts ) data Synchronizer = Synchronizer @@ -439,33 +441,16 @@ syncRepairSsl = SyncOp "Repair SSL Certs" check migrate False liftIO $ renameDirectory newCerts (toS $ sslDirectory `relativeTo` base) liftIO $ systemCtl RestartService "nginx" $> () --- syncConvertEcdsaCerts :: SyncOp --- syncConvertEcdsaCerts = SyncOp "Convert Intermediate Cert to ECDSA P256" check migrate False --- where --- check = do --- fs <- asks $ appFilesystemBase . appSettings --- header <- liftIO $ headMay . lines <$> readFile (toS $ intermediateCaKeyPath `relativeTo` fs) --- pure $ case header of --- Nothing -> False --- Just y -> "BEGIN RSA PRIVATE KEY" `T.isInfixOf` y --- migrate = replaceDerivativeCerts - --- syncConvertEcdsaLeafCert :: SyncOp --- syncConvertEcdsaLeafCert = SyncOp "Convert Intermediate Cert to ECDSA P256" check migrate False --- where --- check = do --- fs <- asks $ appFilesystemBase . appSettings --- h <- injectFilesystemBase fs getStart9AgentHostname --- header <- liftIO $ headMay . lines <$> readFile (toS $ entityKeyPath h `relativeTo` fs) --- pure $ case header of --- Nothing -> False --- Just y -> "BEGIN RSA PRIVATE" `T.isInfixOf` y --- migrate = do --- base <- asks $ appFilesystemBase . appSettings --- _ - --- syncRotateExpiringCerts :: SyncOp --- syncRotateExpiringCerts = _ +syncConvertEcdsaCerts :: SyncOp +syncConvertEcdsaCerts = SyncOp "Convert Intermediate Cert to ECDSA P256" check migrate False + where + check = do + fs <- asks $ appFilesystemBase . appSettings + header <- liftIO $ headMay . lines <$> readFile (toS $ intermediateCaKeyPath `relativeTo` fs) + pure $ case header of + Nothing -> False + Just y -> "BEGIN RSA PRIVATE KEY" `T.isInfixOf` y + migrate = replaceDerivativeCerts failUpdate :: S9Error -> ExceptT Void (ReaderT AgentCtx IO) () failUpdate e = do