0

Platform: Debian 9
Matrix/synapse version: 0.22.1-1

I first installed the necessary dependencies:

$ pip install lxml
$ pip install netaddr
$ pip install twisted
$ sudo apt install libxslt1-dev

I then edited /etc/matrix-synapse/homeserver.yaml so that:

url_preview_enabled: true

url_preview_ip_range_blacklist:
 - ‘127.0.0.0/8'
 - ‘209.58.160.224/32’
 - ‘fc00::/7’

Since my server only has an external IP and no internal subnet i figured this would be ok.

Synapse service then keeps restarting and producing this error:

Sep 30 01:44:12 hostname python[29155]:     config["url_preview_ip_range_blacklist"]
Sep 30 01:44:12 hostname python[29155]:   File "/usr/lib/python2.7/dist-packages/netaddr/ip/sets.py", line 121, in __init__
Sep 30 01:44:12 hostname python[29155]:     for cidr in cidr_merge(mergeable):
Sep 30 01:44:12 hostname python[29155]:   File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 1549, in cidr_merge
Sep 30 01:44:12 hostname python[29155]:     cidr = IPNetwork(ip)
Sep 30 01:44:12 hostname python[29155]:   File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 933, in __init__
Sep 30 01:44:12 hostname python[29155]:     raise AddrFormatError('invalid IPNetwork %s' % addr)
Sep 30 01:44:12 hostname python[29155]: netaddr.core.AddrFormatError: <exception str() failed>
Sep 30 01:44:12 hostname systemd[1]: matrix-synapse.service: Main process exited, code=exited, status=1/FAILURE

I also tried these but they all produced the same error:

url_preview_ip_range_blacklist:
- ‘127.0.0.0/8'
- ‘209.58.160.224/32’
- ‘fc00::/7’

url_preview_ip_range_blacklist:
- ‘127.0.0.0/8'
- ‘209.58.160.224/32’
#- ‘fc00::/7’

url_preview_ip_range_blacklist:
- ‘127.0.0.0/8'
#- ‘209.58.160.224/32’
#- ‘fc00::/7’

More configurations that failed with the same error:

url_preview_ip_range_blacklist:
 - ‘127.0.0.0/8'
# - ‘209.58.160.224/32’
# - ‘fc00::/7’

url_preview_ip_range_blacklist:
 - ‘127.0.0.0'
# - ‘209.58.160.224/32’
# - ‘fc00::/7’

url_preview_ip_range_blacklist:
 - ‘127.0.0.0/8'
 - ‘209.58.160.224’
# - ‘fc00::/7’

Final solution was to change the quotation marks as Max suggested:

This worked, final syntax was:

url_preview_enabled: true

url_preview_ip_range_blacklist:
 - '127.0.0.0/8'
 - '209.58.160.224/32'
 - 'fc00::/7'
ptman
  • 27,124
  • 2
  • 26
  • 45
PC-Admin
  • 63
  • 1
  • 7

1 Answers1

1

Some of your quote characters are NOT regular ones, but a "tick" one: vs ' which make the parsing fail.

Max Dor
  • 46
  • 2