Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntfys (and maybe other) not working in docker with self signed certificate #126

Closed
AlBundy33 opened this issue Jul 28, 2024 · 2 comments
Closed

Comments

@AlBundy33
Copy link

AlBundy33 commented Jul 28, 2024

docker-compose.yml

services:
  mailrise:
    image: yoryan/mailrise
    restart: unless-stopped
    volumes:
      - ./mailrise.conf:/etc/mailrise.conf:ro
      - /etc/ssl/certs/MyRootCA.pem:/etc/ssl/certs/MyRootCA.pem:ro
      - /etc/ssl/certs/afe69bea.0:/etc/ssl/certs/afe69bea.0:ro
      - /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:/etc/ssl/certs/ca-certificates.crt:ro
    ports:
      - 8025:8025

mailrise.conf

configs:
  ntfy:
    urls:
      - ntfys://ntfy.my.domain/test

inside the mailrise container I can curl https://ntfy.my.domain/test but I get an error if I try to send a mail with

swaks --to ntfy@mailrise.xyz --server localhost:8025
mailrise-1  | [2024-07-28 00:04:28] WARNING:apprise:A Connection error occurred sending ntfy:https://ntfy.my.domain notification.
mailrise-1  | [2024-07-28 00:04:28] WARNING:mailrise.skeleton:Notification failed: address: [ root@2ff14d9b3ee2 ➤ ntfy@mailrise.xyz ] subject: [ test Sun, 28 Jul 2024 00:04:27 +0000 ] body: [ This is a test maili (0.0K) ]

it seems that python is not using /etc/ssl/certs by default
https://stackoverflow.com/questions/70855939/python-requests-not-looking-into-etc-ssl-certs-for-self-signed-certificates

Calling ntfy over http works but I would prefer https

solution: #126 (comment)

@AlBundy33
Copy link
Author

according to stackoverflow I've changed in /home/mailrise/.local/lib/python3.12/site-packages/apprise/plugins/NotifyNtfy.py verify=self.verify_certificate to verify="/etc/ssl/certs"
with this change the notification works as expected.
should this be reported in apprise?

Another workaround is modify mailrise.conf and change the url from ntfys://ntfy.my.domain/test to ntfys://ntfy.my.domain/test?verify=no
this works but imo it would be better if we can use self signed certs with validation.

@AlBundy33
Copy link
Author

AlBundy33 commented Jul 28, 2024

I've found a solution on stackoverflow: https://stackoverflow.com/questions/42982143/python-requests-how-to-use-system-ca-certificates-debian-ubuntu

just add this to your compose file

    environment:
      - REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
services:
  mailrise:
    image: yoryan/mailrise
    restart: unless-stopped
    environment:
      - REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
    volumes:
      - ./mailrise.conf:/etc/mailrise.conf:ro
      - /etc/ssl/certs/MyRootCA.pem:/etc/ssl/certs/MyRootCA.pem:ro
      - /etc/ssl/certs/afe69bea.0:/etc/ssl/certs/afe69bea.0:ro
      - /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:/etc/ssl/certs/ca-certificates.crt:ro
    ports:
      - 8025:8025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant