Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/ops/README.md
diff options
context:
space:
mode:
authorLeitwolf2026-11-13 20:24:50 +0300
committerGitHub2026-11-13 20:24:50 +0300
commit1c063a41f3e3266f8bc3266886b4962ea26149f2 (patch)
tree5c8ac901cec9648721c98a58ed74163ee537ec95 /ops/README.md
parent271cfaab91fcef0cf6e88c2eb89e6d939354f677 (diff)
parent7739f3654683fb6f1051f3a07156637fab024997 (diff)
downloadprogmaweb-renovate/api-packages.tar.gz
Merge branch 'main' into renovate/api-packagesrenovate/api-packages
Diffstat (limited to 'ops/README.md')
-rw-r--r--ops/README.md52
1 files changed, 52 insertions, 0 deletions
diff --git a/ops/README.md b/ops/README.md
index 0457499..285b2ba 100644
--- a/ops/README.md
+++ b/ops/README.md
@@ -296,3 +296,55 @@ ssh root@91.151.88.130 'chown -R root:root /srv/maven && restorecon -R /srv/mave
```
Published versions are never changed. The certificate of `progmasoft.com` must name `maven.progmasoft.com`.
+
+## Git mirrors
+
+`git.progmasoft.com` shows read-only mirrors of the public repositories under development, such as
+`https://git.progmasoft.com/tazel`. GitHub stays where development happens: issues, pull requests and CI, and the source
+links of the sites. Private and archived repositories are not mirrored. The files are in `ops/git`:
+
+| File | Installed as |
+| --- | --- |
+| `cgitrc` | `/etc/cgitrc`: the repositories, their sections and descriptions, and the look |
+| `include/head.html`, `header.html`, `footer.html` | `/etc/cgit/progmasoft/`: the header and footer of progmasoft.com |
+| `static/progmasoft-git.css`, `static/icon.svg` | `/srv/git/www/static/`: the tokens and brand of `apps/web/app/globals.css` |
+| `repositories` | `/etc/git-mirror/repositories`: what is mirrored, one name per line |
+| `git-mirror.sh` | `/usr/local/libexec/git-mirror`, labelled `bin_t` |
+| `systemd/git-mirror.service`, `.timer` | `/etc/systemd/system/`: every ten minutes, as `gitmirror` |
+| `systemd/fcgiwrap@cgit.*.d/` | `/etc/systemd/system/`: cgit and git-http-backend as `cgit`, socket for `nginx` only |
+| `selinux/progmasoft_cgit.te` | the module `progmasoft_cgit` |
+| `nginx/git.conf` | `/etc/nginx/conf.d/git.conf` |
+
+Packages: `git-core`, and `cgit` and `fcgiwrap` from EPEL; `checkpolicy` builds the module.
+
+- **Mirrors.** `git-mirror` fetches only branches and tags from `https://github.com/Progmasoft/<name>.git` (never the
+ pull-request refs), prunes what GitHub removed, follows its default branch, and repacks into one pack with a bitmap
+ when something changed, so a clone starts sending at once. It needs no credentials. A new repository needs a line in
+ `repositories` and a `repo.url` block in `cgitrc`. git-http-backend serves only the mirrors `git-mirror` marks with
+ `git-daemon-export-ok`; a mirror taken off `repositories` loses the mark and is deleted on the next run, so a
+ repository that becomes private or archived stops being cloned within ten minutes.
+- **Read only.** Nginx answers 403 to `git-receive-pack` and to the dumb protocol; git-http-backend gets no user; the
+ mirrors belong to `gitmirror` and are read as `cgit`, trusted through `safe.directory` for that backend only.
+- **SELinux.** `/srv/git/mirrors` is `git_sys_content_t` and `/var/cache/cgit` `git_rw_content_t` (package default).
+ `/usr/bin/fcgiwrap` is `httpd_exec_t`, so fcgiwrap runs in `httpd_t` and Nginx may connect to it, and
+ `git-http-backend` is `git_script_exec_t` like cgit, so both move into `git_script_t`. systemd's sandboxing sets
+ NoNewPrivileges; the module `progmasoft_cgit` allows exactly that one move under it.
+
+ ```sh
+ semanage fcontext -a -t git_sys_content_t '/srv/git/mirrors(/.*)?'
+ semanage fcontext -a -t bin_t /usr/local/libexec/git-mirror
+ # /usr/sbin is an equivalence of /usr/bin, so semanage takes the /usr/bin spelling; restorecon on
+ # /usr/sbin/fcgiwrap then gives it httpd_exec_t (check with ls -Z).
+ semanage fcontext -a -t httpd_exec_t /usr/bin/fcgiwrap
+ semanage fcontext -a -t git_script_exec_t /usr/libexec/git-core/git-http-backend
+ restorecon -RF /srv/git /usr/local/libexec/git-mirror /usr/sbin/fcgiwrap /usr/libexec/git-core/git-http-backend
+ ```
+
+ `/srv/git/www/static` needs no rule of its own: the stock policy labels `/srv/*/www` `httpd_sys_content_t`.
+- **No Cloudflare proxy.** `git.progmasoft.com` is a DNS-only A record: through the proxy, a clone of a large repository
+ (catch3, about 25 MB) never reached the client, while the origin served it in under a minute. The address of the server
+ is public through `mail.progmasoft.com` anyway; Nginx limits requests and connections per address itself. The record
+ is in `cloudflarectl/config.progmasoft.json`.
+- **Look.** No README is rendered (cgit would include its HTML unfiltered) and no script runs: the content security
+ policy allows none, and Nginx removes the inline `onchange` handlers of cgit's menus, whose buttons do the same.
+- **Certificate.** The certificate of `progmasoft.com` names `git.progmasoft.com` (webroot, `--expand`).