Changeset 426 in code


Ignore:
Timestamp:
Oct 25, 2020, 5:22:12 PM (5 years ago)
Author:
contact
Message:

Don't accept any IP as a proxy by default

It's too easy to setup a reverse proxy which doesn't support the PROXY
protocol, or lets the X-Forwarded-For header fields pass through.
Disable this by default.

To restore the previous behaviour, add accept-proxy-ip localhost to
the config file.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/config.go

    r424 r426  
    5353        }
    5454        return &Server{
    55                 Hostname:       hostname,
    56                 SQLDriver:      "sqlite3",
    57                 SQLSource:      "soju.db",
    58                 AcceptProxyIPs: loopbackIPs,
     55                Hostname:  hostname,
     56                SQLDriver: "sqlite3",
     57                SQLSource: "soju.db",
    5958        }
    6059}
     
    101100                        srv.AcceptProxyIPs = nil
    102101                        for _, s := range d.Params {
     102                                if s == "localhost" {
     103                                        srv.AcceptProxyIPs = append(srv.AcceptProxyIPs, loopbackIPs...)
     104                                        continue
     105                                }
    103106                                _, n, err := net.ParseCIDR(s)
    104107                                if err != nil {
  • trunk/doc/soju.1.scd

    r386 r426  
    115115        Allow the specified IPs to act as a proxy. Proxys have the ability to
    116116        overwrite the remote and local connection addresses (via the X-Forwarded-\*
    117         HTTP header fields). By default, the loopback addresses 127.0.0.0/8 and
    118         ::1/128 are accepted.
     117        HTTP header fields). The special name "localhost" accepts the loopback
     118        addresses 127.0.0.0/8 and ::1/128. By default, all IPs are rejected.
    119119
    120120# IRC SERVICE
Note: See TracChangeset for help on using the changeset viewer.