Skip to content

Document tproxy-keys and fix two installer umask bugs - #2

Merged
sandamond merged 1 commit into
masterfrom
installer-fixes-and-docs
Sep 2, 2026
Merged

Document tproxy-keys and fix two installer umask bugs#2
sandamond merged 1 commit into
masterfrom
installer-fixes-and-docs

Conversation

@sandamond

Copy link
Copy Markdown
Owner

Summary

  • Fixes two deploy/install.sh / deploy/install-mtproxy.sh bugs that make the reference installer fail outright on a clean Ubuntu 26.04 host, both traced to the script's own umask 077:
    • go test ./... inherits it, so a config-package test fixture written 0444 comes out 0400 and TestLoadAcceptsSystemdCredentialReadPermissions fails — the install aborts before anything is built. Fixed by running the suite under umask 022.
    • Official MTProxy's build inherits it too, so the installed binary comes out 0700 root:root; mtproxy.service execs it as the unprivileged mtproxy user and fails with status=203/EXEC. Fixed with chmod -R a+rX on the build output before install.
  • Adds keys-panel/README.md: what tproxy-keys does and why, install steps, CLI + web UI reference, security model, and known limitations (no per-key stats, no hot reload, single MTProxy backend).
  • Cross-links it from the main README.md's "Multiple secrets on one hostname" section.
  • install.sh now detects tproxy-keys's MTProxy drop-in and runs tproxy-keys sync after rewriting profiles.json, so a reinstall doesn't leave MTProxy's actual secret list stale relative to the freshly-reset profiles.json. This does not preserve extra keys across a reinstall — profiles.json still resets to a single default profile, that part of the installer's behavior is unchanged and already documented — it only keeps MTProxy consistent with whatever profiles.json ends up holding. The backup/restore steps for keeping a key set across a reinstall are in keys-panel/README.md.

Test plan

  • Both umask bugs reproduced and fixed against a real Ubuntu 26.04 host in a live session (not just reasoned about)
  • Re-verified on this exact merged tree, non-destructively (no live config touched): go test ./... fails with the documented error under umask 077, passes cleanly under umask 022
  • gofmt -l ., go vet ./..., and go build ./... clean for both the relay module and keys-panel/
  • bash -n on both changed shell scripts
  • Full live deploy/install.sh re-run against a deployed host with tproxy-keys installed — not done in this PR: the test server now has real, in-use family keys beyond default, and a live reinstall resets profiles.json to just default. Recommend running this once deliberately (with a profiles.json/meta.json backup per keys-panel/README.md) rather than as an incidental side effect of merging.

🤖 Generated with Claude Code

deploy/install.sh sets umask 077 for the whole script. Two consequences of
that only show up on a clean host, so the reference installer as written
does not actually complete there:

- go test ./... inherits umask 077, which makes a config-package test
  fixture written 0444 come out 0400. That makes
  TestLoadAcceptsSystemdCredentialReadPermissions fail (it depends on a
  fixture that is genuinely group/other-readable), aborting the install
  before anything is built. Run the suite under umask 022 instead.

- deploy/install-mtproxy.sh inherits the same umask when it builds
  official MTProxy, so the installed binary comes out 0700 root:root.
  mtproxy.service execs it as the unprivileged mtproxy user, which then
  can't read or run its own binary and fails with status=203/EXEC.
  chmod -R a+rX the build output before installing it.

Both are reproduced and fixed against a real Ubuntu 26.04 host in this
session; go test ./... is re-verified failing under 077 and passing under
022 on this exact tree as part of this change.

Also:
- keys-panel/README.md documents tproxy-keys end to end: why it exists,
  what `add`/`revoke`/`rotate` actually do, install steps, the CLI and
  web UI, the security model, and known limitations.
- Cross-links it from README.md's "Multiple secrets on one hostname"
  section, where hand-editing profiles.json is otherwise the only
  documented option.
- install.sh now detects tproxy-keys's MTProxy drop-in
  (/etc/systemd/system/mtproxy.service.d/secrets.conf) and, if present,
  runs `tproxy-keys sync` after profiles.json is rewritten. Without this,
  a reinstall resets profiles.json to a single default profile but
  leaves MTProxy's actual secret list (which tproxy-keys maintains
  separately) stale, so the two would disagree about which secrets are
  valid. This does not preserve keys added through the panel across a
  reinstall — profiles.json still gets reset, as documented — it only
  keeps MTProxy consistent with whatever profiles.json ends up holding.
  keys-panel/README.md spells out the backup/restore steps for keeping a
  key set across a reinstall.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sandamond
sandamond merged commit 3863982 into master Sep 2, 2026
@sandamond
sandamond deleted the installer-fixes-and-docs branch September 2, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant