Skip to content

Commit 2ff8398

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/assessment/introduce-presentation-assessment
# Conflicts: # src/main/java/de/tum/cit/aet/artemis/course/domain/Course.java # src/main/java/de/tum/cit/aet/artemis/course/dto/CourseUpdateDTO.java # src/main/webapp/app/course/manage/update/course-update.component.ts # src/main/webapp/i18n/de/course.json # src/main/webapp/i18n/en/course.json # src/test/java/de/tum/cit/aet/artemis/core/util/CourseTestService.java
2 parents 752f8a2 + 9ef5bb5 commit 2ff8398

111 files changed

Lines changed: 5026 additions & 396 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-bean-instantiations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
MAX_STARTUP_DEPENDENCY_CHAIN_LENGTH: 10
2727
MAX_DEFERRED_CHAIN_LENGTH: 16
2828
MIN_INSTANTIATED_BEANS: 20
29-
MAX_INSTANTIATED_BEANS: 142
29+
MAX_INSTANTIATED_BEANS: 143
3030
MIN_DEFERRED_CHAIN_LENGTH: 1
3131

3232
steps:

docker/nginx/artemis-nginx.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ map $rate_limit_exempt $rate_limit_key {
3535

3636
# Rate limit for the login REST call, at most one request every two seconds
3737
limit_req_zone $rate_limit_key zone=loginlimit:10m rate=30r/m;
38+
# Rate limit for the login-options lookup that drives the identifier-first login form. The client calls it once per
39+
# login attempt, right before POST authenticate, so it gets the same budget as the login zone - but in a zone of its
40+
# own, so that consuming it does not halve the number of logins a shared campus address can perform.
41+
limit_req_zone $rate_limit_key zone=loginoptionslimit:10m rate=30r/m;
3842
# Rate limit for account recovery and registration (password reset init/finish, register).
3943
# Stricter than the login zone: these endpoints send mail and mutate credentials, and no
4044
# legitimate client calls them repeatedly.

docker/nginx/artemis-server.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ location /api/core/public/authenticate {
5959
limit_req zone=loginlimit burst=3 delay=2;
6060
}
6161

62+
# Login options lookup for the identifier-first login form. NOTE: this must match the real endpoint served by
63+
# PublicAccountResource (@RequestMapping("api/core/public/") + @GetMapping("login-options")). Bounded here as well as by
64+
# the application-level @LimitRequestsPerMinute bucket, so that a flood is dropped at the edge instead of reaching a
65+
# database lookup per request. The zone keys on $rate_limit_key, which maps to $binary_remote_addr (the real TCP peer,
66+
# which the application-level limiter cannot see directly) for every client except an exempted one, which maps to the
67+
# empty key that nginx does not account - see the geo/map blocks in artemis-nginx.conf.
68+
location /api/core/public/login-options {
69+
proxy_pass http://artemis/api/core/public/login-options;
70+
# Same shape as the login block above: the first 2 requests pass immediately, the third waits for a slot, the rest
71+
# are answered 429. A real client sends exactly one of these per login attempt.
72+
limit_req zone=loginoptionslimit burst=3 delay=2;
73+
}
74+
6275
# Account recovery and registration. These send mail and mutate credentials, and no legitimate client
6376
# calls them repeatedly, so they get the stricter zone. These limits key on $binary_remote_addr (the
6477
# real TCP peer) and so complement the application-level @LimitRequestsPerMinute buckets.

documentation/docs/admin/production-setup/multiple-artemis-instances.mdx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ Build agents can be added to and removed from the server cluster depending on th
542542
assessment of programming exercises. If desired, build agents can execute multiple build jobs concurrently. In this case, you need to make sure that the server node your build agents is running on has enough resources.
543543
We recommend at least 2 CPUs and 2 GB of RAM for each concurrently running build job.
544544

545-
Build agents do **not** require access to the Shared File System as the repositories used in the build jobs are cloned using HTTPS. Furthermore, as Build Agents do not handle client requests,
545+
Build agents do **not** require access to the Shared File System, because they clone the repositories used in the build jobs over the network: over SSH when
546+
`artemis.version-control.build-agent-use-ssh` is `true`, and otherwise over HTTPS. Furthermore, as Build Agents do not handle client requests,
546547
they should be left out from the [nginx configuration](#nginx-configuration).
547548

548549

@@ -588,19 +589,29 @@ You can make following adaptations to the `application-prod.yml`:
588589
589590
3. Furthermore, you will need some configuration related to version control and continuous integration.
590591
591-
Build agents require access to the VC server. Therefore, you need to add credentials so the build agent can access the repositories.
592-
These credentials are used to clone repositories via HTTPS. You must also add these credentials to the localvc nodes.
592+
Build agents require access to the VC server. How they authenticate for it is selected by
593+
`artemis.version-control.build-agent-use-ssh`, and the credentials below belong to only one of the two options:
594+
595+
- `true` (**recommended**): each agent generates an SSH key pair at startup and authenticates with it, so there is no
596+
shared credential to configure and `build-agent-git-username`/`build-agent-git-password` may be omitted entirely.
597+
- `false` (default, **deprecated**): the agents clone over HTTPS with the credentials below, which you must add to the
598+
build agents and to the localvc nodes alike.
599+
600+
The HTTPS credentials are therefore required only for that second configuration; the SSH setup is described after the
601+
example below.
593602

594603
```yaml
595604
artemis:
596605
version-control:
597606
url: <url-to-your-vc-server>
598607
default-branch: main # The branch that should be used as default branch for all newly created repositories. This does NOT have to be equal to the default branch of the VCS
599608
# Artemis admin credentials
600-
build-agent-git-username: buildjob_user # Replace with more secure credentials for production. Required for https access to localvc
601-
build-agent-git-password: buildjob_password # Replace with more secure credentials for production. Required for https access to localvc. You can otherwise use an ssh key
609+
build-agent-git-username: buildjob_user # Replace with more secure credentials for production. Required for https access to localvc, and ignored when build-agent-use-ssh is true
610+
build-agent-git-password: buildjob_password # Replace with more secure credentials for production. Required for https access to localvc, and ignored when build-agent-use-ssh is true
602611
```
603612

613+
The order matters when you switch an existing installation over. Set `artemis.version-control.build-agent-use-ssh: true` on the build agents first — localvc nodes accept a registered agent's key regardless of their own setting, so builds keep working, and you can move agents one at a time — and only afterwards on the localvc nodes, where it stops that credential pair from granting build agents read access to every repository. Doing it in the other order breaks every agent still cloning over HTTPS. See [Build Agent Authentication](/admin/production-setup/security#build-agent-authentication).
614+
604615
4. Configuration related to the execution of build jobs:
605616

606617
```yaml

documentation/docs/admin/production-setup/security.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ artemis:
1616
username: "artemis-admin"
1717
password: "artemis-admin"
1818
version-control:
19+
# Deprecated, and both may be omitted entirely when build-agent-use-ssh is true.
20+
# Prefer SSH keys for build agents, see "Build Agent Authentication" below.
1921
build-agent-git-username: "buildagent_user"
2022
build-agent-git-password: "buildagent_password"
2123
jhipster:
@@ -49,6 +51,8 @@ jhipster:
4951

5052
Under the `prod` profile, Artemis refuses to start when one of these properties still holds a value that is published in this repository: the JWT signing key, the internal admin password (this includes a password identical to the username), and the build-agent git password. The startup error names the property and how to supply a value.
5153

54+
The build-agent git password is exempt when `artemis.version-control.build-agent-use-ssh` is `true`, because the core nodes then stop granting that credential pair read access to every repository, which is the access this check exists to protect. The pair is not rejected everywhere: it still runs through ordinary Basic authentication afterwards, where it opens exactly what the named account may access - nothing at all for `buildjob_user`, which is not an Artemis account. The check runs on every startup, so it applies again on the first start after the property goes back to `false`.
55+
5256
The signing key is checked through both `jhipster.security.authentication.jwt.base64-secret` and the plain `jhipster.security.authentication.jwt.secret`, because either one can be the key that is actually used. It is also rejected when it is absent altogether, and when it decodes to fewer than 64 bytes, which is the minimum HS512 accepts. The comparison happens on the decoded key as well as on the configured spelling, so re-encoding a published value - different padding, an added line break - does not get past it. Generate a key with:
5357

5458
```bash
@@ -65,6 +69,41 @@ ARTEMIS_VERSIONCONTROL_BUILDAGENTGITPASSWORD="<a unique password, kept in sync w
6569

6670
Artemis also pins the restrictive rendering profile of the diagram renderer at startup, in every profile. If `PLANTUML_SECURITY_PROFILE` is set explicitly, it has to name either `SANDBOX` or `ALLOWLIST`; any other value is rejected. Artemis passes its diagram theme as inline content, so no Artemis feature depends on the other profiles.
6771

72+
### Build Agent Authentication
73+
74+
Build agents clone repositories from the core nodes in one of two ways, selected by `artemis.version-control.build-agent-use-ssh`:
75+
76+
- `false` (default, **deprecated**): the agents authenticate over HTTPS with `build-agent-git-username` and `build-agent-git-password`. A core node accepts that credential pair for read access to *every* repository, ahead of the rate limit, the repository authorization checks and the VCS access log. Treat it as a system-wide credential and give it the same care as the internal admin password.
77+
- `true` (**recommended**): each agent generates an SSH key pair at startup and publishes its public key to the core nodes, which authenticate agents by key. Core nodes then **stop honouring the build-agent shortcut**, so that credential pair no longer opens every repository. This also requires `ssh-template-clone-url` and `ssh-private-key-folder-path` on the agents.
78+
79+
<Callout variant={CalloutVariant.warning}>
80+
HTTPS authentication for build agents is deprecated. Configure new installations with
81+
`artemis.version-control.build-agent-use-ssh: true`, and move existing ones over in the order given below.
82+
83+
One static secret, shared by every build agent and every core node and usually written into several configuration
84+
files, opens every repository in the installation, and it does so ahead of the rate limit, the authorization checks
85+
and the access log, which makes a leak both unlimited and invisible. An SSH key is per agent, is generated at
86+
startup rather than configured, never leaves the agent that holds it, and reaches a core node only through an agent
87+
that has joined the cluster.
88+
89+
The default stays `false` for now because SSH mode still needs `ssh-template-clone-url` and
90+
`ssh-private-key-folder-path` to be set explicitly, and because Jenkins uses the same credential pair (see the
91+
rollout note below).
92+
</Callout>
93+
94+
The property does different things on the two node roles. On a build agent it selects the mechanism the agent uses. On a core node it controls only the build-agent shortcut over HTTPS: `true` stops that pair from granting repository-wide read. The pair is still processed as ordinary Basic credentials afterwards, which matters only if you pointed `build-agent-git-username` at a real Artemis account — that person then authenticates as themselves and gets exactly their own access, subject to the rate limit, the authorization checks and the access log. Core nodes always accept a registered build agent's public key, whatever the property says there, because a key is per-agent and only reaches a core node through a build agent that has joined the cluster — unlike the credential pair, it is not a shared secret worth switching off.
95+
96+
That asymmetry decides the order in which you roll the change out:
97+
98+
1. Set `build-agent-use-ssh: true` on the build agents, together with `ssh-template-clone-url` and `ssh-private-key-folder-path`, and restart them. They now clone by key, and the core nodes accept that immediately, so builds keep working while the core nodes are still on `false`. You can move agents one at a time.
99+
2. Once no agent clones over HTTPS any more, set the property on the core nodes and restart them. This is the step that closes the shortcut.
100+
101+
<Callout variant={CalloutVariant.warning}>
102+
Do not do it in the other order. A core node with `build-agent-use-ssh: true` no longer honours the build-agent shortcut, and `buildjob_user` is not a real account, so every agent still configured for HTTPS fails to clone from it — which is also what happens if you set the property on the core nodes while any agent is still on `false`.
103+
104+
Leave it at `false` when Jenkins is your CI backend. The [Jenkins with LocalVC](/admin/jenkins-localvc) setup has Jenkins clone over HTTPS with this same credential pair, and Jenkins is not an Artemis build agent, so it has no key to fall back to.
105+
</Callout>
106+
68107
### Database Credentials
69108

70109
The database services used by `docker/artemis-prod-postgres.yml` and `docker/artemis-prod-mysql.yml` extend the shared `docker/postgres.yml`/`docker/mysql.yml` service definitions, which default to `docker/postgres/default.env` and `docker/mysql/default.env` for local development and testing. Those default env files intentionally use no real authentication (Postgres `POSTGRES_HOST_AUTH_METHOD=trust`, MySQL `MYSQL_ALLOW_EMPTY_PASSWORD=yes` with an empty root password) so a fresh local setup works without any configuration.
@@ -241,12 +280,16 @@ artemis:
241280
enabled: true
242281
account-management-requests-per-minute: 5
243282
authentication-requests-per-minute: 30
283+
login-options-requests-per-minute: 30
244284
```
245285

246286
### Where It Is Enforced
247287

248288
- Registration
289+
- Account activation
249290
- Password reset (request reset link + actual password change)
291+
- Login options lookup (the identifier step of the login form, in its own bucket so that consuming it does not
292+
reduce the number of logins a shared address can perform)
250293
- Username/password login
251294
- WebAuthn authentication
252295
- Git over SSH and HTTP operations

0 commit comments

Comments
 (0)