Repository navigation
fix(gated): honor the configured hub TLS server name - #187
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
config/gated.env.exampledocumentsGATEPOST_TLS_SERVER_NAME, but nothing read it. Gates always checked the hub certificate against the fixed namehub.venue.lan, and the hub's TLS ticket listener only accepted that name in the Host header. A venue whose hub certificate carries another name could not use TLS, and the documented setting had no effect.What changed
libgate: shared DNS host-name validation (length 1–253, labels 1–63 of letters, digits and hyphens, no leading or trailing hyphen, no empty labels or trailing dot).gate-hub: readsGATEPOST_TLS_SERVER_NAME(defaulthub.venue.lan), refuses to start on an invalid value, and its TLS ticket listener accepts exactly<name>and<name>:8444. The plaintext listener'sGATEPOST_STATUS_HOSTSrules are unchanged.gated: reads the same setting with the same default and validation, and uses it for SNI, the certificate host check, the HTTPS ticket URL and the connect-to mapping.hub.venue.lan:8444and10.77.20.10:8444. Existing tests are unchanged.How to verify
In the build container, all four presets:
cmake --preset <p> && cmake --build --preset <p> && ctest --preset <p> --output-on-failurefordebug,release,asanandtsan: 67/67 tests passed in each.clang-format --dry-run -Werrorover C sources and headers: clean.背景
config/gated.env.example里写了GATEPOST_TLS_SERVER_NAME,但代码从不读取。闸机总是按固定名称hub.venue.lan核对 hub 证书,hub 的 TLS 取票端口也只接受这个名称作为 Host。hub 证书用别的名称时无法使用 TLS,文档里的这个设置也不起作用。改动
libgate:闸机和 hub 共用的 DNS 主机名校验(总长 1–253,每段 1–63 个字母、数字或连字符,不能以连字符开头或结尾,不能有空段或结尾的点)。gate-hub:读取GATEPOST_TLS_SERVER_NAME(默认hub.venue.lan),值不合法时拒绝启动;TLS 取票端口只接受<名称>和<名称>:8444。明文端口的GATEPOST_STATUS_HOSTS规则不变。gated:读取同一设置,默认值和校验相同,用于 SNI、证书主机名核对、HTTPS 取票地址和 connect-to 映射。hub.venue.lan:8444和10.77.20.10:8444的用例。原有测试不变。怎么验证
在构建容器里对
debug、release、asan、tsan四个预设分别执行cmake --preset <p> && cmake --build --preset <p> && ctest --preset <p> --output-on-failure:每个预设 67 个测试全部通过。对 C 源文件和头文件运行clang-format --dry-run -Werror:没有问题。