From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=irif.fr (client-ip=2001:660:3301:8000::1:2; helo=korolev.univ-paris7.fr; envelope-from=jch@irif.fr; receiver=) Received: from korolev.univ-paris7.fr (korolev.univ-paris7.fr [IPv6:2001:660:3301:8000::1:2]) by mail.toke.dk (Postfix) with ESMTPS id 5DFAF80887C for ; Fri, 5 Mar 2021 14:28:06 +0100 (CET) Received: from potemkin.univ-paris7.fr (potemkin.univ-paris7.fr [IPv6:2001:660:3301:8000::1:1]) by korolev.univ-paris7.fr (8.14.4/8.14.4/relay1/82085) with ESMTP id 125DS5rI002512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 5 Mar 2021 14:28:05 +0100 Received: from mailhub.math.univ-paris-diderot.fr (mailhub.math.univ-paris-diderot.fr [81.194.30.253]) by potemkin.univ-paris7.fr (8.14.4/8.14.4/relay2/82085) with ESMTP id 125DS59l032590; Fri, 5 Mar 2021 14:28:05 +0100 Received: from mailhub.math.univ-paris-diderot.fr (localhost [127.0.0.1]) by mailhub.math.univ-paris-diderot.fr (Postfix) with ESMTP id 6C0B9BF1BD; Fri, 5 Mar 2021 14:28:05 +0100 (CET) X-Virus-Scanned: amavisd-new at math.univ-paris-diderot.fr Received: from mailhub.math.univ-paris-diderot.fr ([127.0.0.1]) by mailhub.math.univ-paris-diderot.fr (mailhub.math.univ-paris-diderot.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id H8surEOPfVYm; Fri, 5 Mar 2021 14:27:57 +0100 (CET) Received: from pirx.irif.fr (unknown [78.194.40.74]) (Authenticated sender: jch) by mailhub.math.univ-paris-diderot.fr (Postfix) with ESMTPSA id 74F63BF1B6; Fri, 5 Mar 2021 14:27:57 +0100 (CET) Date: Fri, 05 Mar 2021 14:27:57 +0100 Message-ID: <87k0ql3f36.wl-jch@irif.fr> From: Juliusz Chroboczek To: Rob Dean In-Reply-To: References: <874kht1jxv.wl-jch@irif.fr> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.1 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (korolev.univ-paris7.fr [IPv6:2001:660:3301:8000::1:2]); Fri, 05 Mar 2021 14:28:05 +0100 (CET) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (potemkin.univ-paris7.fr [194.254.61.141]); Fri, 05 Mar 2021 14:28:05 +0100 (CET) X-Miltered: at korolev with ID 604231E5.001 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-Miltered: at potemkin with ID 604231E5.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 604231E5.001 from potemkin.univ-paris7.fr/potemkin.univ-paris7.fr/null/potemkin.univ-paris7.fr/ X-j-chkmail-Enveloppe: 604231E5.000 from mailhub.math.univ-paris-diderot.fr/mailhub.math.univ-paris-diderot.fr/null/mailhub.math.univ-paris-diderot.fr/ X-j-chkmail-Score: MSGID : 604231E5.001 on korolev.univ-paris7.fr : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Score: MSGID : 604231E5.000 on potemkin.univ-paris7.fr : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham X-j-chkmail-Status: Ham Message-ID-Hash: KMALMLHAXVL2N372ZM4QO5V7RQSK65NB X-Message-ID-Hash: KMALMLHAXVL2N372ZM4QO5V7RQSK65NB X-MailFrom: jch@irif.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: galene@lists.galene.org X-Mailman-Version: 3.3.2 Precedence: list Subject: [Galene] Re: =?iso-8859-1?q?Gal=E8ne?= with PHP List-Id: =?utf-8?q?Gal=C3=A8ne_videoconferencing_server_discussion_list?= Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: > I'm still wondering how to get PHP working on port 8443, so that I can ru= n PHP > and MYSQL alongside Galene. (e.g. https://www.servername.com:8443/test.ph= p) One way would be to run Gal=E8ne behind a frontend proxy such as nginx or Apache. The frontend would need to proxy the WebSocket at /ws to Gal=E8ne, and to proxy any PHP requests to a PHP interpreter, probably over fcgi. As to the static pages, it's probably best to have them served directly be the frontend. > I definitely cannot have a host php page running on port 80 that > attempts to create the websocket for Galene over on port 8443 via > javascript. You could probably do that. You'd just need to very slightly relax Gal=E8ne's security checks, by doing something like the appended patch (untested). In case you want to understand what it does: by default, Gal=E8ne accepts WebSocket connections if either they don't carry an Origin header, or they carry an Origin header that matches the host:port of the server; this avoids attacks where third-party Javascript is used to access a server that is behind a firewall. The attached patch relaxes the latter patch of the test, by only checking the hostname, not the port. You may tweak the test as needed. -- Juliusz diff --git a/webserver/webserver.go b/webserver/webserver.go index e336f88..9aaac4a 100644 --- a/webserver/webserver.go +++ b/webserver/webserver.go @@ -10,6 +10,7 @@ import ( "html" "io" "log" + "net" "net/http" "net/url" "os" @@ -440,6 +441,25 @@ func statsHandler(w http.ResponseWriter, r *http.Reque= st, dataDir string) { =20 var wsUpgrader =3D websocket.Upgrader{ HandshakeTimeout: 30 * time.Second, + CheckOrigin: func(r *http.Request) bool { + origin :=3D r.Header["Origin"] + if len(origin) =3D=3D 0 { + return true + } + u, err :=3D url.Parse(origin[0]) + if err !=3D nil { + return false + } + host1, _, err :=3D net.SplitHostPort(u.Host) + if err !=3D nil { + return false + } + host2, _, err :=3D net.SplitHostPort(r.Host) + if err !=3D nil { + return false + } + return strings.EqualFold(host1, host2) + }, } =20 func wsHandler(w http.ResponseWriter, r *http.Request) {