fosrl / fosrl/pangolin

Unable to use email authentication for Public resource

Open
#3,739 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22.8k
Forks
783
Avg merge
1d 7h
Merged PRs (30d)
52

Description

### Describe the Bug

Running in docker compose on VPS.

Email smtp-relay set up correctly, I have
```
email:
enabled: true
provider: smtp
no_reply: "no-reply@mydomain.com"
from: "no-reply@mydomain.com"
smtp:
host: "smtp-relay.brevo.com"
port: 587
user: "asdfasdfasf@smtp-brevo.com"
pass: "asdfasdfsafd"
secure: false
```
in my `config/config.yml` (user and pass omitted).

I have tested with following script on in Pangolin docker container:
```
python3 - <<'PY'
import smtplib

server = smtplib.SMTP("smtp-relay.brevo.com", 587, timeout=20)
server.set_debuglevel(1)

server.ehlo()
server.starttls()
server.ehlo()
server.login("MY_SMTP_USER", "MY_SMTP_PASS")

server.sendmail(
"no-reply@mydomain.com",
"my-private-email@gmail.com",
"""From: no-reply@mydomain.com
To: "my-private-email@gmail.com"
Subject: Pangolin SMTP test

Test email.
"""
)

server.quit()
print("SUCCESS")
PY
```

with result:
```
reply: retcode (250); Msg: b'Hello [172.18.0.3]\nPIPELINING\n8BITMIME\nENHANCEDSTATUSCODES\nCHUNKING\nAUTH PLAIN LOGIN CRAM-MD5\nSIZE 20971520' send: 'AUTH CRAM-MD5\r\n' reply: b'334 PDEuNjIxNjY1NjgzQFsxNzIuMTguMC4zXT4=\r\n' reply: retcode (334); Msg: b'PDEuNjIxNjY1NjgzQFsxNzIuMTguMC4zXT4=' send: 'NzdlMmIzMDAxQHNtdHAtYnJldm8uY29tIGQ3ZDQzMTQ3YjgwZmQyYmM1ODY1NTJjMjM3NzllNTBk\r\n' reply: b'235 2.0.0 Authentication succeeded\r\n' reply: retcode (235); Msg: b'2.0.0 Authentication succeeded' send: 'mail FROM: size=97\r\n' reply: b'250 2.0.0 Roger, accepting mail from \r\n' reply: retcode (250); Msg: b'2.0.0 Roger, accepting mail from ' send: 'rcpt TO:\r\n' reply: b"250 2.0.0 I'll make sure gets this\r\n" reply: retcode (250); Msg: b"2.0.0 I'll make sure gets this" send: 'data\r\n' reply: b'354 Go ahead. End your data with .\r\n' reply: retcode (354); Msg: b'Go ahead. End your data with .' data: (354, b'Go ahead. End your data with .') send: b'From: no-reply@mydomain.com\r\nTo: my-private-email@gmail.com\r\nSubject: Pangolin SMTP test\r\n\r\nTest email.\r\n.\r\n' reply: b'250 2.0.0 OK: queued as <202609140725.59520412565@smtp-relay.sendinblue.com>\r\n' reply: retcode (250); Msg: b'2.0.0 OK: queued as <202609140725.59520412565@smtp-relay.sendinblue.com>' data: (250, b'2.0.0 OK: queued as <202609140725.59520412565@smtp-relay.sendinblue.com>') send: 'quit\r\n' reply: b'221 2.0.0 Bye\r\n' reply: retcode (221); Msg: b'2.0.0 Bye' SUCCESS
```

but in docker compose logs still getting:
```
pangolin | Making resource whitelist request to: http://localhost:3000/api/v1/auth/resource/15/whitelist
pangolin | 2026-09-14T07:56:40+00:00 [error]: connect ECONNREFUSED ::1:587
pangolin | Stack: Error: connect ECONNREFUSED ::1:587
pangolin | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1706:16) {"errno":-111,"code":"ESOCKET","syscall":"connect","address":"::1","port":587,"command":"CONN"}
```
Looks like Instead of resolving the IP of smtp-relay, it is resolving to `localhost`, or I am doing something wrong.

When doing curl within the container I get:
```
root@843bc1cfb42d:/app# curl http://localhost:3000/api/v1/auth/resource/15/whitelist
{"data":null,"success":false,"error":true,"message":"Unauthorized","status":401,"stack":null}root@843bc1cfb42d:/app#
```

### Environment

- OS Type & Version: AlmaLinux 10.2 (host)
- Pangolin Version: 1.22.2 (also 1.22.0)
- Edition (Community or Enterprise): Community
- Gerbil Version: 1.5.0
- Traefik Version: v3.7
- Newt Version: v1.16.0
- Client Version: n/a

### To Reproduce

see Bug description.

### AI Disclosure

Chat GPT for troubleshooting commands, python script for sending email...

### Expected Behavior

Email is sent.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the whitelist request at /api/v1/auth/resource/15/whitelist and the SMTP settings from config/config.yml, then compare the application connection path with the successful Python SMTP test. Done means the application resolves the configured SMTP host instead of connecting to ::1:587 and sends the public-resource authentication email.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript
Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.