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
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
packages-and-images:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Build pinned tool image
run: docker build -f Dockerfile.build -t gatepost-build:current .
- name: Build, test and package
run: |
docker run --rm --security-opt seccomp=unconfined -v "$PWD:/src" -w /src gatepost-build:current sh -c '
cmake --preset release && cmake --build --preset release && ctest --preset release --output-on-failure &&
cmake --install build/release --prefix /tmp/gatepost-stage &&
cpack --config build/release/CPackConfig.cmake -G DEB -B build/packages'
- name: Build lab image
run: docker build -f lab/Dockerfile -t gatepost-venue:release .
- name: Generate package SBOM with Syft 1.55.0
run: |
docker run --rm -v "$PWD:/work" -w /work \
ghcr.io/anchore/syft:v1.55.0@sha256:4cc92b64ca74ffca4c94d4c8fcc01f217731375300be14d0b6eeb2e82eaa110a \
dir:build/packages -o spdx-json=/work/build/packages.spdx.json
- name: Scan build and lab images with Trivy 0.71.1
run: |
for image in gatepost-build:current gatepost-venue:release; do
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/work" \
ghcr.io/aquasecurity/trivy:0.71.1@sha256:53570e6911c2361ebe7995228088cf83a6b9b73e7f3cdca44bd8f8f425e80fa7 \
image --scanners vuln --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 "$image"
done
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: gatepost-debian-and-sbom
path: |
build/packages/*.deb
build/packages.spdx.json
if-no-files-found: error
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
English | [简体中文](CHANGELOG.zh-CN.md)

# Changelog

## Unreleased

### Fixed

- `lab/monitoring-check.sh` no longer fails with "a monitored gate has not installed its ticket list" when `GATEPOST_GRAFANA_ADMIN_PASSWORD` is unset. The wait for each gate's ticket list ran `docker compose exec` through `lab/monitoring.yaml`, which requires the password, before the check generated its temporary one; it now uses the venue compose file only.

## 1.0.0 - 2026-11-02

- Integrated local scanning, hub admission, offline journals and reports, and atomic ticket-list installation in one `gated` daemon.
- Verified Ed25519-signed event tickets on the gate before hub contact, with a per-gate HMAC on scans and offline reports.
- Moved TLS 1.3 mutual authentication into the C hub and gate clients; the gate certificate device ID must match its claimed ID. Hub-to-data-centre sync uses HTTPS with a client certificate.
- Reproduced the north-entrance PMTU fault and confirmed that a real gate installs the repaired list with a matching ETag and hash.
- Added a provisioned Venue entrance dashboard for scan traffic, rejections, p50/p95/p99 decision latency, gate heartbeats, seconds since ticket-list confirmation, and data-centre sync runs.
- Added separate Debian packages, hardened systemd units, release SBOM generation and pinned Trivy image scans. The build and lab images use digest-pinned third-party bases.

Synthetic tickets and lab-issued keys remain test fixtures. See [security policy](SECURITY.md), [package setup](docs/operations/packages.md), and [logging compatibility](docs/operations/logging.md).
20 changes: 20 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[English](CHANGELOG.md) | 简体中文

# 更新记录

## 未发布

### 修复

- 未设置 `GATEPOST_GRAFANA_ADMIN_PASSWORD` 时,`lab/monitoring-check.sh` 不再报"a monitored gate has not installed its ticket list"而失败。原来等待各闸机装好票单时,`docker compose exec` 带上了要求密码的 `lab/monitoring.yaml`,而检查要到这一步之后才生成临时密码;现在等待只用场馆的 compose 文件。

## 1.0.0 - 2026-11-02

- 在同一个 `gated` daemon 中整合本地扫描、hub 入场决定、离线日志和报告,以及票据列表的原子安装。
- 闸机在联系 hub 前验证 Ed25519 签名的 event 门票;扫描和离线报告使用每台闸机独立的 HMAC。
- 将 TLS 1.3 双向认证放入 C hub 与 gate 客户端;gate 证书设备 ID 必须与其声明的 ID 一致。hub 到数据中心的同步使用带客户端证书的 HTTPS。
- 重现北入口 PMTU 故障,并确认真实闸机在修复后安装了 ETag 和哈希匹配的新列表。
- 增加预配置的「Venue entrance」看板,展示扫描流量、拒绝情况、p50/p95/p99 决策延迟、闸机心跳、票单确认后经过的秒数,以及数据中心同步次数。
- 增加独立的 Debian 软件包、加固的 systemd 单元、发布 SBOM 及固定版本的 Trivy 镜像扫描。构建和实验镜像的第三方基础镜像均固定 digest。

合成票据和实验室签发的密钥仍只是测试数据。参见[安全策略](SECURITY.zh-CN.md)、[软件包配置](docs/operations/packages.zh-CN.md)和[日志兼容性](docs/operations/logging.zh-CN.md)。
33 changes: 32 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.28)
project(gatepost VERSION 0.3.0 LANGUAGES C)
project(gatepost VERSION 1.1.0 LANGUAGES C)
# CMake project(VERSION) accepts numeric components only.
set(PROJECT_VERSION "1.1.0-dev")
set(gatepost_VERSION "${PROJECT_VERSION}")
message(STATUS "Gatepost ${PROJECT_VERSION}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -288,3 +292,30 @@ add_test(NAME status_tls_workers COMMAND ${Python3_EXECUTABLE}
set_tests_properties(status_tls_workers PROPERTIES TIMEOUT 120)
set_tests_properties(gated_tls hub_tls device_tls second_hello tls_failure_reasons ticket_fetch_progress http_distribution ticket_reply_count offline_reports protocol_compat gate_list_version status_deadline status_tls_workers sync_metrics hub_season_reload hub_served_list hub_tickets_send_change monitoring_config dc_alerts
PROPERTIES RESOURCE_LOCK status_ports)

install(TARGETS gated RUNTIME DESTINATION usr/bin COMPONENT gate)
install(TARGETS gate-hub RUNTIME DESTINATION usr/bin COMPONENT hub)
install(PROGRAMS packaging/run-gated.sh DESTINATION usr/lib/gatepost RENAME run-gated COMPONENT gate)
install(PROGRAMS packaging/run-gate-hub.sh DESTINATION usr/lib/gatepost RENAME run-gate-hub COMPONENT hub)
install(FILES packaging/gated.service DESTINATION usr/lib/systemd/system COMPONENT gate)
install(FILES packaging/gate-hub.service DESTINATION usr/lib/systemd/system COMPONENT hub)
install(FILES config/gated.env.example DESTINATION etc/gatepost RENAME gated.env COMPONENT gate)
install(FILES config/gate-hub.env.example DESTINATION etc/gatepost RENAME gate-hub.env COMPONENT hub)
install(FILES config/hub.conf.example DESTINATION etc/gatepost RENAME hub.conf COMPONENT hub)

set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_CONTACT "Gatepost maintainers <security@elsworne.example>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gatepost venue admission services")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL gate hub)
set(CPACK_DEBIAN_GATE_PACKAGE_NAME gatepost-gated)
set(CPACK_DEBIAN_HUB_PACKAGE_NAME gatepost-gate-hub)
set(CPACK_DEBIAN_GATE_PACKAGE_DEPENDS "adduser, libc6, libcurl4, libssl3, libsodium23, libgpiod2, libsystemd0")
set(CPACK_DEBIAN_HUB_PACKAGE_DEPENDS "adduser, libc6, libcurl4, libssl3, libsodium23")
set(CPACK_DEBIAN_GATE_PACKAGE_CONTROL_EXTRA
"${CMAKE_SOURCE_DIR}/packaging/postinst;${CMAKE_SOURCE_DIR}/packaging/gate-control/conffiles")
set(CPACK_DEBIAN_HUB_PACKAGE_CONTROL_EXTRA
"${CMAKE_SOURCE_DIR}/packaging/postinst;${CMAKE_SOURCE_DIR}/packaging/hub-control/conffiles")
include(CPack)
10 changes: 7 additions & 3 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ FROM debian:12.12-slim@sha256:d5d3f9c23164ea16f31852f95bd5959aad1c5e854332fe00f7
ENV DEBIAN_FRONTEND=noninteractive
RUN rm -f /etc/apt/sources.list.d/debian.sources && \
printf 'deb [check-valid-until=no] %s bookworm main\n' \
'http://snapshot.debian.org/archive/debian/20260115T000000Z' \
'http://snapshot.debian.org/archive/debian/20261030T000000Z' \
> /etc/apt/sources.list && \
printf 'deb [check-valid-until=no] %s bookworm-security main\n' \
'http://snapshot.debian.org/archive/debian-security/20260115T000000Z' \
'http://snapshot.debian.org/archive/debian-security/20261030T000000Z' \
>> /etc/apt/sources.list && \
apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y --no-install-recommends \
apt-get -o Acquire::Check-Valid-Until=false update && \
apt-get install -y --no-install-recommends \
build-essential \
ninja-build \
clang \
Expand Down Expand Up @@ -38,3 +39,6 @@ RUN rm -f /etc/apt/sources.list.d/debian.sources && \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --break-system-packages --no-cache-dir cmake==3.31.10
WORKDIR /src
RUN apt-get -o Acquire::Check-Valid-Until=false update && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ English | [简体中文](README.zh-CN.md)

Gatepost is Elsworne's venue entry system. `gated` runs on a Linux gate device, reads barcodes and drives its lights and turnstile. It can use a local synthetic ticket list when the venue is offline. The venue hub will coordinate gates and distribute ticket lists. `libgate` owns the local ticket store.

The 1.0.0 release includes [offline ticket signatures](docs/security/ticket-signing.md), [device TLS](docs/adr/0019-authenticate-devices-with-mutual-tls.md), [two uplinks and NAT](docs/adr/0017-add-a-backup-exit.md), and the [north-entrance diagnosis](docs/adr/0020-keep-path-mtu-feedback-and-check-each-gate-list.md). Review [SECURITY.md](SECURITY.md) before deployment.

## Quick start

Install Docker. From the repository root, build the debug binaries and open the build container:
Expand Down Expand Up @@ -40,6 +42,8 @@ time=1775170804236133 level=WARN event=hub_link gate=north state=offline reason=
time=1775170804235739 level=INFO event=hub_link gate=south state=online
```

For device installation, build the separate Debian packages with CPack and configure the hardened systemd units as described in [packages and device setup](docs/operations/packages.md). The release workflow builds packages, emits a Syft SBOM, and scans build and lab images with Trivy. [Logging compatibility](docs/operations/logging.md) explains the journal and admission records.

Exit the container with `exit`. For lights and turnstile movement, use the team's separate `gatepost-sim` repository with the [simulator protocol](docs/device/simulator-protocol.md).

## Build and test
Expand Down
6 changes: 6 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

Gatepost 是 Elsworne 的场馆入场系统。闸机上的 Linux 设备运行 `gated`,读取条码,控制指示灯和转闸。场馆断网时,它仍能根据本地票单放行。场馆的 `hub` 将负责协调各台闸机并分发票单;`libgate` 管理本地票单。

1.0.0 版本包含[离线票据签名](docs/security/ticket-signing.zh-CN.md)、[设备 TLS](docs/adr/0019-authenticate-devices-with-mutual-tls.zh-CN.md)、[双上行与 NAT](docs/adr/0017-add-a-backup-exit.zh-CN.md)及[北入口诊断](docs/adr/0020-keep-path-mtu-feedback-and-check-each-gate-list.zh-CN.md)。部署前请阅读 [SECURITY.zh-CN.md](SECURITY.zh-CN.md)。

## 快速开始

安装 Docker。在仓库根目录编译调试版本,然后进入构建容器:
Expand Down Expand Up @@ -38,6 +40,10 @@ time=1775170804236133 level=WARN event=hub_link gate=north state=offline reason=
time=1775170804235739 level=INFO event=hub_link gate=south state=online
```

设备安装可按[软件包与设备配置](docs/operations/packages.zh-CN.md)使用 CPack 构建独立的 Debian 软件包,并配置加固的 systemd 单元。发布工作流构建软件包、生成 Syft SBOM,并用 Trivy 扫描构建和实验镜像。[日志兼容性](docs/operations/logging.zh-CN.md)说明 journal 和入场记录。

## 扫描器监督与 systemd

输入 `exit` 离开容器。要观察指示灯和转闸动作,可使用团队的独立仓库 `gatepost-sim`;通信格式见[模拟器协议](docs/device/simulator-protocol.zh-CN.md)。

## 构建与测试
Expand Down
19 changes: 19 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
English | [简体中文](SECURITY.zh-CN.md)

# Security policy

## Supported versions

Security fixes target the latest `1.0.x` release. Development versions are not deployment releases.

## Reporting

When this repository is published, use GitHub private vulnerability reporting for `codexary/gatepost`. Until then, contact the project owner through the agreed private channel. Do not publish exploit details, private keys, personal data or venue network addresses. We aim to acknowledge a report within two business days and coordinate disclosure after a fix is available.

## Deployment boundaries

The repository contains synthetic tickets and test-only key generation. Do not deploy `lab/tls/generated/`, `lab/tls/test-key.pem`, or keys generated for local tests. Keep the ticket-signing private key at the data centre. Provision public event keys, per-gate HMAC keys and device certificates through an authenticated channel.

A hub-connected production gate requires `GATEPOST_PUBLIC_KEYS`, `GATEPOST_EVENT_ID`, per-gate HMAC keys, CA trust, a client certificate and its private key. The hub checks the TLS peer certificate and device ID. The data-centre sync uses HTTPS with hub credentials. `gated-test` and `gate-hub-test` permit plaintext only for local integration tests and are not packaged. Standalone offline use without a hub retains an unsigned compatibility path; deploy a hub-connected configuration for ticket issuance checks.

The lab's UDP load generator is unauthenticated and is not an operational report channel. Configure deployment credentials and systemd access restrictions as in [package setup](docs/operations/packages.md). See [ticket signing](docs/security/ticket-signing.md), [device TLS](docs/adr/0019-authenticate-devices-with-mutual-tls.md), and the [certificate renewal runbook](docs/runbooks/renew-device-certificate.md).
19 changes: 19 additions & 0 deletions SECURITY.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[English](SECURITY.md) | 简体中文

# 安全策略

## 支持版本

安全修复面向最新的 `1.0.x` 版本。开发版本不是部署版本。

## 报告方式

仓库发布后,请使用 `codexary/gatepost` 的 GitHub 私密漏洞报告;在此之前通过约定的私密渠道联系项目负责人。不要公开利用细节、私钥、个人数据或场馆网络地址。我们计划在两个工作日内确认报告,并在修复可用后协调披露。

## 部署边界

仓库包含合成票据和仅供测试的密钥生成工具。不要部署 `lab/tls/generated/`、`lab/tls/test-key.pem` 或本地测试密钥。票据签名私钥留在数据中心。通过经过认证的渠道配置 event 公钥、每台闸机的 HMAC 密钥和设备证书。

连接 hub 的生产闸机必须配置 `GATEPOST_PUBLIC_KEYS`、`GATEPOST_EVENT_ID`、每台闸机的 HMAC 密钥、受信任 CA、客户端证书和私钥。hub 核对 TLS 对端证书与设备 ID。数据中心同步使用带 hub 凭据的 HTTPS。`gated-test` 和 `gate-hub-test` 仅在本地集成测试中允许明文,不包含在软件包中。无 hub 的独立离线使用保留未签名兼容路径;部署时应使用连接 hub 的配置核对票据签发。

实验室 UDP 压测工具没有认证,不是运营报告渠道。按[软件包配置](docs/operations/packages.zh-CN.md)配置部署凭据和 systemd 访问限制。另见[票据签名](docs/security/ticket-signing.zh-CN.md)、[设备 TLS](docs/adr/0019-authenticate-devices-with-mutual-tls.zh-CN.md)和[证书续期手册](docs/runbooks/renew-device-certificate.zh-CN.md)。
7 changes: 7 additions & 0 deletions config/gate-hub.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
GATEPOST_LISTEN_ALL=1
GATEPOST_HUB_CONFIG=/etc/gatepost/hub.conf
GATEPOST_REPORT_FILE=/var/lib/gatepost/reports.log
GATEPOST_TICKETS=/var/lib/gatepost/tickets.txt
GATEPOST_LISTEN_PORT=7000
GATEPOST_STATUS=1
GATEPOST_SYNC=1
9 changes: 9 additions & 0 deletions config/gated.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GATEPOST_ARP_INTERFACE=eth0
GATEPOST_GATE_ID=gate-1
GATEPOST_HUB=hub.example.invalid:7000
GATEPOST_TLS_SERVER_NAME=hub.example.invalid
GATEPOST_PUBLIC_KEYS=/etc/gatepost/ticket-public.keys
GATEPOST_EVENT_ID=replace-with-event-id
GATEPOST_SCANNER=tty:/dev/ttyACM0
GATEPOST_OUTPUTS=gpio:/dev/gpiochip0
GATEPOST_TICKETS=/var/lib/gatepost/tickets.txt
4 changes: 2 additions & 2 deletions config/hub.conf.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copy to /etc/gatepost/hub.conf and set paths for this host.
smtp_url=smtp://mail.venue.lan:587
smtp_ca=/etc/gatepost/mail-ca.pem
smtp_ca=/run/credentials/gate-hub.service/mail-ca.pem
smtp_from=alerts@elsworne.example
smtp_to=manager@elsworne.example
smtp_user=gatepost
smtp_password_file=/etc/gatepost/smtp-password
smtp_password_file=/run/credentials/gate-hub.service/smtp-password
state_file=/var/lib/gatepost/alerts.state
alert_after_seconds=10
# Optional: the watcher's heartbeat file; its mtime uses the hub's shared wall clock.
Expand Down
Loading
Loading