Code Monkey home page Code Monkey logo

Comments (15)

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024 1

@edleeman17 I wasn't able to get simplelogin to run. However using this helped me get it up and running. I'd highly recommend it.

from app.

springcomp avatar springcomp commented on July 18, 2024

The instructions are entirely correct but assume that:

  1. You are running Simple Login as Docker containers
  2. You are running Postfix on the host.

From that perspective, what you are seing is that:

The sl-app is trying to connect to the host via the well-known docker brigde network gateway 10.0.0.1 on port 25.
There are no firewall issues as this is running entirely within the box itself.

Does that match your setup?

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

@springcomp Yes that is exactly my setup.

from app.

springcomp avatar springcomp commented on July 18, 2024

On another note, you mention using 4.6.5-beta.
Did you also update the required instruction for running sl-migration ?

  docker run --rm \
      --name sl-migration \
      -v $(pwd)/sl:/sl \
      -v $(pwd)/sl/upload:/code/static/upload \
      -v $(pwd)/dkim.key:/dkim.key \
      -v $(pwd)/dkim.pub.key:/dkim.pub.key \
      -v $(pwd)/simplelogin.env:/code/.env \
      --network="sl-network" \
-    simplelogin/app:3.4.0 flask db upgrade
+    simplelogin/app:4.6.5-beta alembic upgrade head

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

@springcomp I tried with both 3.4.0 and 4.6.5-beta (with updated command for migration).

from app.

springcomp avatar springcomp commented on July 18, 2024

Can you try and report the following troubleshooting steps:

  1. Postfix must be running on the host

Please, try to connect to the local SMTP server:

> telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 app.domain.tld ESMTP Postfix (Ubuntu)
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
>

Please, make sure you can successfully connect to the local SMTP server.
You will need to issue the QUIT command to exit.
Please, make sure that the SMTP banner mentions the fully qualified name of you self hosted domain like app.domain.tld.

  1. Check the network configuration

Please, run the following command:

docker inspect network simplelogin_default

You should get a JSON-formatted output with network configuration.
Make sure that the gateway is indeed specified:

    "IPAM": {
        "Driver": "default",
        "Options": null,
        "Config": [
            {
                "Subnet": "10.0.0.0/24",
                "Gateway": "10.0.0.1"
            }
        ]
    }

Please, check that the running containers all share the same network.
you can lookup the output to locate the Containers array and see if you have all running containers with a matching IP address from the same network.

My setup reports the following configuration:

  • sl-app running on 10.0.0.3/24
  • sl-email running on 10.0.0.2/24
  • sl-job-runner running on 10.0.0.4/24
  • sl-db running on 10.0.0.6/24

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024
  1. Postfix is running and I was successfully able to connect to localhost on port 25 using telnet.
  2. My network name is sl-network and its configuration is correct. I can also see that all the containers are connected via this network and all of them have IPs assigned to them in the 10.0.0.x range.

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

Here's the complete network config:

