1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
Commit Graph

68 Commits

Author SHA1 Message Date
Kristian Klausen
8dfa7e8c3e
nginx: Add plumbing for enabling HTTP/3 conditionally
We want to roll out HTTP/3 slowly, so this adds the necessary plumbing
and makes it possible to enable it per host.

Instead of adding the conditional logic to each nginx template, the 443
listen config is moved out into a snippet which is managed by the nginx
role.

HTTP/3 uses QUIC which is built on UDP. UDP is connectionless and
therefore reuseport[1][2] must be used to ensure that UDP packets for
the same QUIC connection is directed to the same worker. reuseport can
only be enabled once, so a default_server is added to the
"inventory_hostname vhost" for SSL/QUIC (reuseport is only enabled for
the latter). ssl_reject_handshake[3] is enabled as that allows enabling
SSL/QUIC without specifying a certificate.

[1] https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
[2] https://lwn.net/Articles/542629/
[3] http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_reject_handshake

Ref #606
2024-08-17 21:53:32 +02:00
Kristian Klausen
4f872bae8b
Fix missing HSTS header for some URLs due to nginx "directive inheritance"[1]
F5/nginx has blogged about this[1] and it is also mentioned in nginx's
documentation[2]:
"There could be several add_header directives. These directives are
inherited from the previous configuration level if and only if there are
no add_header directives defined on the current level. "

The problem occurs when add_header is used in a child context like a
server{} or location{} block. It is solved by moving the HSTS header
into a snippet, which is now included before all add_header lines.

For now the HSTS header is the only global header, but in the future we
may need to add more global headers, like the Alt-Svc header[3] for
HTTP/3.

[1] https://www.f5.com/company/blog/nginx/avoiding-top-10-nginx-configuration-mistakes#directive-inheritance
[2] https://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header
[3] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc

Fix #608
2024-08-17 18:58:51 +02:00
Robin Candau
7b14027a45 Switch to http2 directive in nginx configs
> 2024/06/02 11:05:53 \[warn\] 30324#30324: the "listen ... http2" directive is deprecated, use the "http2" directive instead

Fixes https://gitlab.archlinux.org/archlinux/infrastructure/-/issues/589
2024-06-02 12:25:27 +00:00
Evangelos Foutras
a782c6953f
syncrepo: let mirrorsync perform the repo syncing
This role will still handle setting up nginx and rsyncd, due to specific
configuration requirements these services have.

We're also effectively relieving build.archlinux.org of rsyncd duties as
it is not something it should be doing anyway.
2022-11-12 20:22:08 +02:00
Evangelos Foutras
f9e239e85d
syncrepo: remove redundant CacheDir configuration
CacheDir, as configured by common's pacman.conf task, already includes
the local package mirror when available (on mirrors, gemini and build).
2022-11-06 20:53:34 +02:00
Evangelos Foutras
578b781966
Capitalize the handler name in handler invocations
Fixes: 26f289b72bfb ("Capitalize the first letter of all task names")
2022-08-29 21:46:39 +03:00
Evangelos Foutras
26f289b72b
Capitalize the first letter of all task names
ansible-lint 6.5.0 complains about:

  name: All names should start with an
        uppercase letter. (name[casing])
2022-08-23 06:57:13 +03:00
Evangelos Foutras
a9e0790f53
Remove the three dashes from all YAML documents
These are used to signal the start of the document in a stream of many
documents. As Ansible only supports one YAML document per file this is
unnecessary. About a third of our YAML documents already lacked these.
2022-06-08 14:35:45 +03:00
Evangelos Foutras
a48f4625b5
syncrepo: add X-Served-By header to geo mirrors
Potentially useful to quickly know which mirror we're talking to.
2022-04-16 16:07:59 +03:00
Kristian Klausen
9f65f99c6b
Add GeoIP domain for our sponsored mirros
We had a GeoIP mirror in the past based on nginx and its GeoIP module,
but it didn't perform very well, due to the high latency (asking a
central server for the package and then redirected to the closest
mirror).

One of the reasons for offering this service, is so we can relieve
mirror.pkgbuild.com which is burning a ton of traffic (50TB/month),
likely due to it being the default mirror in our Docker image. Another
reason is so we can offer a link to our arch-boxes images in libosinfo
(used by gnome-boxes, virt-install and virt-manager), with good enough
performance for most users.

This time we take a different approach and use a DNS based solution,
which means the latency penalty is only paid once (the first DNS
request). The downside is that the mirrors must have a valid certificate
for the same domain name, which makes using third-party mirrors a
challenge. So for now, we are just using the sponsored mirorrs
controlled by the DevOps team.

