mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
only try and renew certs if they exist
This commit is contained in:
@@ -13,7 +13,8 @@ import Lib.Ssl
|
||||
import Daemon.ZeroConf ( getStart9AgentHostname )
|
||||
import Lib.Tor
|
||||
import Control.Carrier.Lift
|
||||
import System.Directory ( removePathForcibly
|
||||
import System.Directory ( doesPathExist
|
||||
, removePathForcibly
|
||||
, renameDirectory
|
||||
)
|
||||
import Lib.SystemCtl
|
||||
@@ -74,5 +75,9 @@ renewSslLeafCert ctx = do
|
||||
|
||||
doesSslNeedRenew :: FilePath -> IO Bool
|
||||
doesSslNeedRenew cert = do
|
||||
exists <- doesPathExist cert
|
||||
if exists
|
||||
then do
|
||||
ec <- liftIO $ system [i|openssl x509 -checkend 2592000 -noout -in #{cert}|]
|
||||
pure $ ec /= ExitSuccess
|
||||
else pure False
|
||||
|
||||
Reference in New Issue
Block a user