Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for PAM and static deployment #21866

Merged
merged 7 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,18 @@ The following configuration set `Content-Type: application/vnd.android.package-a
This includes CSS files, images, JS files and web fonts.
Avatar images are dynamic resources and still served by Gitea.
The option can be just a different path, as in `/static`, or another domain, as in `https://cdn.example.com`.
Requests are then made as `%(ROOT_URL)s/static/css/index.css` and `https://cdn.example.com/css/index.css` respective.
Requests are then made as `%(ROOT_URL)s/static/asset/css/index.css` and `https://cdn.example.com/asset/css/index.css` respective.
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
The static files are located in the `public/` directory of the Gitea source repository.
Copy this directory to the `/static` location eg: `/var/www/static` and rename
it to `assets` eg:[^1]

```bash
cd /var/www
mkdir static
cp -a $GITEA_BUILD/public static
mv static/public static/assets
```

wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
Expand Down Expand Up @@ -406,6 +416,10 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `GRACEFUL_HAMMER_TIME`: **60s**: After a restart the parent process will stop accepting new connections and will allow requests to finish before stopping. Shutdown will be forced if it takes longer than this time.
- `STARTUP_TIMEOUT`: **0**: Shutsdown the server if startup takes longer than the provided time. On Windows setting this sends a waithint to the SVC host to tell the SVC host startup may take some time. Please note startup is determined by the opening of the listeners - HTTP/HTTPS/SSH. Indexers may take longer to startup and can have their own timeouts.

[^1]: Gitea's initial configuration form will not work correctly with
`STATIC_URL_PREFIX` enabled. Use this option only after successfully deploying
Gitea and initializing the database.

wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
## Database (`database`)

- `DB_TYPE`: **mysql**: The database type in use \[mysql, postgres, mssql, sqlite3\].
Expand Down
46 changes: 41 additions & 5 deletions docs/content/doc/features/authentication.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,47 @@ Uses the following fields:

## PAM (Pluggable Authentication Module)

To configure PAM, set the 'PAM Service Name' to a filename in `/etc/pam.d/`. To
work with normal Linux passwords, the user running Gitea must have read access
to `/etc/shadow`.

**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.
This procedure enables PAM authentication. Users may still be added to the
system manually using the user administration. PAM provides a mechanism to
automatically add users to the current database by testing them against PAM
authentication. To work with normal Linux passwords, the user running Gitea
must also have read access to `/etc/shadow` in order to check the validity of
the account when logging in using a public key.

**Note**: Once a user has been authenticated use of items such as SSH public
keys _may_ bypass the login check system. Therefore, if disabling a user, it
is recommended to manually disable the account in Gitea using the built-in user
manager as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Note**: Once a user has been authenticated use of items such as SSH public
keys _may_ bypass the login check system. Therefore, if disabling a user, it
is recommended to manually disable the account in Gitea using the built-in user
manager as well.
**Note**: If a user has added SSH public keys into Gitea, the use of these
keys _may_ bypass the login check system. Therefore, if you wish to disable a user who
authenticates with PAM, you _should_ also manually disable the account in Gitea using the
built-in user manager.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to state this because I really don't know and would just be assuming (and you know where that gets people), but I'm guessing that this is also the reason that the application needs read access to the user file /etc/shadow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no check performed against PAM when a user logs in with ssh - so if it is intended for them to be disabled admins will need to do this disabling manually.


1. Configure and prepare the installation.
- It is recommended that you create an administrative user.
- Deselecting automatic sign-up may also be desired.
1. Once the database has been initialized, log in as the newly created
administrative user.
1. Navigate to the user setting (icon in top-right corner), and select
`Site Administration` -> `Authentication Sources`, and select
`Add Authentication Source`.
1. Fill out the field as follows:
- `Authentication Type` : `PAM`
- `Name` : Any value should be valid here, use "System Authentication" if
you'd like.
- `PAM Service Name` : Select the appropriate file listed under `/etc/pam.d/`
that performs the authentication desired.[^1]
- `PAM Email Domain` : The e-mail suffix to append to user authentication.
For example, if the login system expects a user called `gituser`, and this
field is set to `mail.com`, then Gitea will expect the `user email` field
for an authenticated GIT instance to be `[email protected]`.[^2]

**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. PAM requires that
the necessary libpam dynamic library be available and the necessary PAM
development headers be accessible to the compiler.

[^1]: For example, using standard Linux log-in on Debian "Bullseye" use
`common-session-noninteractive` - this value may be valid for other flavors of
Debian including Ubuntu and Mint, consult your distribution's documentation.
[^2]: **This is a required field for PAM**. Be aware: In the above example, the
user will log into the Gitea web interface as `gituser` and not `[email protected]`

## SMTP (Simple Mail Transfer Protocol)

Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/usage/reverse-proxies.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ In case you already have a site, and you want Gitea to share the domain name, yo

Then you **MUST** set something like `[server] ROOT_URL = http://git.example.com/git/` correctly in your configuration.

Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`.
Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`, additionally `lbmethod_byrequests` is required if proxying to https.
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved

## Caddy

Expand Down