[
    {
        "Name": "sl-network",
        "Id": "8cec3bd46e9b11bacee64dc78bce420cba24da11eae89b2c19b6741289bf703b",
        "Created": "2023-12-04T09:42:08.000606397Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "10.0.0.0/24",
                    "Gateway": "10.0.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "130efb6112097084a2a6b8824632f410d841a980641e813928ea0af523833f30": {
                "Name": "sl-job-runner",
                "EndpointID": "e00ecba8377355420af7cf5e149d633d30d494e2c7d3af637de7f314224645a4",
                "MacAddress": "02:42:0a:00:00:03",
                "IPv4Address": "10.0.0.3/24",
                "IPv6Address": ""
            },
            "346a1367145e71a15a0122c413fc748fd3548348809d65239995b752b65f7e40": {
                "Name": "sl-email",
                "EndpointID": "bee71577a8b9109ae466b0f23bc1ec1bfb5d1285820ae0f45ff1c5527a644f1f",
                "MacAddress": "02:42:0a:00:00:02",
                "IPv4Address": "10.0.0.2/24",
                "IPv6Address": ""
            },
            "4b94e28d23e1a0180ed6ee8234c258c9e749c30fad0fb7bece7fe7b1b4cfa40a": {
                "Name": "sl-db",
                "EndpointID": "d9bb04d3cc43a94fab3966ffa56fb182002741c82158c55219660fcc0f47ad00",
                "MacAddress": "02:42:0a:00:00:05",
                "IPv4Address": "10.0.0.5/24",
                "IPv6Address": ""
            },
            "5d07dac7c4af4a1ed9b17f400489c4eb4af866c44619e8c05c7296fad2ef889f": {
                "Name": "sl-app",
                "EndpointID": "1cf92077bae94a6e66ae197c2f3ee8a636b6ff6904c5398ece9d46d92a371f84",
                "MacAddress": "02:42:0a:00:00:04",
                "IPv4Address": "10.0.0.4/24",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

from app.

springcomp avatar springcomp commented on July 18, 2024

So, for some reason, when inside a docker container, you cannot reach the host… 🤔

Can you try connecting to sl-app and issueing a telnet command:

> docker exec -it sl-app bash
root@5d07dac7c4a:/code# apt update && apt install -y inetutils-telnet
root@5d07dac7c4a:/code# telnet 10.0.0.1 25
Trying 10.0.0.1 ...
Connected to 10.0.0.1.
Escape character is '^]'.
220 app.domain.tld ESMTP Postfix (Ubuntu)
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
root@5d07dac7c4a: /code# 

If that works, I’m out of ideas 😥

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

I'm not able to connect to host from within the container:

root@705a1b7af81c:/code# telnet 10.0.0.1 25
Trying 10.0.0.1...
telnet: Unable to connect to remote host: Connection refused

from app.

springcomp avatar springcomp commented on July 18, 2024

Can you share the output of sudo ufw status ?

I would suggest disabling the firewall for troubleshooting.
Just out of curiosity, can you please confirm that your host IP is not in 10.0.0.x network ?

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

I did turn off the firewall to see if that was causing some issue but that was not the case.

Also, two of my host's interfaces are in the range 10.15.0.x and 10.104.0.x respectively. However, even changing the IP range in the docker network to 192.168.0.x did not work.

from app.

mrehanabbasi avatar mrehanabbasi commented on July 18, 2024

Also, now when I try to create an account or resend the verification email, I get "502 Bad gateway" error from nginx and this in the logs:

2023-12-05 02:13:54,643 - SL - DEBUG - 337 - "/code/app/email_utils.py:298" - send_email() -  - send email to [email protected], subject 'Just one more step to join SimpleLogin'
[2023-12-05 02:14:10 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:337)
[2023-12-05 02:14:10 +0000] [337] [INFO] Worker exiting (pid: 337)
[2023-12-05 02:14:11 +0000] [343] [INFO] Booting worker with pid: 343

from app.

edleeman17 avatar edleeman17 commented on July 18, 2024

I'm also getting the same as @mrehanabbasi. Same errors, same issue. I got around the account registration by modifying the users table like so...

UPDATE users SET activated = 't' where email = '[email protected]';

But I'm not able to send an email to my alias and have it forwarded as I'm getting connection refused

2024-01-13 00:53:38,854 - SL - ERROR - "email_handler.py:1625" - handle_DATA() - 2c99d4b9-0cec-4888-b178-d96d9aadb8f7 - email handling fail [email protected] -> ['[email protected]']
Traceback (most recent call last):
  File "email_handler.py", line 1619, in handle_DATA
    ret = self._handle(envelope)
  File "email_handler.py", line 1643, in _handle
    ret = handle(envelope)
  File "email_handler.py", line 1604, in handle
    for is_delivered, smtp_status in handle_forward(envelope, msg, rcpt_to):
  File "email_handler.py", line 540, in handle_forward
    user,
  File "email_handler.py", line 736, in forward_email_to_mailbox
    is_forward=True,
  File "/code/app/email_utils.py", line 1132, in sl_sendmail
    smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT_FORWARD)
  File "/usr/local/lib/python3.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.7/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/local/lib/python3.7/smtplib.py", line 307, in _get_socket
    self.source_address)
  File "/usr/local/lib/python3.7/socket.py", line 728, in create_connection
    raise err
  File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
  • Running on Raspberry Pi 4
  • simplelogin/app 3.4.0
  • postgres 12.1

from app.

edleeman17 avatar edleeman17 commented on July 18, 2024

Thank you! I'll take a look

from app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.