damien
Hi,
I have set up a VPS, installed certbot and managed to run Phoenix 1.5.7 using HTTPS.
The paths to the key and cert files from lets encrypt are read by phoenix from ENV variables in the prod.secret.exs file.
The files will be renewed automatically by certbot every 3 months using a cron job.
I can’t find answers to the following questions:
-
How to deal with the renewal of the keys on the Phoenix side? Do I have to restart the Phoenix server or will Phoenix read the updated files in due time?
-
Would the situation be the same with the new elixir runtime config files?
I would appreciate any insights on these issues which are new to me.
Thanks in advance for your help.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
When I use Mix.install with a git dependency, using git@github.com:... how do I change the SSH identity used?
I’ve got two Github accoun...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #elixirconf-us
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #security
- #elixirconf-eu
- #api
- #forms
- #performance










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
crova
While I don’t know the exact answers to your questions, maybe you can find some insights from this library.
And if you would accept bringing a dependency to your app, you could use the library to manage your certificates and eventually ditch certbot.
soup
I keep my certs in
/etc/letsencrypt/live/..., set in a docker env file.I add this to my endpoint:
and have a matching
rel/overlays/certbotfolder (it’s empty, just exists to create the folder).I have this in my phoenix service in my docker compose file:
I use certbot’s webroot option and basically tell it to go use
/my/compose/root/certbot, which gets mounted at/app/certbot, which cowboy will serve at/, and it all just works.First run you have to shuffle some mess around but it’s easier to use certbot’s own webserver to generate the first set of certs, then change it to use webroot.
The SSL guide recommends you use the fullchain.pem file for atomic updates, you don’t have to restart phx.
sam701
I use
traefikrunning in front of my app. It cares about the certificate renewal and also routing.Exadra37
I am also using it for now, but be very careful with trusting in the headers because they don’t cleanup the headers as they should. For example, the
x-forward-foris set by them, but it can also be set by the client sending the request, thus you end-up with two ips in your backend:Your backend logs:
So which IP you gonna trust now
proxy_ip=82.22.85.84, xx.23x.8x.8x?It seems that the last is the real IP from the client, but Treafik should always drop any header it sets, as any good behaved proxy does
sam701
That is true, overwritten headers could be an issue. But maybe it is not an issue for @damien I find it nice not to care about certificate renewal.
Regarding the overwritten headers… what if you configure traefik / your LB to use some other, “unforgeable” name for the header, e.g.
X-Forwarded-34535435987-For?Exadra37
Could be a workaround if Traefik allows for that, but then you also need to account for that in software that assumes the standard header for the proxy to be the
x-fowarded-for.I was loving Traefik until I discovered this issue and that they kept “refusing” to fix it, despite open bugs.
So, I will have to ditch Traefik in a near future, because if they screw-up in the basics of security and won’t fix I don’t even want to imagine what else they got fundamentally wrong.
Exadra37
I strongly recommend you to use the library mentioned by @crova:
This library is from @sasajuric the author of the book
Elixir in Actionand also a very reputable member of our communitysasajuric
If those files are updated, I think you don’t need to restart anything and the new certs will be eventually picked up. FWIW site_encrypt forces this manually by invoking :ssl.clear_pem_cache.