diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-22 07:39:43 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-08-22 07:39:43 -0700 |
commit | 3a8ea0015aae951aef1093e7adc2c72191d1ae28 (patch) | |
tree | bbcbec0e783a4d314d5b6d967946e5740b497043 | |
parent | a3c7efe91e11568a91771b3a3b56be8879fd4a89 (diff) | |
parent | 77b9e79d7a08bf568d0325dc3cbc661822f16ce5 (diff) | |
download | debug-me-3a8ea0015aae951aef1093e7adc2c72191d1ae28.tar.gz |
Merge tag '1.20200820'
tagging package debug-me version 1.20200820
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | Server.hs | 19 | ||||
-rw-r--r-- | debug-me.cabal | 7 | ||||
-rw-r--r-- | debug-me.service | 2 | ||||
-rw-r--r-- | doc/bugs/logs_not_being_mailed.mdwn | 7 | ||||
-rw-r--r-- | doc/bugs/logs_not_being_mailed/comment_1_94104cd2832c9a4e0fcdadc9f286a6f6._comment | 11 | ||||
-rw-r--r-- | doc/forum/support_for_https_proxy__63__.mdwn | 16 | ||||
-rw-r--r-- | doc/forum/support_for_https_proxy__63__/comment_1_e09730934629688660cc71df5bb464cd._comment | 14 | ||||
-rw-r--r-- | doc/install.mdwn | 2 | ||||
-rw-r--r-- | doc/news/version_1.20170505.mdwn | 3 | ||||
-rw-r--r-- | doc/news/version_1.20190926.mdwn | 5 | ||||
-rw-r--r-- | stack.yaml | 2 |
12 files changed, 78 insertions, 19 deletions
@@ -1,3 +1,12 @@ +debug-me (1.20200820) unstable; urgency=medium + + * debug-me.service: Remove /etc from InaccessiblePaths, + as that prevents the server sending email using eg postfix, + which needs to read its config files. + * Update to lts-14.27, support websockets 0.12.7. + + -- Joey Hess <id@joeyh.name> Thu, 20 Aug 2020 14:04:40 -0400 + debug-me (1.20190926) unstable; urgency=medium * Avoid a crash when run without a controlling tty, which may happen @@ -16,7 +16,6 @@ import Log import Network.Wai import Network.Wai.Handler.Warp import Network.Wai.Handler.WebSockets -import Network.WebSockets hiding (Message, serverPort) import qualified Network.WebSockets as WS import Network.HTTP.Types import Control.Concurrent @@ -124,7 +123,7 @@ websocketApp :: ServerOpts -> TVar ServerState -> WS.ServerApp websocketApp o ssv pending_conn = do conn <- WS.acceptRequest pending_conn _v <- negotiateWireVersion conn - r <- receiveData conn + r <- WS.receiveData conn case r of SelectMode ClientSends (InitMode email) -> user email o ssv conn SelectMode ClientSends (ConnectMode t) -> @@ -136,7 +135,7 @@ websocketApp o ssv pending_conn = do user :: EmailAddress -> ServerOpts -> TVar ServerState -> WS.Connection -> IO () user email o ssv conn = do sid <- withSessionID (serverDirectory o) $ \(loghv, sid) -> do - sendBinaryData conn (Ready ServerSends sid) + WS.sendBinaryData conn (Ready ServerSends sid) bracket (setup sid loghv) (cleanup sid) go return sid doneSessionLog email o sid @@ -173,7 +172,7 @@ user email o ssv conn = do case v of Just (Broadcast l _from) -> case loggedMessage l of Developer m -> do - sendBinaryData conn (AnyMessage (Developer m)) + WS.sendBinaryData conn (AnyMessage (Developer m)) relaytouser userchan User _ -> relaytouser userchan Nothing -> return () @@ -188,12 +187,12 @@ developer o ssv sid conn = bracket setup cleanup go sessionLogFile (serverDirectory o) sid if exists then do - sendBinaryData conn (Ready ServerSends sid) + WS.sendBinaryData conn (Ready ServerSends sid) replayBacklog o sid conn - sendBinaryData conn Done + WS.sendBinaryData conn Done else protocolError conn "Unknown session ID" go (Just session) = do - sendBinaryData conn (Ready ServerSends sid) + WS.sendBinaryData conn (Ready ServerSends sid) devchan <- replayBacklogAndListen o sid session conn mytid <- mkWeakThreadId =<< myThreadId _ <- relayfromdeveloper mytid session @@ -216,7 +215,7 @@ developer o ssv sid conn = bracket setup cleanup go v <- atomically $ readTMChan devchan case v of Just (Broadcast l from) -> do - let sendit = sendBinaryData conn + let sendit = WS.sendBinaryData conn (AnyMessage $ loggedMessage l) case loggedMessage l of User _ -> sendit @@ -231,7 +230,7 @@ developer o ssv sid conn = bracket setup cleanup go else sendit relaytodeveloper mytid devchan Nothing -> do - sendBinaryData conn Done + WS.sendBinaryData conn Done return () -- | Replay the log of what's happened in the session so far, @@ -253,7 +252,7 @@ replayBacklog :: ServerOpts -> SessionID -> WS.Connection -> IO () replayBacklog o sid conn = do ls <- streamLog (sessionLogFile (serverDirectory o) sid) forM_ ls $ \l -> case loggedMessage <$> l of - Right m -> sendBinaryData conn (AnyMessage m) + Right m -> WS.sendBinaryData conn (AnyMessage m) Left _ -> return () doneSessionLog :: EmailAddress -> ServerOpts -> SessionID -> IO () diff --git a/debug-me.cabal b/debug-me.cabal index 94af103..d859cbb 100644 --- a/debug-me.cabal +++ b/debug-me.cabal @@ -1,6 +1,6 @@ Name: debug-me -Version: 1.20190926 -Cabal-Version: >= 1.8 +Version: 1.20200820 +Cabal-Version: >= 1.10 Maintainer: Joey Hess <joey@kitenet.net> Author: Joey Hess Stability: Experimental @@ -50,7 +50,8 @@ custom-setup Executable debug-me Main-Is: debug-me.hs - GHC-Options: -threaded -Wall -fno-warn-tabs -O2 -XNoMonadFailDesugaring + GHC-Options: -threaded -Wall -fno-warn-tabs -O2 + Default-Language: Haskell98 Build-Depends: base (>= 4.9 && < 5.0) , network (>= 2.6) diff --git a/debug-me.service b/debug-me.service index 03a8917..a046da5 100644 --- a/debug-me.service +++ b/debug-me.service @@ -6,7 +6,7 @@ Documentation=https://debug-me.branchable.com/ Environment='DAEMON_PARAMS=--server /var/log/debug-me/ --delete-old-logs' EnvironmentFile=-/etc/default/debug-me ExecStart=/usr/bin/debug-me $DAEMON_PARAMS -InaccessiblePaths=/home /etc +InaccessiblePaths=/home ReadWritePaths=/var/log/debug-me User=_debug-me Group=_debug-me diff --git a/doc/bugs/logs_not_being_mailed.mdwn b/doc/bugs/logs_not_being_mailed.mdwn new file mode 100644 index 0000000..a833d48 --- /dev/null +++ b/doc/bugs/logs_not_being_mailed.mdwn @@ -0,0 +1,7 @@ +I just ran a test session `http://debug-me.joeyh.name:8081/75e73467-e2bb-4d0e-809b-5b1991228710`. + +It seemed to work ok, except that no logs were mailed afterwards. I checked the logs on the MX, and didn't see any connects. + +Seperately, but possibly related I reported a [debian bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968717) about trying to get emailing logs working on my own server. + +> [[fixed|done]] --[[Joey]] diff --git a/doc/bugs/logs_not_being_mailed/comment_1_94104cd2832c9a4e0fcdadc9f286a6f6._comment b/doc/bugs/logs_not_being_mailed/comment_1_94104cd2832c9a4e0fcdadc9f286a6f6._comment new file mode 100644 index 0000000..541144f --- /dev/null +++ b/doc/bugs/logs_not_being_mailed/comment_1_94104cd2832c9a4e0fcdadc9f286a6f6._comment @@ -0,0 +1,11 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2020-08-20T17:08:03Z" + content=""" +This is caused by debug-me.service containing + + InaccessiblePaths=/home /etc + +I've fixed the server and will release a new debug-me version fixing it. +"""]] diff --git a/doc/forum/support_for_https_proxy__63__.mdwn b/doc/forum/support_for_https_proxy__63__.mdwn new file mode 100644 index 0000000..da89550 --- /dev/null +++ b/doc/forum/support_for_https_proxy__63__.mdwn @@ -0,0 +1,16 @@ +I tried a simple nginx port forward +[[!format text """ +location /debug-me/ { + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto https; + proxy_redirect off; + proxy_pass https://127.0.0.1:8081; + proxy_http_version 1.1; +} +"""]] + +I'm not sure if I botched the proxy configuration, or if debug-me needs something added to support proxying? + +[[!format text """ +Connecting to debug-me server...debug-me: MalformedResponse (ResponseHead {responseCode = 301, responseMessage = "Moved Permanently", responseHeaders = [("Server","nginx/1.14.2"),("Date","Wed, 19 Aug 2020 15:02:36 GMT"),("Content-Type","text/html"),("Content-Length","185"),("Location","http://pivot.cs.unb.ca/debug-me/"),("Connection","keep-alive")]}) "Wrong response status or message." +"""]] diff --git a/doc/forum/support_for_https_proxy__63__/comment_1_e09730934629688660cc71df5bb464cd._comment b/doc/forum/support_for_https_proxy__63__/comment_1_e09730934629688660cc71df5bb464cd._comment new file mode 100644 index 0000000..399f072 --- /dev/null +++ b/doc/forum/support_for_https_proxy__63__/comment_1_e09730934629688660cc71df5bb464cd._comment @@ -0,0 +1,14 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2020-08-20T17:25:45Z" + content=""" +Well, debug-me does not follow redirects, and it seems that the http proxy +is adding one for some reason. + +It looks like Network.Websockets.Client.runClientWith +is where that is coming from, and the websockets library does not currently +support redirs. Actually, that library implements https itself, +which is a surprise to me. It seems it would need some work to support +redirs. +"""]] diff --git a/doc/install.mdwn b/doc/install.mdwn index f6b1dc7..c48e6d9 100644 --- a/doc/install.mdwn +++ b/doc/install.mdwn @@ -5,7 +5,7 @@ To use: tar xf debug-me-standalone-amd64.tar.gz - debug-me/debug-me + debug-me/runshell debug-me/bin/debug-me ## Distributions diff --git a/doc/news/version_1.20170505.mdwn b/doc/news/version_1.20170505.mdwn deleted file mode 100644 index 221b369..0000000 --- a/doc/news/version_1.20170505.mdwn +++ /dev/null @@ -1,3 +0,0 @@ -debug-me 1.20170505 released with [[!toggle text="these changes"]] -[[!toggleable text=""" - * First release of debug-me."""]]
\ No newline at end of file diff --git a/doc/news/version_1.20190926.mdwn b/doc/news/version_1.20190926.mdwn new file mode 100644 index 0000000..b7f929f --- /dev/null +++ b/doc/news/version_1.20190926.mdwn @@ -0,0 +1,5 @@ +debug-me 1.20190926 released with [[!toggle text="these changes"]] +[[!toggleable text=""" + * Avoid a crash when run without a controlling tty, which may happen + in some container environments. + * Update to lts-13.29, support ghc 8.6.5, and aeson 1.4."""]]
\ No newline at end of file @@ -1,6 +1,6 @@ packages: - '.' -resolver: lts-13.29 +resolver: lts-14.27 extra-deps: - graphviz-2999.20.0.3 - posix-pty-0.2.1.1 |