Skip to content

Apple SSL certificate updated. How do I get Pigeon to use the new pem on the active server? #292

Open

Description

@Sinc63

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
    Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Elixir 1.16.3 (compiled with Erlang/OTP 26)

  • Operating system: OS9
  • Pigeon version: 2.0.0-rc2

Current behavior

Our Apple SSL certificate expired yesterday in our environment sending pushes through Pigeon. I have the certificate defined in the config file using file.read!. Now that I've got a new pem file, is there a way to install that on the operating server running the app, and update the environment variables to read the new pem and use it?
I tried creating a new value for the Application.put_env(:myapp, Myapp.APNS.Prod) with the cert containing the new content, then tried restarting the process Myapp.APNS.Prod, but I'm still being flooded with errors like
[info] function=decode/3 line=136 module=ssl_alert TLS :client: In state :connection received SERVER ALERT: Fatal - Certificate Expired

Expected behavior

I'm hoping not to have to build a new load every year when the APPLE certs expire, So I need a way to install the pem in the running system and get the system to make use of it.
How do I update the config on a running system and get it to take effect?

Activity

  1. Sinc63 commented on Feb 13, 2025

    @Sinc63
    Author

    The Certificate Expired Errors are happening about 5-6 times per second. What is causing that, and is there anything I can do to throttle that back. I don't want to get blacklisted by Apple.

  2. nkezhaya commented on Feb 20, 2025

    @nkezhaya

    @Sinc63 Did you ever figure this out? I'm also running into this issue.

  3. Sinc63 commented on Feb 22, 2025

    @Sinc63
    Author

    @nkezhaya I did end up having to create a new build to solve this, but it should prevent having to do it again next year. Move the configuration of your adapters into config/runtime.exs instead of config/config.exs. Since I was reading the pem files in the config I had to change the File.read! to insert the application directory in front, but it should work fine when you update the pems later and just reload.
    That is:
    cert: File.read!(Path.join(Application.app_dir(:myapp), "priv/aps.pem"))

  4. hpopp commented on Feb 22, 2025

    @hpopp
    Member

    This is on my roadmap to address this year and make the developer quality of life a little better. The crashing and reconnecting has been a long standing issue with how Kadabra was originally designed, so I will likely switch to mint/finch to handle connections and implement some sort of graceful unauthorized error on push dispatch. That said, you still have to be disciplined to renew certs on time.

    If you don't want to have to renew certs every year, I recommend switching to the JWT setup. Example config is in the docs.

  5. lukasz-szulborski commented on Apr 30, 2025

    @lukasz-szulborski

    @Sinc63 Did you ever figure this out? I'm also running into this issue.

    I'm also running into this issue. My setup is a bit problematic in that scenario thought, because I'm using a dispatcher with an open connection and I use certificates saved in a database. It is the client, not me who uploads and keeps certificates up to date. So if the cert is expired, I have no control over updating it and I'm flooded with these TLS errors mentioned earlier which also causes memory leak I think.

  6. Sinc63 commented on May 7, 2025

    @Sinc63
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions