Skip to content

Commit

Permalink
[chore] at some tracing to find out what the issue with legalhold is
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoIV committed Jan 25, 2024
1 parent 94e864c commit b01c46b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/ssl-util/src/Ssl/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import OpenSSL.RSA
import OpenSSL.Session as SSL
import OpenSSL.X509 as X509
import OpenSSL.X509.Store (X509StoreCtx, getStoreCtxCert)
import Debug.Trace (traceM)

-- Cipher Suites ------------------------------------------------------------

Expand Down Expand Up @@ -188,14 +189,18 @@ extEnvCallback fingerprints store = do
cert <- getStoreCtxCert store
pk <- getPublicKey cert
fprs <- readIORef fingerprints
traceM (show fprs)
case toPublicKey @RSAPubKey pk of
Nothing -> pure False
Just k -> do
fp <- rsaFingerprint sha k
-- find at least one matching fingerprint to continue
if not (any (constEqBytes fp . fingerprintBytes) fprs)
then pure False
then do
traceM "fingerprint not contained in fprs"
pure False
else do
traceM "fingerprint is contained in fprs"
-- Check if the certificate is self-signed.
self <- verifyX509 cert pk
if (self /= VerifySuccess)
Expand Down
2 changes: 2 additions & 0 deletions services/galley/src/Galley/Env.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import Util.Options
import Wire.API.MLS.Credential
import Wire.API.MLS.Keys
import Wire.API.Team.Member
import Debug.Trace

data DeleteItem = TeamItem TeamId UserId (Maybe ConnId)
deriving (Eq, Ord, Show)
Expand Down Expand Up @@ -70,6 +71,7 @@ makeLenses ''Env
-- TODO: somewhat duplicates Brig.App.initExtGetManager
initExtEnv :: IORef [Fingerprint Rsa] -> IO Manager
initExtEnv fingerprints = do
traceM "initExtEnv"
ctx <- Ssl.context
Ssl.contextAddOption ctx SSL_OP_NO_SSLv2
Ssl.contextAddOption ctx SSL_OP_NO_SSLv3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Imports
import Network.HTTP.Client qualified as Http
import System.Logger.Class qualified as Log
import URI.ByteString (uriPath)
import Debug.Trace

-- | Check that the given fingerprint is valid and make the request over ssl.
-- If the team has a device registered use 'makeLegalHoldServiceRequest' instead.
Expand Down Expand Up @@ -92,5 +93,6 @@ makeVerifiedRequestFreshManager ::
(Http.Request -> Http.Request) ->
App (Http.Response LC8.ByteString)
makeVerifiedRequestFreshManager fpr url reqBuilder = do
traceM "makeVerifiedRequestFreshManager"
mgr <- liftIO . initExtEnv =<< newIORef [fpr]
makeVerifiedRequestWithManager mgr url reqBuilder

0 comments on commit b01c46b

Please sign in to comment.