Skip to content

Commit 43aafc5

Browse files
authored
Improve documentation for PAM and static deployment (#21866)
## Changes proposed in [referenced issue 21845][1] - Expand PAM configuration description with working examples. - Clarify `STATIC_URL_PREFIX` use (include "assets" and only works after database has been initialized) - Add note for HTTPS proxy support VIA Apache. [1]: #21845
1 parent 32db625 commit 43aafc5

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,13 @@ The following configuration set `Content-Type: application/vnd.android.package-a
289289
This includes CSS files, images, JS files and web fonts.
290290
Avatar images are dynamic resources and still served by Gitea.
291291
The option can be just a different path, as in `/static`, or another domain, as in `https://cdn.example.com`.
292-
Requests are then made as `%(ROOT_URL)s/static/css/index.css` and `https://cdn.example.com/css/index.css` respective.
292+
Requests are then made as `%(ROOT_URL)s/static/assets/css/index.css` or `https://cdn.example.com/assets/css/index.css` respectively.
293293
The static files are located in the `public/` directory of the Gitea source repository.
294+
You can proxy the STATIC_URL_PREFIX requests to Gitea server to serve the static
295+
assets, or copy the manually built Gitea assets from `$GITEA_BUILD/public` to
296+
the assets location, eg: `/var/www/assets`, make sure `$STATIC_URL_PREFIX/assets/css/index.css`
297+
points to `/var/www/assets/css/index.css`.
298+
294299
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
295300
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
296301
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.

docs/content/doc/features/authentication.en-us.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,47 @@ Uses the following fields:
166166

167167
## PAM (Pluggable Authentication Module)
168168

169-
To configure PAM, set the 'PAM Service Name' to a filename in `/etc/pam.d/`. To
170-
work with normal Linux passwords, the user running Gitea must have read access
171-
to `/etc/shadow`.
172-
173-
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build), and the official binaries provided do not have this enabled.
169+
This procedure enables PAM authentication. Users may still be added to the
170+
system manually using the user administration. PAM provides a mechanism to
171+
automatically add users to the current database by testing them against PAM
172+
authentication. To work with normal Linux passwords, the user running Gitea
173+
must also have read access to `/etc/shadow` in order to check the validity of
174+
the account when logging in using a public key.
175+
176+
**Note**: If a user has added SSH public keys into Gitea, the use of these
177+
keys _may_ bypass the login check system. Therefore, if you wish to disable a user who
178+
authenticates with PAM, you _should_ also manually disable the account in Gitea using the
179+
built-in user manager.
180+
181+
1. Configure and prepare the installation.
182+
- It is recommended that you create an administrative user.
183+
- Deselecting automatic sign-up may also be desired.
184+
1. Once the database has been initialized, log in as the newly created
185+
administrative user.
186+
1. Navigate to the user setting (icon in top-right corner), and select
187+
`Site Administration` -> `Authentication Sources`, and select
188+
`Add Authentication Source`.
189+
1. Fill out the field as follows:
190+
- `Authentication Type` : `PAM`
191+
- `Name` : Any value should be valid here, use "System Authentication" if
192+
you'd like.
193+
- `PAM Service Name` : Select the appropriate file listed under `/etc/pam.d/`
194+
that performs the authentication desired.[^1]
195+
- `PAM Email Domain` : The e-mail suffix to append to user authentication.
196+
For example, if the login system expects a user called `gituser`, and this
197+
field is set to `mail.com`, then Gitea will expect the `user email` field
198+
for an authenticated GIT instance to be `[email protected]`.[^2]
199+
200+
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build),
201+
and the official binaries provided do not have this enabled. PAM requires that
202+
the necessary libpam dynamic library be available and the necessary PAM
203+
development headers be accessible to the compiler.
204+
205+
[^1]: For example, using standard Linux log-in on Debian "Bullseye" use
206+
`common-session-noninteractive` - this value may be valid for other flavors of
207+
Debian including Ubuntu and Mint, consult your distribution's documentation.
208+
[^2]: **This is a required field for PAM**. Be aware: In the above example, the
209+
user will log into the Gitea web interface as `gituser` and not `[email protected]`
174210

175211
## SMTP (Simple Mail Transfer Protocol)
176212

0 commit comments

Comments
 (0)