Fix #101
2022-04-13 03:10:09 +02:00
Kristian Klausen
4773f92c77 Sync debug packages to our sponsored mirrors[1]
The sponsored mirrors have a ton of storage, but mirror.pkgbuild.com
doesn't, so debug packages aren't synced to it.

[1] {america,asia,europe}.mirror.pkgbuild.com
2022-02-04 21:13:19 +00:00
Evangelos Foutras
4fe427a266
syncrepo: Drop --temp-dir option as unneeded
Using a temporary directory outside of /srv/ftp was meant to protect
against incomplete files from being synced by downstream mirrors. It
does not achieve this to much effect though; each file gets uploaded
to the temporary directory but then immediately moved under a .~tmp~
directory at its target location (.~tmp~ because of --delay-updates,
otherwise the file would be renamed to its final path).

The `--delay-updates` option by itself sufficiently protects against
temp files being transferred to downstream mirrors; when used by the
receiver, it automatically adds an exclude rule for ~.tmp~, behaving
exactly like we want it to. As such, the `--temp-dir` option doesn't
provide any further benefit and can be removed.
2021-07-29 11:02:56 +03:00
Evangelos Foutras
8c92967b51
syncrepo-template: Add note about .~tmp~ workaround
The workaround can be skipped/removed when using rsync newer than 3.2.3.
2021-07-29 01:27:15 +03:00
Evangelos Foutras
5704356cd2
syncrepo: Tweak rsync options
- Replace --delete-after with more efficient --delete-delay.
- Move "-p" together with the other short options.
- Remove reference to empty ${VERBOSE} variable.
2021-07-29 01:20:00 +03:00
Evangelos Foutras
8dad3e8562
Revert "syncrepo: Properly clean up .~tmp~ dirs"
This reverts commit 75f9ca3cc64df0653a4541be5e2334244fe24ca5.

This should be fixed in rsync versions newer than 3.2.3. In Arch the fix
has been shipped in the rsync 3.2.3-4 package, which our own mirrors now
have been updated to.

[1] https://github.com/WayneD/rsync/issues/192
2021-07-29 00:29:50 +03:00
Leonidas Spyropoulos
798a2d3d0d Syncarchive service depends and wants network
Closes #286

