benbusby / whoogle-search

A self-hosted, ad-free, privacy-respecting metasearch engine
https://pypi.org/project/whoogle-search/
MIT License
9.35k stars 924 forks source link

[Question] Fails because duckduckgo.com connection refused #603

Closed danbulant closed 2 years ago

danbulant commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

Tried deploying whoogle on my own server using docker (over nomad). No firewall set up (yet), default settings for docker (in nomad) other than changed env (see below).

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/local/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/whoogle/app/__init__.py", line 100, in <module>
    gen_bangs_json(app.config['BANG_FILE'])
  File "/whoogle/app/utils/bangs.py", line 19, in gen_bangs_json
    r = requests.get(DDG_BANGS)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='duckduckgo.com', port=443): Max retries exceeded with url: /bang.v255.js (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f6ea94961c0>: Failed to establish a new connection: [Errno -3] Try again'))

Errors out, no stdout.

To Reproduce Steps to reproduce the behavior: Deploy using docker

Deployment Method

Version of Whoogle Search

Additional context ( replaced)

 WHOOGLE_CONFIG_URL = "https://<URL>"
WHOOGLE_CONFIG_NEW_TAB = "true"
WHOOGLE_CONFIG_THEME = "dark"

using curl from host works correctly, I tried running whoogle with host network mode but it didn't work either. that works, my problem likely, will see. I don't have any firewall setup so I have no idea why it doesn't work from isolated network

Albonycal commented 2 years ago

using curl from host works correctly,

like curl https://duckduckgo.com ?

also another question, does your country try to block duckduckgo? because Indian ISPs try to do that but it's harder when the site uses TLS 1.3

danbulant commented 2 years ago

Yup, that works correctly. I'm using Contabo, hosted in Germany.

(as a side note, I don't get why would they block duckduckgo...)

accountForIssues commented 2 years ago

Is the DNS inside the containers working correctly ? Try doing a ping or dig from inside the container.

As a sidenote, I could never get whoogle to work correctly with Contabo VPS. Maybe things have changed since I last tried.

Albonycal commented 2 years ago

(as a side note, I don't get why would they block duckduckgo...)

idk .. try doing the dig duckduckgo.com from the container

benbusby commented 2 years ago

Yeah I'm not sure why this would be blocked, but the app no longer relies on fetching the DDG bang json before starting (see 72e5a227c83a06117257d63a073e0ac8e50ed30e).

Closing for now since I don't think the connection refusal is due to anything directly related to Whoogle itself, but I'm happy to continue the discussion here anyways.

madindehead commented 6 months ago

Commenting to re-open this. I am seeing this issue when running Whoogle over ProtonVPN using the linuxserver.io wireguard container. I am connecting it using the instructions from this section of their guide for routing containers through wireguards network stack.

This might be a me problem, but not entirely sure.

Running on http://0.0.0.0:5000
Exception in thread Thread-1 (gen_bangs_json):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
    self._validate_conn(conn)
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
    conn.connect()
    ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
    ^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f893edc6dd0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='duckduckgo.com', port=443): Max retries exceeded with url: /bang.js (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f893edc6dd0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1031, in _bootstrap_inner
    self.run()
    ^^^^^^^^^^
  File "/usr/local/lib/python3.11/threading.py", line 968, in run
    self._target(*self._args, **self._kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/whoogle/app/utils/bangs.py", line 20, in gen_bangs_json
    r = requests.get(DDG_BANGS)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='duckduckgo.com', port=443): Max retries exceeded with url: /bang.js (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f893edc6dd0>: Failed to establish a new connection: [Errno -3] Try again'))