Skip to content

Admin VPS console, health TLS, tips persistence, admin UI and deployment hardening - #78

Merged
gamblecodezcom merged 2 commits into
mainfrom
codex/configure-git-and-update-project-files-sln9gd
Feb 25, 2026
Merged

Admin VPS console, health TLS, tips persistence, admin UI and deployment hardening#78
gamblecodezcom merged 2 commits into
mainfrom
codex/configure-git-and-update-project-files-sln9gd

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 25, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Improve operational/admin tooling (lightweight VPS console, admin dashboard UX) and make runtime safer for production use.
  • Harden file I/O and health endpoint (HTTPS support + path validation) and add persistence/import/export for helpful group tips.
  • Bring repo metadata and ops docs in line with production usage (LICENSE, SECURITY, README updates) and remove obsolete Dockerfile.

Description

  • Introduces a lightweight SSHV admin console in index.js with per-admin session store, editor mode, safe command execution, confirmation for dangerous commands, session persistence (data/sshv-sessions.json), GC and RBAC via ADMIN_IDS.
  • Adds secure health server TLS support and internal health request logic (isHealthHttpsConfigured, requestHealthPayload), plus a more robust health server that can serve HTTPS when HTTPS_KEY_PATH/HTTPS_CERT_PATH are configured and validates certificate paths via validateSafePath/resolveTlsCertPathIfAllowed.
  • Adds path-safety helpers (validateSafePath), safer atomic writes (writeFileAtomic using safe paths), and switches several file reads/writes to use those helpers; moves webapp init-data validation to use WEBAPP_HMAC_KEY (added to .env.example) instead of the old static key behavior.
  • Enhances tips/helpful messages: persistence to data/helpful_messages.json, import/export JSON support for bulk add/overwrite via /tipadd and /tipedit, scheduler improvements to avoid immediate repeats and permission checks before posting, and admin CRUD UI for tips.
  • Improves admin UX: admin-mode visibility toggles (/on/off), persistent admin/user menus, ephemeral promo claim prompt that auto-deletes, and numerous callback/command renames and keyboard tweaks to streamline flows.
  • Deployment and ops improvements in prod-run.sh, runewager.service and deploy.sh: ensure runtime dirs/files exist, create service user when needed, set ownership/permissions, TLS-aware health checks, smarter health/port checks, enhanced systemd unit generation with restrictive sandboxing (ProtectSystem, NoNewPrivileges, ReadWritePaths), logrotate inclusion of admin-events log, and safer startup/backup behavior; removes the Dockerfile and adds LICENSE and SECURITY.md.
  • Rewrites and hardens scripts/self-diagnose.sh to produce a consistent snapshot report and various housekeeping changes (.gitignore, README Deployment section updates, added SECURITY.md, added LICENSE).

Testing

  • Performed a non-runtime smoke-load by running the module under CI mode (CI=true node index.js) to validate handler registration and that the file changes parse without syntax/runtime initialization (CI guard prevents full runtime start). This completed without fatal errors.
  • Ran the non-destructive diagnostic script (scripts/self-diagnose.sh) locally to validate the new snapshot output and checks.
  • No automated unit tests were added as part of this change; deployment scripts include runtime health checks exercised by prod-run.sh (health probe logic updated to support TLS).

Codex Task


CodeAnt-AI Description

Harden deployment, lock secrets, and produce a safer, clearer self-diagnose report

What Changed

  • Installer now creates data/backups, ensures runtime files exist, sets restrictive permissions on data, logs and .env, and chowns them to the service user when present
  • Deployment will create a system service user/group if missing and fall back to the current user, and the generated systemd unit runs with stricter sandboxing and UMask to reduce runtime privileges and exposure
  • Health and port checks became more robust: optional skip of TLS verification for health probes, multiple methods to detect listening ports, and clearer health/status reporting
  • Self-diagnose script was rewritten to be read-only, capture a consistent snapshot, group results, detect restarts during capture, and include network/Telegram/port checks and recent log lines in a structured report

Impact

✅ Fewer startup permission errors
✅ Clearer health and network diagnostics
✅ Safer secret file permissions and lower-privilege service runtime

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gamblecodezcom has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1d4e66e and c4fae3f.

📒 Files selected for processing (4)
  • deploy.sh
  • prod-run.sh
  • runewager.service
  • scripts/self-diagnose.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/configure-git-and-update-project-files-sln9gd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gamblecodezcom
gamblecodezcom merged commit 942e831 into main Feb 25, 2026
2 checks passed
@gamblecodezcom
gamblecodezcom deleted the codex/configure-git-and-update-project-files-sln9gd branch February 25, 2026 04:14
@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Feb 25, 2026
@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Aggressive process kill
    The health/heal sequence forcibly kills any process owning the configured port (uses lsof -ti :"$PORT" and kill -9). This can inadvertently terminate unrelated processes or system services; it also doesn't validate ownership or give graceful shutdown attempts.

  • Duplicate Logic
    The health / status reporting block that computes SYSTEMD_ACTIVE, HEALTH_URL, HEALTH_PORT, HEALTH_STATUS and PORT_STATUS is duplicated multiple times. This is a code-smell and increases maintenance burden — a change in one copy may be missed in others and could lead to inconsistent reports or flaky behavior.

  • Env parsing inconsistency
    The script reads Telegram/admin env values by grepping .env (e.g. ADMIN_IDS and TELEGRAM_BOT_TOKEN) rather than using the existing read_env_value helper. Also the repo elsewhere uses BOT_TOKEN — using TELEGRAM_BOT_TOKEN here introduces a naming mismatch and may prevent notifications from being sent.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant