@@ -7,11 +7,13 @@ import Common
77import Prelude ()
88
99import Control.Monad.Operational
10- import Control.Monad.Trans.Except (ExceptT (.. ), runExceptT )
11- import Network.HTTP.Client (Manager , newManager )
12- import Network.HTTP.Client.TLS ( tlsManagerSettings )
10+ import Control.Monad.Trans.Except (ExceptT (.. ), runExceptT )
11+ import Network.HTTP.Client (Manager , newManager , ManagerSettings )
12+ import Network.HTTP.Client.OpenSSL ( opensslManagerSettings , withOpenSSL )
1313
14- import qualified GitHub as GH
14+ import qualified GitHub as GH
15+ import qualified OpenSSL.Session as SSL
16+ import qualified OpenSSL.X509.SystemStore as SSL
1517
1618data R a where
1719 R :: FromJSON a => GH. Request 'GH.RA a -> R a
@@ -29,7 +31,7 @@ githubRequest :: FromJSON a => GH.Request 'GH.RA a -> GithubMonad a
2931githubRequest = singleton . R
3032
3133main :: IO ()
32- main = do
34+ main = withOpenSSL $ do
3335 manager <- newManager tlsManagerSettings
3436 auth' <- getAuth
3537 case auth' of
@@ -39,3 +41,14 @@ main = do
3941 repo <- githubRequest $ GH. repositoryR " phadej" " github"
4042 githubRequest $ GH. ownerInfoForR (GH. simpleOwnerLogin . GH. repoOwner $ repo)
4143 print owner
44+
45+ tlsManagerSettings :: ManagerSettings
46+ tlsManagerSettings = opensslManagerSettings $ do
47+ ctx <- SSL. context
48+ SSL. contextAddOption ctx SSL. SSL_OP_NO_SSLv2
49+ SSL. contextAddOption ctx SSL. SSL_OP_NO_SSLv3
50+ SSL. contextAddOption ctx SSL. SSL_OP_NO_TLSv1
51+ SSL. contextSetCiphers ctx " ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256"
52+ SSL. contextLoadSystemCerts ctx
53+ SSL. contextSetVerificationMode ctx $ SSL. VerifyPeer True True Nothing
54+ return ctx
0 commit comments