Signed-off-by: Leonidas Spyropoulos <artafinde@gmail.com>
2021-04-27 20:43:05 +00:00
Kristian Klausen
b70d04fa5c
Send the nginx logs to Loki
A extra access_log entry was added with the following commands:
$ cd roles
$ grep -lr access_log | xargs -P 1 -n 1 sed -i '/access_log/ s/\(.*\)\( \)\(\(reduced\|main\);$\)/\1 \3\n\1.json json_\3/'
2021-04-08 20:33:43 +02:00
Kristian Klausen
7129cfb698 dbscripts: Issue a certificate for rsync.archlinux.org 2021-03-25 18:43:06 +00:00
Jelle van der Waa
73bf287a81
Lock before deleting files
As reported in FS#69614 the lock should be before the delete for when
another sync job is running rsync can't move the files as they are
removed.
2021-02-16 22:57:26 +01:00
Kristian Klausen
4112bdf9fd Make ansible-lint happy
yaml: truthy value should be one of [false, true] (truthy)
yaml: wrong indentation: expected 4 but found 2 (indentation)
yaml: too few spaces before comment (comments)
yaml: missing starting space in comment (comments)
yaml: too many blank lines (1 > 0) (empty-lines)
yaml: too many spaces after colon (colons)
yaml: comment not indented like content (comments-indentation)
yaml: no new line character at the end of file (new-line-at-end-of-file)
load-failure: Failed to load or parse file
parser-error: couldn't resolve module/action 'hosts'. This often indicates a misspelling, missing collection, or incorrect module path.
2021-02-14 14:22:05 +01:00
Sven-Hendrik Haase
31ba1b2b7f
Stop excluding the iso dir on mirrors 2021-02-11 21:19:33 +01:00
Kristian Klausen
2d152700b6 Move certificate issuing to its own role to ease maintenance
It should make it easier to change how the certificates is issued.
Ex: If we want to switch to ECDSA certificates in the future or replace
certbot with something else.
2021-01-10 20:03:11 +01:00
Sven-Hendrik Haase
75f9ca3cc6 syncrepo: Properly clean up .~tmp~ dirs
We noticed that sometimes rsync becomes confused and leaves .~tmp~ dirs around which inhibits syncing from that point forward.
2020-11-30 00:44:55 +00:00
Sven-Hendrik Haase
d68771ea7a
Fix for ansible 2.10 (fixes #149) 2020-09-23 22:22:34 +02:00
Jakub Klinkovský
85814c031c Fix typos - lineinfile has 'owner', not 'user' parameter 2020-08-28 06:03:07 +00:00
Frederik Schwan
63887d3b09 fix E208 'File permissions not mentioned' 2020-08-27 05:29:00 +00:00
Frederik Schwan
a4a4f3e76c
fix E303 'Using command rather than module'
also use systemd instead of service module
2020-06-17 02:43:12 +02:00
Frederik Schwan
2b2bd06512
fix E206 'Variables should have spaces before and after: {{ var_name }}' 2020-06-12 22:20:48 +02:00
Florian Pritz
8b2f94a594
syncrepo: Add license
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-12-12 19:40:09 +01:00
Jelle van der Waa
fd2b6c6aab syncrepo: allow syncing links.tar.gz
Allow the synchronisation of the links database used by sogrep.
2019-10-15 21:42:20 +02:00
Jan Alexander Steffens (heftig)
c9b667dba7
syncrepo: Fix CacheDir whitespace 2019-09-05 20:50:34 +02:00
Jan Alexander Steffens (heftig)
7eda0eb8dd
nginx: Unify http and https servers
Where http does not redirect to https. These are package mirrors and
the web key directory.
2019-09-05 20:50:34 +02:00
Evangelos Foutras
6b0bbe5626 syncrepo: create nginx log dir iff mirror_domain is defined 2019-03-20 02:03:37 +02:00
Florian Pritz
f4d35d2ed6
syncrepo: Fix usage of undefined variable
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-16 15:36:44 +01:00
Florian Pritz
e9c89dcfdc
syncrepo: Fix comment not being a comment
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-16 15:26:35 +01:00
Florian Pritz
bdbc0a09a0
syncrepo: Add note regarding syncrepo-template.sh
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-14 17:45:37 +01:00
Florian Pritz
c549b6eff4
syncrepo: Merge curl location redirect follow change from template
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-14 17:43:16 +01:00
Florian Pritz
e7dbdbb0a7
syncrepo: Merge variable name changes from template
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-14 17:42:36 +01:00
Florian Pritz
718a83c971
syncrepo: Add template script for wiki
The script is currently hosted on my private server, but still linked in
the wiki[1]. This way, we can update the wiki to link to this copy of
the script as an official source.

[1] https://wiki.archlinux.org/index.php/DeveloperWiki:NewMirrors

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-14 17:41:15 +01:00
Florian Pritz
4ffd879fa1
syncrepo: Merge comments from "upstream"
Upstream being me:
https://git.server-speed.net/users/flo/bin/tree/syncrepo.sh

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2019-02-14 17:33:53 +01:00
Phillip Smith
8d681f0040 add "firewall" tag to all relevant tasks 2018-08-17 14:56:37 +10:00
Phillip Smith
1258e6b7d1 make all firewalld changes take effect immediately 2018-08-17 10:32:10 +10:00
Florian Pritz
9ba4f10eb7
Unify mirrorlist changes into template
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-06-25 15:05:58 +02:00
Florian Pritz
13078f8651
Enable cpu/memory accounting by default
The discovery script now uses a regex and no longer cares where exactly
accounting is enabled. Follow systemd upstream by enabling it by
default.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-06-25 14:50:58 +02:00
Florian Pritz
f5ee7a08f5
nginx: Reduce access log content for static data
For proxy/fastcgi/uwsgi blocks, logging is still set to the old format,
but for everything else (= static data) a reduced format is used that
excludes items that no longer make sense (request_time, remote_user) and
those that are personal information all the time (remote_addr, http_x_forwarded_for).

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-05-30 16:00:41 +02:00
Florian Pritz
b847916c61
Disable firewalld tasks
Disable firewall because python2 module is not avaible and the tasks
fail which makes the playbooks fail and leads to handlers not being run.

https://github.com/ansible/ansible/issues/24855

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-03-21 12:38:01 +01:00
Phillip Smith
59807399ed initial commit of firewalld role and tasks 2018-03-06 08:46:24 +11:00
Florian Pritz
b59d6b99df
Add cpu/memory accounting to many roles
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-02-28 19:50:32 +01:00
Florian Pritz
7411e9a2db
Tag nginx configs in roles as nginx
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-02-19 21:41:14 +01:00
Florian Pritz
6bf140146d
Define and use our own log format for nginx
This is the same as used on luna and as expected by the zabbix nginx
monitoring service.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-02-19 17:32:45 +01:00