ubuntu / authd

Authentication daemon for external Brokers
GNU Lesser General Public License v3.0
110 stars 9 forks source link

Issue: Enable or describe how to use the Entraid provider behind a proxy #446

Open melfacion opened 3 months ago

melfacion commented 3 months ago

Is there an existing issue for this?

Describe the issue

When installing authd and the entra snap on a computer that does not have direct internet access, there is no description on how to add a proxy for reaching microsoft/entra.

Produces the following error in the entraid log: "could not create broker with provided issuer and client ID"

Where does the issue happens

Steps to reproduce it

1: Install Ubuntu in an isolated network with only access to internet through (http) proxy server 2: export http_proxy and https_proxy values to allow adding of PPA 3: Add PPA and install authd 4: Set proxy values for snap to allow snap installation through proxy 5: Install EntraID snap 6: Configure according to installation guide / wiki 7: See results in "journalctl -u snap.authd-msentraid.authd-msentraid.service"

System information and logs

Environment

Log files

Please redact/remove sensitive information:

Authd entries:

Aug 01 13:41:36 <hostname> systemd[1]: Starting authd.service - Authd daemon service...
Aug 01 13:41:36 <hostname> authd[21199]: WARNING Broker configuration directory "/etc/authd/brokers.d/" does not exist, only local broker will be available
Aug 01 13:41:36 <hostname> systemd[1]: Started authd.service - Authd daemon service.
Aug 01 14:01:01 <hostname> systemd[1]: Stopping authd.service - Authd daemon service...
Aug 01 14:01:01 <hostname> systemd[1]: authd.service: Deactivated successfully.
Aug 01 14:01:01 <hostname> systemd[1]: Stopped authd.service - Authd daemon service.
Aug 01 14:01:01 <hostname> systemd[1]: Starting authd.service - Authd daemon service...
Aug 01 14:01:01 <hostname> systemd[1]: Started authd.service - Authd daemon service.

MS Entra ID broker entries:

Aug 01 13:53:08 <hostname> systemd[1]: Started snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.
Aug 01 13:53:09 <hostname> authd-msentraid.authd-msentraid[22349]: time=2024-08-01T13:53:09.544+02:00 level=ERROR msg="could not create broker with provided issuer and client ID: Get \"https://login.microsoftonline.com/%3CISSUER_ID%3E/v2.0/.well-known/openid-configuration\": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving"
Aug 01 13:53:09 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 13:53:09 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:09 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Scheduled restart job, restart counter is at 1.
Aug 01 13:53:09 <hostname> systemd[1]: Started snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.
Aug 01 13:53:09 <hostname> authd-msentraid.authd-msentraid[22381]: time=2024-08-01T13:53:09.905+02:00 level=ERROR msg="could not create broker with provided issuer and client ID: Get \"https://login.microsoftonline.com/%3CISSUER_ID%3E/v2.0/.well-known/openid-configuration\": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving"
Aug 01 13:53:09 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 13:53:09 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Scheduled restart job, restart counter is at 2.
Aug 01 13:53:10 <hostname> systemd[1]: Started snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.
Aug 01 13:53:10 <hostname> authd-msentraid.authd-msentraid[22412]: time=2024-08-01T13:53:10.378+02:00 level=ERROR msg="could not create broker with provided issuer and client ID: Get \"https://login.microsoftonline.com/%3CISSUER_ID%3E/v2.0/.well-known/openid-configuration\": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving"
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Scheduled restart job, restart counter is at 3.
Aug 01 13:53:10 <hostname> systemd[1]: Started snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.
Aug 01 13:53:10 <hostname> authd-msentraid.authd-msentraid[22438]: time=2024-08-01T13:53:10.827+02:00 level=ERROR msg="could not create broker with provided issuer and client ID: Get \"https://login.microsoftonline.com/%3CISSUER_ID%3E/v2.0/.well-known/openid-configuration\": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving"
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:10 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Scheduled restart job, restart counter is at 4.
Aug 01 13:53:10 <hostname> systemd[1]: Started snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.
Aug 01 13:53:11 <hostname> authd-msentraid.authd-msentraid[22464]: time=2024-08-01T13:53:11.144+02:00 level=ERROR msg="could not create broker with provided issuer and client ID: Get \"https://login.microsoftonline.com/%3CISSUER_ID%3E/v2.0/.well-known/openid-configuration\": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving"
Aug 01 13:53:11 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 13:53:11 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:11 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Scheduled restart job, restart counter is at 5.
Aug 01 13:53:11 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Start request repeated too quickly.
Aug 01 13:53:11 <hostname> systemd[1]: snap.authd-msentraid.authd-msentraid.service: Failed with result 'exit-code'.
Aug 01 13:53:11 <hostname> systemd[1]: Failed to start snap.authd-msentraid.authd-msentraid.service - Service for snap application authd-msentraid.authd-msentraid.

Application settings

Please redact/remove sensitive information:

Broker configuration:

[oidc]
issuer = https://login.microsoftonline.com/<redactedid>/v2.0
client_id = <redactedid>

[users]
# The directory where the home directory will be created for new users.
# Existing users will keep their current directory.
# The user home directory will be created in the format of {home_base_dir}/{username}
# home_base_dir = /home

# The username suffixes that are allowed to login via ssh without existing previously in the system.
# The suffixes must be separated by commas.
# ssh_allowed_suffixes = @example.com,@anotherexample.com
ssh_allowed_suffixes = @<ourcompany.com>

Broker authd configuration:

# This section is used by authd to identify and communicate with the broker.
# It should not be edited.
[authd]
name = Microsoft Entra ID
brand_icon = /snap/authd-msentraid/current/broker_icon.png
dbus_name = com.ubuntu.authd.MSEntraID
dbus_object = /com/ubuntu/authd/MSEntraID

Relevant information

Usecase for this need is that external users will authenticate with EntraID OIDC on reverse proxy and a web-based RDP gateway (Apache Guacamole), and we want to use the same authentication on the next hop (that will be using xrdp to connect to the ubuntu terminal server which is on an internal network without direct internet access)

Double check your logs

melfacion commented 2 months ago

Workaround: Set system-wide proxy in "/etc/systemd/system.conf"

DefaultEnvironment="FTP_PROXY=http://<proxyip:proxyport>" "HTTPS_PROXY=http://<proxyip:proxyport>" "HTTP_PROXY=http://<proxyip:proxyport>" "NO_PROXY=localhost,127.0.0.0/8,::1" "ftp_proxy=http://<proxyip:proxyport>" "http_proxy=http://<proxyip:proxyport>" "https_proxy=http://<proxyip:proxyport>" "no_proxy=localhost,127.0.0.0/8,::1"