diff options
| author | Leitwolf11 | 2026-11-12 23:41:27 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-12 23:41:27 +0300 |
| commit | 83e0ad4586d90bf02c3a5bfeb1ab92fd90e51703 (patch) | |
| tree | 41c12c9a54223df2d681554679408307282319fd /ops/git/systemd/fcgiwrap@cgit.service.d | |
| parent | 80d46cbffc87da9bf2665935e563ab556c1a267d (diff) | |
| download | progmaweb-83e0ad4586d90bf02c3a5bfeb1ab92fd90e51703.tar.gz | |
Add read-only Git mirrors on git.progmasoft.com
git.progmasoft.com shows the public repositories under development
(tazel, tazelish, tazel.net, catch3, progmasoft-cpp, progmaweb, website)
as read-only mirrors with cgit, and serves clones over smart HTTP, such
as git clone https://git.progmasoft.com/tazel. GitHub stays where
development happens; private and archived repositories are not mirrored.
ops/git holds what runs on the server:
- cgitrc, the header, footer and stylesheet: the look of progmasoft.com
(its tokens, the four-tile brand with "Git" beside it, the dark
footer), light like its default, no scripts, no rendered READMEs.
- git-mirror.sh with git-mirror.service/.timer: every ten minutes, as
gitmirror, branches and tags only from GitHub, pruned, the default
branch followed, repacked with a bitmap when something changed.
- fcgiwrap@cgit drop-ins: cgit and git-http-backend run as cgit with
systemd sandboxing (no network, read-only system, exposure 0.7), on
a socket only nginx can open.
- selinux/progmasoft_cgit.te: fcgiwrap runs in httpd_t and the two
CGIs move into git_script_t; the module allows only that move under
the NoNewPrivileges that the sandboxing sets.
- nginx/git.conf: HSTS, a content security policy without scripts,
per-address request and connection limits, 403 for receive-pack and
the dumb protocol, buffered clones, and the inline handlers of cgit's
menus removed.
ops/README.md describes the files, the labels, and why the name is not
behind the Cloudflare proxy: through it a clone of catch3 never reached
the client.
Deployed and checked live: every page answers 200, unknown ones 404,
full clones of tazel, progmaweb and catch3 work, a push answers 403,
no SELinux denials, no console errors, no horizontal scroll at 390 px.
Diffstat (limited to 'ops/git/systemd/fcgiwrap@cgit.service.d')
| -rw-r--r-- | ops/git/systemd/fcgiwrap@cgit.service.d/hardening.conf | 37 | ||||
| -rw-r--r-- | ops/git/systemd/fcgiwrap@cgit.service.d/processes.conf | 8 |
2 files changed, 45 insertions, 0 deletions
diff --git a/ops/git/systemd/fcgiwrap@cgit.service.d/hardening.conf b/ops/git/systemd/fcgiwrap@cgit.service.d/hardening.conf new file mode 100644 index 0000000..5f5b94f --- /dev/null +++ b/ops/git/systemd/fcgiwrap@cgit.service.d/hardening.conf @@ -0,0 +1,37 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +# cgit and git-http-backend read the mirrors and write only the cache of cgit; they reach no +# network and keep no rights of their own. +# +# fcgiwrap runs in httpd_t (/usr/bin/fcgiwrap is httpd_exec_t), so Nginx may connect to it, and +# cgit and git-http-backend move into git_script_t; the module in ../selinux allows that move under +# NoNewPrivileges. +[Service] +NoNewPrivileges=yes +ProtectSystem=strict +ReadWritePaths=/var/cache/cgit +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +PrivateNetwork=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProcSubset=pid +RestrictAddressFamilies=AF_UNIX +RestrictNamespaces=yes +RestrictRealtime=yes +RestrictSUIDSGID=yes +LockPersonality=yes +MemoryDenyWriteExecute=yes +SystemCallArchitectures=native +SystemCallFilter=@system-service +SystemCallFilter=~@privileged @resources +CapabilityBoundingSet= +AmbientCapabilities= +UMask=0077 diff --git a/ops/git/systemd/fcgiwrap@cgit.service.d/processes.conf b/ops/git/systemd/fcgiwrap@cgit.service.d/processes.conf new file mode 100644 index 0000000..b818abb --- /dev/null +++ b/ops/git/systemd/fcgiwrap@cgit.service.d/processes.conf @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +# SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 + +# Four workers, so a long clone does not hold up the pages. Without -f, what cgit and +# git-http-backend write to stderr goes to the journal, not to the visitor. +[Service] +ExecStart= +ExecStart=/usr/sbin/fcgiwrap -c 4 |