Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ See [UPGRADING.md](UPGRADING.md), "Sync v2 (membership sync)".
`deploy/`, `public/.htaccess` and `scripts/release.sh` no longer allow
it. The helper `membership_encrypt()` (only used by the export) is
removed.
- **Behaviour change**: the member list (`getusers.php`; the member-fee
page, the bank import, saving a member voucher) comes from the
membership system's `members.php` as JSON over its internal TLS listener
instead of the encrypted `adm_names.php` of the old membership system.
Settings in `sync-secrets.php`: `members_url` (https only),
`members_token` (sent as `Authorization: Bearer`) and `members_cafile`
(the only trust anchor); with `deploy/` the variables
`pgacc_members_url`, `pgacc_members_token` (64 hex characters, the same
as on the membership system) and `pgacc_members_cert` (written to
`/etc/pgacc/admidio-addons-tls.crt`), empty by default, so the member
list is off and those pages fail with "Mitgliederliste nicht
konfiguriert!". The fetch requires a verified certificate, no redirect,
HTTP 200 and a complete body of at most 4 MiB within 20 seconds that
matches its `Content-Length` (if sent: 1-18 digits), and
refuses the whole list if a row is malformed or a member id or uuid
appears twice (fail closed as before). The member list stores each
member's uuid; the member-fee page links profiles by `user_uuid`, the
ledger listing and the voucher form show the member id as text instead
of a link. `membership_decrypt()` is removed.
- With both directions on sync v2 nothing reads `$datakey` of
`constants.php` any more: `membership_cipher_params()` is removed, the
playbook of `deploy/` no longer writes a `$datakey` into a new
`constants.php`, and an existing `$datakey` line is ignored.

### Changed

Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ Core concepts:
- **Public reports**: annual report (Rechenschaftsbericht), transactions and
spendings pages, donation lists.
- **Import**: bank statement CSV import (BAWAG format).
- **Membership integration**: `getusers.php` fetches member names from the
membership system; `internal/mbapi.php` exports membership payments as
JSON on an internal TLS listener (off unless configured,
[deploy/README.md](deploy/README.md), "Membership system").
- **Membership integration** (sync v2, off unless configured):
`getusers.php` fetches the member list from the membership system as JSON
over its internal TLS listener with a token; `internal/mbapi.php` gives
the membership system the membership payments as JSON on pgacc's own
internal TLS listener. Settings in `sync-secrets.php`
([deploy/README.md](deploy/README.md), "Membership system").

## Requirements

- PHP 8.5 with the `pgsql` extension (`short_open_tag` is no longer needed). `mcrypt` is no longer needed: receipts and the membership
exchange use `phpseclib` (same ciphertext; used automatically if loaded).
- PHP 8.5 with the `pgsql` extension (`short_open_tag` is no longer needed). `mcrypt` is no longer needed: receipts use `phpseclib` (same ciphertext;
used automatically if loaded).
- PostgreSQL 18 with the `pgcrypto` extension (passwords use `crypt()`;
new passwords bcrypt, older MD5-crypt hashes still accepted).
- Composer, for `smalot/pdfparser` and `phpseclib/phpseclib`.
Expand Down Expand Up @@ -55,8 +57,7 @@ Provisioning a Debian 13 host and deploying releases with scripts:

```php
<?php
$datakey = 'CHANGE-ME'; // shared key for the membership system exchange
$key = 'CHANGE-ME'; // key for encrypting uploaded receipts
$key = 'CHANGE-ME'; // key for encrypting uploaded receipts
```

`$key` must have at least 16 characters and must not be the `CHANGE-ME`
Expand All @@ -67,6 +68,12 @@ Provisioning a Debian 13 host and deploying releases with scripts:
stay readable; `migrate-receipt-key.php` (command line only) re-encrypts
them, see the runbook in [UPGRADING.md](UPGRADING.md).

`$datakey` (the key of the old encrypted membership exports) is no
longer used; an existing one is ignored. The membership sync settings
(tokens, peers, URL and certificate of the membership system) go into
`sync-secrets.php` next to it, also never committed: see
[UPGRADING.md](UPGRADING.md), "Sync v2 (membership sync)".

3. Run `composer install`.
4. Make `files/` writable by the web server. It holds the receipt files and
must not be web-accessible.
Expand Down
51 changes: 51 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,57 @@ system that called it is shut down). Remove `/mbapi.php` from the allow list
of a web server configured by hand and from monitoring; the nginx site of
`deploy/` and `public/.htaccess` no longer allow it.

### Member list from the membership system (`getusers.php`)

**Behaviour change.** `getusers.php` (the member-fee page, the bank import,
saving a voucher with a member part) no longer fetches the encrypted
`adm_api/adm_names.php` of the old membership system (shut down). It fetches
the JSON member list of the membership system's `members.php` over its
internal TLS listener, with a token. Settings in `sync-secrets.php` (above):
`members_url` (https only), `members_token` and `members_cafile` (the
membership system's certificate, the only trust anchor); with `deploy/` the
inventory variables `pgacc_members_url`, `pgacc_members_token` and
`pgacc_members_cert`, see [deploy/README.md](deploy/README.md), "Member
list".

- Without them, or if `sync-secrets.php` does not load, the pages that need
the list stop with "Mitgliederliste nicht konfiguriert!" (fail closed, as
for any failed fetch).
- The fetch verifies the certificate and its name or address against
`members_cafile` only, sends `Authorization: Bearer <token>`, follows no
redirects, times out after 20 seconds and needs HTTP 200 with a complete
body of at most 4 MiB that matches its `Content-Length` header, if there
is one (1-18 digits; anything else fails). The list must be valid as a whole
(`[{"id": int, "uuid": string, "name": string, "lo": int|null, "paid": 0|1}]`,
exactly these fields, a positive id and a UUID per member, none twice);
otherwise "Daten von Mitgliederverwaltung ungültig!" and nothing is
loaded. Names are UTF-8 as sent (no more ISO-8859-15 conversion or
backslash unescaping). `lo` is mapped to the organizations as before (44
and unknown roles or none: 10).
- The member list now also holds each member's `uuid`. The member-fee page
links a member's profile by `user_uuid` (the membership system opens
profiles by uuid only); the ledger listing and the voucher form show the
member id as plain text instead of a link.

Rollout order: the membership system's listener must serve `members.php`
before `pgacc_members_url` (or `members_url`) is set. Check it from the
pgacc host with its certificate saved as `admidio-addons-tls.crt` (the
playbook writes `/etc/pgacc/admidio-addons-tls.crt` only once the URL is
set); it must print 200:

```sh
curl --cacert admidio-addons-tls.crt -H 'Authorization: Bearer <token>' \
https://192.0.2.20:8443/members.php -o /dev/null -w '%{http_code}\n'
```

### `$datakey` no longer used

With both directions on sync v2 nothing reads `$datakey` of `constants.php`
any more (it was the key of the encrypted exports). `constants.php` needs
only `$key`; an existing `$datakey` line is ignored and can stay or be
removed. The playbook of `deploy/` no longer writes one into a new
`constants.php`.

## Document root `public/` (deployment change)

This release changes how pgacc is deployed; it is meant for a major release.
Expand Down
6 changes: 1 addition & 5 deletions closed.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ function page_listing_line($line, $action = "edit")
if (listing_column_hidden($tabc++)) {
echo emptytag("td");
} else {
if ($make_csv) {
echo tag("td", $line["member"] == 't' ? $line["member_id"] : 'Nein');
} else {
echo tag_raw("td", $line["member"] == 't' ? '<a href="https://mitglieder.piratenpartei.at/adm_program/modules/profile/profile.php?user_id=' . $line["member_id"] . '">' . $line["member_id"] . '</a>' : 'Nein');
}
echo tag("td", $line["member"] == 't' ? $line["member_id"] : 'Nein');
}
if (listing_column_hidden($tabc++)) {
echo emptytag("td");
Expand Down
15 changes: 8 additions & 7 deletions compose.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ services:
working_dir: /app

# Local membership-system stub (tests/reference/membership/): getusers()
# fetches https://mitglieder.piratenpartei.at/adm_api/adm_names.php, which
# this alias resolves to inside the internal test network, so the import
# and member pages never reach the real service. Serves the synthetic,
# encrypted member list for tests/runtime/test-constants.php's $datakey over
# HTTPS with the synthetic certificate of the application image, whose test
# CA that image trusts (tests/php-runtime.Dockerfile). The image is built
# with the application service.
# fetches the members_url of tests/runtime/test-sync-secrets.php
# (https://mitglieder.piratenpartei.at/members.php), which this alias
# resolves to inside the internal test network, so the import and member
# pages never reach a real service. Serves the synthetic JSON member list
# for that file's members_token over HTTPS with the synthetic certificate
# of the application image, signed by the test CA that is the file's
# members_cafile (tests/php-runtime.Dockerfile). The image is built with
# the application service.
membership:
image: pgacc-test-application${PGACC_TEST_SUFFIX:-}
pull_policy: never
Expand Down
Loading
Loading