Deploy authentik Agent on Linux
What it can do
- Retrieves information about the host and reports it to authentik, see Device Compliance.
- SSH to Linux hosts using authentik credentials, see SSH authentication.
- Authenticate CLI applications using authentik credentials, see CLI application authentication.
Prerequisites
You must configure your authentik deployment to support the authentik Agent.
Create an enrollment token
If you have already created have an enrollment token, skip to the next section.
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Endpoint Devices > Connectors.
- Click on the authentik Agent connector that you created when configuring your authentik deployment to support the authentik agent.
- Under Enrollment Tokens, click Create, and configure the following settings:
- Token name: provide a descriptive name for the token
- Device group (optional): select a device access group for the device to be added to after completing enrollment
- Expiring (optional): set whether or not the enrollment token will expire
- Click Create.
- (Optional) Click the Copy icon in the Actions column to copy the enrollment token. This value will be required if enabling a device for device compliance.
Install the authentik Agent on Linux
Follow these steps to install the authentik Agent on your Linux device:
- Debian-based
- RedHat-based
- Open a Terminal session and install the required GPG key:
curl -fsSL https://pkg.goauthentik.io/keys/gpg-key.asc | sudo gpg --dearmor -o /usr/share/keyrings/authentik-keyring.gpg
- Add the repository:
echo "deb [signed-by=/usr/share/keyrings/authentik-keyring.gpg] https://pkg.goauthentik.io stable main" | sudo tee /etc/apt/sources.list.d/authentik.list
- Update your repositories and install the authentik Agent packages:
sudo apt update
sudo apt install authentik-cli authentik-agent authentik-sysd
- Confirm that the authentik Agent is installed by opening a terminal window and entering the following command:
akYou should see a response that starts with:authentik CLI v<version_number>
- Open a Terminal session and run the following command to add the authentik repo and associated GPG key:
# This overwrites any existing configuration in /etc/yum.repos.d/authentik.repo
cat <<EOF | sudo tee /etc/yum.repos.d/authentik.repo
[authentik]
name=authentik
baseurl=https://pkg.goauthentik.io
enabled=1
gpgcheck=1
gpgkey=https://pkg.goauthentik.io/keys/gpg-key.asc
EOF
- Run the following commands to refresh metadata and install the authentik Agent packages:
sudo yum install -y authentik-cli authentik-agent authentik-sysd
- Confirm that the authentik Agent is installed by opening a terminal window and entering the following command:
akYou should see a response that starts with:authentik CLI v<version_number>
Enable device compliance, SSH server authentication, and local device login
To enable device compliance features and the device accepting SSH connections, you must join the device to an authentik domain.
- Open a Terminal session and run the following command:
sudo ak-sysd domains join <deployment_name> --authentik-url https://authentik.company
deployment_nameis the name that will be used to identify the authentik deployment on the device.https://authentik.companyis the fully qualified domain name of the authentik deployment.
- You will be prompted to enter your enrollment token.
- Once provided, the device will be enrolled with your authentik deployment and should appear on the Devices page after a check-in is completed.
Enable SSH client authentication and CLI application authentication
To enable initiating SSH connections and CLI application authentication, the device must be connected to an authentik deployment. To do so, follow these steps:
- Open a Terminal session and run the following command:
ak config setup --authentik-url https://authentik.company
- Your default browser will open and direct you to the authentik login page. Once authenticated, the authentik Agent will be configured.
Logging
authentik Agent logs are available via the system journal (systemd) or syslog, depending on the distribution.