Open excaliburzarau opened 5 months ago
Hi guys, i think i might have found the issue.
On docker swarm, to ensure that the containers talk to each other without exposing the door, a network has to be created with overlay type and has to be then declared as an external network on the compose.
I am not sure if authentik is currently supporting this.
I automatically created an internal network when deploying the stack and it is now working without any issue.
The implications of this is that i have to declare the ports of the containers which internally would mess up the Single Sign On concept on some basic http authentication but at least, at the moment, on the services i have running, only 2 applications are affected which work with Auth0 so it will still redirect to Authentik.
At the moment it does seem that the Docker Swarm is not fully supported.
Thank you Best Regards
Thanks a lot @excaliburzarau that saved me!
Thanks a lot @excaliburzarau that saved me!
No worries. I got it working after a few tries but it does seem to be working fine for the moment. The Authentik team is doing an awesome job developing this IDP system.
Best Regards
On docker swarm, to ensure that the containers talk to each other without exposing the door, a network has to be created with overlay type and has to be then declared as an external network on the compose.
yes, that's kind of the basic of docker swarm isn't it?
btw: rkokkelk user was so nice to share his swarm configuration with traefik: I had it up and running on my swarm too
https://gist.github.com/rkokkelk/3f2e195dd9f657e99fe77b60cd22fc6c
hi @excaliburzarau i have the exact same issue (the redirect loop after login, sometimes logging in but with fetch error, etc). I also have Caddy (as caddy-docker-proxy). I dont have Docker Swarm however. can you share how did you fix it exactly in terms of lines of code that you added/changed ?
that would be super helpful. maybe @cwirz you know as well as you said it helped you.
Thanks a lot !
hi @excaliburzarau i have the exact same issue (the redirect loop after login, sometimes logging in but with fetch error, etc). I also have Caddy (as caddy-docker-proxy). can you share how did you fix it exactly in terms of lines of code that you added/changed ?
that would be super helpful. maybe @cwirz you know as well as you said it helped you.
Thanks a lot !
Hello.
What i had to do was create an external overlay network manually and use it on the docker composes.
docker network create demo-network -d overlay
I believe this command should create it. You then have to deploy the stacks that you want with the created network.
networks: demo-network: external: true name: demo-network
Something like this.
I dont know if this is the reason why you are having the issue but it did resolve it for me.
Best Regards
@excaliburzarau PERFECT ! it works well :) BUT, this is the command i had to do:
docker network create -d overlay --attachable network-overlay
The --attachable
option enables both standalone containers and Swarm services to connect to the overlay network. Without --attachable, only Swarm services can connect to the network.
Then I added the network in docker-compose like normally
by having at the end:
networks:
network-overlay:
external: true
and in each service :
networks:
- network-overlay
and no more loop and setup was complete and all works well thanks again !
@excaliburzarau PERFECT ! it works well :) BUT, this is the command i had to do:
docker network create -d overlay --attachable network-overlay
The
--attachable
option enables both standalone containers and Swarm services to connect to the overlay network. Without --attachable, only Swarm services can connect to the network.Then I added the network in docker-compose like normally
by having at the end:
networks: network-overlay: external: true
and in each service :
networks: - network-overlay
and no more loop and setup was complete and all works well thanks again !
On my case was swarm which is a litle bit different. Sorry about that. I AM glad it worked for you also.
Best Regards
@excaliburzarau just in case : on the app that i want to protect https://testapp.domain.ltd
i can see the authentik login screen and can login fine, however, the app itself is giving me 502 (the app calls /api/query?=abc for example and i get a 502 to this and sometimes to the favicon, and sometimes to the root of the app).
Do you have any idea if it is linked or if that is a totally new issue ?
I dont see any issues in logs :/
@excaliburzarau just in case : on the app that i want to protect
https://testapp.domain.ltd
i can see the authentik login screen and can login fine, however, the app itself is giving me 502 (the app calls /api/query?=abc for example and i get a 502 to this and sometimes to the favicon, and sometimes to the root of the app). Do you have any idea if it is linked or if that is a totally new issue ? I dont see any issues in logs :/
I believe it my be a different issue. Maybe with the redirects or headers passes on the snippet but i AM unsure.
But it would Be a good place to start the troubleshooting.
Best Regards
@excaliburzarau just in case : on the app that i want to protect
https://testapp.domain.ltd
i can see the authentik login screen and can login fine, however, the app itself is giving me 502 (the app calls /api/query?=abc for example and i get a 502 to this and sometimes to the favicon, and sometimes to the root of the app). Do you have any idea if it is linked or if that is a totally new issue ? I dont see any issues in logs :/
I was also thinking about this and maybe try to confirm that the type of network is correct and the config on the inspect of the network is correct. I had to manually set the subnet and gateway on my case. Best Regards.
I am getting a CORS issue ("strict-origin-when-cross-origin") on the subpage, so unsure if it's on authentik side, or caddy side, or else :/ without authentik it works perfectly well btw i created this issue to not hijack your thread : https://github.com/goauthentik/authentik/issues/10557
I am getting a CORS issue ("strict-origin-when-cross-origin") on the subpage, so unsure if it's on authentik side, or caddy side, or else :/ without authentik it works perfectly well btw i created this issue to not hijack your thread : #10557
It might not be related but i set the custom headers on the snippet like this:
(authentik) {
reverse_proxy /outpost.goauthentik.io/* http://authentik_ip:9900
# forward authentication to outpost
forward_auth http://authentik_ip:9900 {
uri /outpost.goauthentik.io/auth/caddy
# capitalization of the headers is important, otherwise they will be empty
copy_headers X-Authentik-Username X-Authentik-Groups X-Authentik-Email X-Authentik-Name X-Authentik-Uid X-Authentik-Jwt X-Authentik-Meta-Jwks X-Authentik-Meta-Outpost X-Authentik-Meta-Provider X-Authentik-Meta-App X-Authentik-Meta-Version X-Forwarded-Host Authorization
# optional, in this config trust all private ranges, should probably be set to the outposts IP
#trusted_proxies private_ranges
}
}
Again, it might not be related but it did some changes on the headers because it sometimes gave me errors while loading the page.
Best Regards
works :) thank you !!
I AM glad it helped. Best Regards
Hello guys,
I have been trying to setup the Authentik on docker swarm behing the Caddy Reverse Proxy but i am now stuck on an issue that i don't fully understand of what is wrong.
First i was having and issue while creating the admin user (initial-setup page not found) on a clean install but by gradually upgrading from the 2023.1.1 version to the current 2024.4.2 i was able to create the admin user.
I then was starting to configure the Authentik but, when i login, it redirects me to the home page and refreshes back to the login page. Sometimes i was able to get to the admin page where reports that there is an error Fetching object, i was able to see that the session status is unauthenticated and, redirects to the login page.
When i get to the logs i got what is think is the issue as seen below.
I can attach my docker compose file i use on my docker swarm instance and the Caddyfile.
Is there anyone able to provide me some guidance on the issue i am having?
Best Regards