Files
homelab/k8s-ng/apps/fdroidserver/README.md
T

64 lines
2.6 KiB
Markdown
Raw Normal View History

# F-Droid repository
Open `https://fdroid.hexor.cy/` to browse the apps and scan the QR code to
add the repository in F-Droid. The QR code includes the signing certificate
fingerprint. The public catalog is generated from the signed index at
`https://fdroid.hexor.cy/fdroid/repo/`. Gitea and GitHub Releases supply
the signed Android APKs. Every five minutes the publisher
checks the latest stable release and publishes a signed index when the inputs
change. Both the publisher and BusyBox HTTP server run on the node labelled
`kubernetes.io/hostname=master`. Data lives in `/data/k8s/fdroidserver`.
Traefik terminates TLS and routes requests to the read-only HTTP server.
## Set up the repository signing key once
Create a Bitwarden item named exactly `k8s/fdroidserver/secrets` in the vault
collection readable by the External Secrets bot. Add these **Hidden** custom fields:
| Field | Value |
| --- | --- |
| `keystorepass` | A generated 32-character alphanumeric password |
| `keystore-base64` | The entire PKCS#12 file, base64-encoded on one line |
In a private directory on a trusted machine with a JDK, generate the key and
enter the password from Bitwarden when prompted:
```sh
umask 077
keytool -genkeypair -storetype PKCS12 -keystore fdroid-repo.p12 \
-alias fdroidrepo -keyalg RSA -keysize 3072 -sigalg SHA256withRSA \
-validity 10000 -dname 'CN=F-Droid Repository'
```
On macOS, copy the field value directly to the clipboard:
```sh
openssl base64 -A -in fdroid-repo.p12 | pbcopy
```
Keep a protected backup of the keystore and its password. Clients identify
the repository by this key. To restore the exact file on macOS, copy the
`keystore-base64` field and run the following in a private directory:
```sh
umask 077
pbpaste | openssl base64 -d -A -out restored.p12
```
To get the SHA-256 fingerprint for sharing with
users, run `keytool -list -v -keystore fdroid-repo.p12 -alias fdroidrepo`.
The APK signing keys stay with the projects' release pipelines.
## Add an application
1. Add its GitHub or Gitea repository URL (with or without a trailing
`/releases`), Android package name and release signing certificate SHA-256 to
`sources.json`. Use `assetPattern` when a release contains multiple APK
variants. Obtain the fingerprint from a trusted release with
`apksigner verify --print-certs app.apk`.
2. Add `metadata/<packageName>.yml` and list it in the metadata ConfigMap
generator in `kustomization.yaml`. Set `AllowedAPKSigningKeys` to the same
fingerprint.
3. Publish a signed APK as a release asset. Increase the Android `versionCode`
for each new binary. Argo CD applies the configuration and the next
scheduled job picks up the release.