synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Enabling url_preview_ip_range_blacklist engages against register_new_matrix_user calls

Open killua-eu opened this issue 10 years ago • 12 comments

I enabled the commented out sanely sounding defaults limiting the spiders access to local networks, nonetheless, with the blacklist enabled, adding new users from shell fails:

register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml https://$myipadress:8448
New user localpart [root]: ee
Password: 
Confirm password: 
Sending registration request...
Traceback (most recent call last):
  File "/usr/bin/register_new_matrix_user", line 154, in <module>
    register_new_user(args.user, args.password, args.server_url, secret)
  File "/usr/bin/register_new_matrix_user", line 102, in register_new_user
    request_registration(user, password, server_location, shared_secret)
  File "/usr/bin/register_new_matrix_user", line 55, in request_registration
    f = urllib2.urlopen(req, context=ssl.SSLContext(ssl.PROTOCOL_SSLv23))
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>

killua-eu avatar Jun 19 '16 20:06 killua-eu

just noticed that the ip range blacklisted doesnt even has anything to do with this problem. Only url_preview_enabled: True is needed to fail register_new_matrix_user

killua-eu avatar Jun 19 '16 20:06 killua-eu

The error you've pasted here is just saying that the script is failing to connect to your synapse instance in order to register the user. The thing you should be looking at is the error which is stopping synapse from running.

ara4n avatar Jun 19 '16 21:06 ara4n

@ara4n, the thing is: with url_preview_enabled: True calling register_new_matrix_user works. with url_preview_enabled: False calling register_new_matrix_user doesnt work. I thought at first that there's a firewall problem, but a simple trial/error with telnet showed this isnt the case.

killua-eu avatar Jun 20 '16 07:06 killua-eu

@killua-eu So register_new_matrix_user works if url previewing is enabled but not when its disabled?

erikjohnston avatar Jun 20 '16 09:06 erikjohnston

@erikjohnston my bad, sorry, with url_preview_enabled: True calling register_new_matrix_user doesnt work with url_preview_enabled: False calling register_new_matrix_user works dang ...

Please be aware that I used the testing deb package on ubuntu 16.04, so I may be causing this myself by mixing stuff. If the deb package isnt in good shape and the default correct way is to use the pip install, I'll revert to continue testing with that.

killua-eu avatar Jun 20 '16 11:06 killua-eu

Hi. I too am having this issue running a home server on Ubuntu 16.04 hosted on Digital Ocean. Is there a way to fix this as I'd really like URL previews to work?

waveyuk avatar Oct 26 '17 22:10 waveyuk

I suspect you need to install the url_preview dependencies. On Ubuntu, this should be:

apt-get install libxml2-dev
pip install lxml netaddr

I'm going to guess this will fix the issue and close it - please yell if it doesn't.

ara4n avatar Oct 26 '17 23:10 ara4n

Hi @ara4n The first command successfully ran, but the "pip" command says PIP isn't recognised. I have read in other forums about installing it can break python installs from third party python implementations, so any guidance welcomed Dave

waveyuk avatar Oct 27 '17 10:10 waveyuk

If you're using the debian packages you'll want to install python-netaddr and python-lxml packages

erikjohnston avatar Oct 27 '17 10:10 erikjohnston

Hi @erikjohnston Thanks for your help - that fixed the issue :) 👍 Dave

waveyuk avatar Oct 27 '17 10:10 waveyuk

Gee. What a nightmare. Fortunately I have found this issue. This should definitely be simpler! Either a decent error message or proper dependencies with the Debian package in the first place. At the moment this is just terrible because it is in no way apparent what is causing the issue.

rgpublic avatar May 28 '18 14:05 rgpublic

Just came across this thread because Synapse doesn't start at all if url_preview = True.

helmut72 avatar May 30 '18 19:05 helmut72