server: bind control port server only to 127.0.0.1 for better security (in case of firewall misconfuguration) (#1280)

This commit is contained in:
Evgeny
2024-09-05 13:48:09 +01:00
committed by GitHub
parent d859f27999
commit a9e8d02593
4 changed files with 12 additions and 12 deletions

View File

@@ -71,7 +71,7 @@ preferAddress RCCtrlAddress {address, interface} addrs =
startTLSServer :: Maybe Word16 -> TMVar (Maybe N.PortNumber) -> TLS.Credentials -> TLS.ServerHooks -> (Transport.TLS -> IO ()) -> IO (Async ())
startTLSServer port_ startedOnPort credentials hooks server = async . liftIO $ do
started <- newEmptyTMVarIO
bracketOnError (startTCPServer started $ maybe "0" show port_) (\_e -> setPort Nothing) $ \socket ->
bracketOnError (startTCPServer started Nothing $ maybe "0" show port_) (\_e -> setPort Nothing) $ \socket ->
ifM
(atomically $ readTMVar started)
(runServer started socket)