Pangolin Authentication
Pangolin is a self-hosted reverse proxy that signs people in before their
requests reach your server. The Pangolin plugin signs these people in to FileRun, without a second
password. This page describes what Pangolin needs, how to add the source in FileRun, and how to test
it.
FileRun connects to Pangolin through an authentication source. You add the source in the control
panel, under Security → Authentication. For the settings that every source has, such as
Role of new user accounts, see Authentication integration.
How the sign-in works
- A person opens FileRun through Pangolin. When the person is not signed in to Pangolin yet, Pangolin shows its own sign-in page first.
- Pangolin forwards the request to FileRun, and adds the person to the request, in these headers:
Remote-User: the usernameRemote-User-Id: the ID of the user in PangolinRemote-Email: the e-mail addressRemote-Name: the full name
- The person clicks the sign-in button of the source. FileRun reads the headers and signs the person in, with no other step.
The headers have no signature. Badger, the Traefik plugin of Pangolin, removes these headers when a
browser sends them itself. FileRun trusts the headers only in the requests that come from the
Trusted addresses of the source. See Security.
Requirements
- Badger at version
1.4.1or newer. Older versions do not send theRemote-User-Idheader, and FileRun refuses the sign-in without it. The version is in the Traefik configuration of Pangolin, underexperimental.plugins.badger.version. - A resource in Pangolin for the address of FileRun, with
Use Platform SSOturned on. - FileRun can be reached from the trusted addresses only through Pangolin.
Step 1: Set up the resource in Pangolin
- In Pangolin, add an HTTP resource for the address of FileRun.
- In the authentication settings of the resource, turn on
Use Platform SSO. - Choose the users and the roles that can open the resource. Pangolin decides who can reach FileRun.
Pangolin sends the user only after a sign-in with a Pangolin account. A resource can also accept a PIN, a password, an e-mail code or a shareable link. These methods send no user, and FileRun refuses the sign-in with "Pangolin did not send the user.".
Note
The sign-in of Pangolin works in a browser. The mobile apps, the desktop sync app and the WebDAV clients cannot use it. While the resource of FileRun requires the sign-in of Pangolin, these apps cannot reach FileRun through it. To use them, let their requests through in the rules of the resource in Pangolin. The apps then sign in with their own credentials, such as app passwords.
Step 2: Find the trusted address
The trusted address is the IP address from which Pangolin connects to FileRun, as the server of FileRun sees it:
- When Pangolin reaches FileRun through Newt, it is the address of Newt. When Newt runs in Docker, it is the address of its container, or the address of the Docker network that it uses.
- When Pangolin reaches FileRun without Newt, it is the address of the Traefik of Pangolin.
When you do not know the address, the test of the source shows it. Add the source in step 3 with any address, open FileRun through Pangolin, and run the test. See Step 4.
Step 3: Add the source in FileRun
Under Authentication sources, click Add, and select Pangolin in the Plugin list. Then fill in
the Pangolin plugin options:
Dashboard URL: required. The address of the Pangolin dashboard, such ashttps://pangolin.example.com. It is the value ofapp.dashboard_urlin the configuration file of Pangolin. The user accounts of FileRun are linked to the users of this Pangolin server.Trusted addresses: required. The addresses from which Pangolin connects to FileRun. Separate several addresses with commas. Each entry can have one of these forms:- one address, such as
172.18.0.5orfd00::5 - CIDR, such as
172.18.0.0/16orfd00::/64 - a range, such as
172.18.0.2-172.18.0.20 - a wildcard, for IPv4 only, such as
172.18.0.*
- one address, such as
Choose the Role of new user accounts, and click Save.
When the dashboard URL changes later, the accounts stay linked to the old address. Check
Move the N linked user accounts along if the issuer URL changes when you save the new address. See
When the provider moves to a new address.
Step 4: Test the source
Open FileRun through Pangolin, and sign in as the superuser. Save the source with the Enabled
checkbox selected, select it in the list of sources, and click Test. The request of the test goes
through Pangolin, in the same way as a sign-in. The test window shows:
- whether the request came from a trusted address. When it did not, add the address that the table
shows to the
Trusted addresses. - a table with the
Addressof the request, and the headersRemote-User,Remote-User-Id,Remote-Email,Remote-NameandRemote-Role - whether the request contains the user. When it does not, check
Use Platform SSOand the version of Badger. - the address that starts the sign-in through the source
Open this address in a private browser window, through Pangolin. Pangolin asks for its sign-in, and FileRun then signs you in.
Important
The superuser can always sign in with the local password. Keep
Allow local user accounts to log inenabled until you are sure the setup works, so that the other local user accounts can still sign in with their passwords.
Signing in
The sign-in page shows the button of the source, "Sign in with" followed by the name of the source. A click on the button signs the person in at once, because the person is already signed in to Pangolin.
At the first sign-in of a Pangolin user, FileRun creates the user account:
- The username is the value of
Remote-User. - The first name is the full name of
Remote-Name. The last name stays empty. - The e-mail address is the value of
Remote-Email. - The account is linked to the user ID of
Remote-User-Id.
After the first sign-in, FileRun finds the account by the user ID, not by the username. An account that has a password is not linked by its username. The rules are described in Linked accounts.
Signing out
Signing out of FileRun ends the FileRun session only. The Pangolin session continues, and the sign-in button signs the person in again. To end both sessions, sign out of Pangolin as well.
The FileRun session does not follow a change of the user in Pangolin. When another person signs in to Pangolin in the same browser, the FileRun session of the first person continues until it is signed out.
Security
FileRun trusts the headers in every request that comes from a trusted address. So only Pangolin may reach FileRun from these addresses.
Warning
A request that reaches FileRun from a trusted address without Badger can contain any user. Check these points:
- Do not add a TCP resource in Pangolin for the port of FileRun. A TCP resource does not go through Badger, so it keeps the headers that a client sends.
- Do not turn on
disableForwardAuthin the configuration of Badger. Badger then forwards the headers that a client sends.- When a web server or a proxy of your own runs in front of FileRun, FileRun sees the address of that proxy. Trust that address only when every request that reaches that proxy comes from Pangolin.
The Trusted addresses of the source are not the Trusted proxies of FileRun. A trusted proxy
reports the IP address of the visitor, and it does not have to remove the headers of a client. So
the source does not use the trusted proxies. Add the address of Newt to the Trusted proxies too,
so that the activity log shows the addresses of the visitors. See
Trusted proxies.