Parcourir la source

PROXY: Update some comments, disallow from registered clients

tags/v0.9.0
Daniel Oaks il y a 6 ans
Parent
révision
7d140c9e43
3 fichiers modifiés avec 13 ajouts et 4 suppressions
  1. 2
    2
      irc/help.go
  2. 7
    1
      irc/server.go
  3. 4
    1
      oragono.yaml

+ 2
- 2
irc/help.go Voir le fichier

@@ -361,8 +361,8 @@ Sends the text to the given targets as a PRIVMSG.`,
361 361
 		oper: true, // not really, but it's restricted anyways
362 362
 		text: `PROXY TCP4/6 <sourceip> <destip> <sourceport> <destport>
363 363
 
364
-Used by haproxy's PROXY protocol, to allow for alternate TLS support:
365
-http://www.haproxy.org/download/1.7/doc/proxy-protocol.txt`,
364
+Used by haproxy's PROXY v1 protocol, to allow for alternate TLS support:
365
+http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt`,
366 366
 	},
367 367
 	"rename": {
368 368
 		text: `RENAME <channel> <newname> [<reason>]

+ 7
- 1
irc/server.go Voir le fichier

@@ -2228,12 +2228,18 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
2228 2228
 }
2229 2229
 
2230 2230
 // PROXY TCP4/6 SOURCEIP DESTIP SOURCEPORT DESTPORT
2231
-// http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
2231
+// http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
2232 2232
 func proxyHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
2233
+	// only allow unregistered clients to use this command
2234
+	if client.registered {
2235
+		return false
2236
+	}
2237
+
2233 2238
 	clientAddress := IPString(client.socket.conn.RemoteAddr())
2234 2239
 	clientHostname := client.hostname
2235 2240
 	for _, address := range server.proxyAllowedFrom {
2236 2241
 		if clientHostname == address || clientAddress == address {
2242
+			//TODO(dan): check DLINEs and connection throttling/limits
2237 2243
 			client.proxiedIP = msg.Params[1]
2238 2244
 			client.hostname = LookupHostname(msg.Params[1])
2239 2245
 			return false

+ 4
- 1
oragono.yaml Voir le fichier

@@ -67,7 +67,10 @@ server:
67 67
 
68 68
     # addresses/hostnames the PROXY command can be used from
69 69
     # this should be restricted to 127.0.0.1 and localhost at most
70
-    proxy-allowed-from: []
70
+    # you should also add these addresses to the connection limits and throttling exemption lists
71
+    proxy-allowed-from:
72
+        # - localhost
73
+        # - "127.0.0.1"
71 74
 
72 75
     # maximum length of clients' sendQ in bytes
73 76
     # this should be big enough to hold /LIST and HELP replies

Chargement…
Annuler
Enregistrer