Initial public release of ShellGleam

This commit is contained in:
MeghdadFadaee committed 2026-11-04 21:51:31 +03:30
commit f65d79fd7a
29 files changed
+3140

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
# Configuration
Live file: `/etc/server-status/config.json`. Validate with `server-status --check`;
preview with `sudo server-status --no-color`. Changes appear on the next login.
`config/default.json` lists every setting. For an alternate file use
`sudo ./setup.sh install --config /absolute/path/config.json`. A supplied file
overlays built-in defaults, rather than merging with existing settings. Unknown
keys and invalid types are rejected before installation. `--wizard` prompts for
a title, address, services and disks; remote wizard setup reads `/dev/tty`.
| Key | Default / accepted values |
| --- | --- |
| `title` | Empty: automatic uppercase short hostname |
| `address` | `auto`: first IPv4 from `hostname -I`; override for multiple interfaces |
| `width` | `72`; integer 52–120, interior columns |
| `color` | `true`; manual previews honor `NO_COLOR` |
| `ascii` | `false`; use plain ASCII borders, bars and symbols |
| `sections` | `["system", "runtime", "health"]`; reorder or omit |
| `services` | Nginx and Docker, optional; up to 16 `{unit,label,required}` objects |
| `disks` | `["/"]`; 1–8 absolute filesystem paths |
| `docker` | `true`; query the local Unix socket if CLI is installed |
| `command_timeout` | `1.0`; 0.1–2 seconds per concurrent subprocess |
| `memory_warning`, `memory_critical` | `75`, `90` percent |
| `disk_warning`, `disk_critical` | `75`, `90` percent |
| `load_warning`, `load_critical` | `0.7`, `1.0` load per CPU |
| `updates_max_age_hours` | `48`; age limit for Ubuntu update-notifier data |
| `footer` | Empty; optional message |
Resource thresholds, failed units, inactive installed services, required missing
services, unknown/stale updates and unhealthy containers affect the summary.
Checks still affect the summary when their display section is hidden.
Missing optional services are neutral. A systemd active state is not an
application readiness check; configure the actual unit for your workload.
Example database configuration:
```json
{
"title": "DATABASE",
"services": [
{"unit": "postgresql.service", "label": "PostgreSQL", "required": true},
{"unit": "ssh.service", "label": "SSH", "required": true}
],
"disks": ["/", "/var/lib/postgresql"],
"docker": false,
"disk_warning": 70,
"disk_critical": 85
}
```
The PostgreSQL umbrella service may be active when a cluster is down; select
its specific cluster unit if needed. Settings and rendered container names are
visible to login users. Do not place secrets in the configuration.
+81
View File
@@ -0,0 +1,81 @@
# Operations and implementation
## System-wide login
The installer writes a root-owned renderer at `/usr/local/bin/server-status`,
JSON settings at `/etc/server-status/config.json` and a bounded shell wrapper at
`/etc/update-motd.d/00-server-status`.
It replaces only the dynamic MOTD session-display entry in `/etc/pam.d/sshd`
and `/etc/pam.d/login` with optional `pam_exec.so stdout type=open_session`.
Every session receives independent output, avoiding the shared dynamic MOTD
cache race during concurrent logins. Authentication and authorization rules and
SSH daemon settings are unchanged. The second static MOTD entry remains intact;
`/etc/motd` is emptied with its original content backed up. No daemon restart is
needed. SSH's normal `Last login` line remains.
Standard executable MOTD scripts are renamed with `~server-status-disabled`.
The installer checks `run-parts --lsbsysinit --test /etc/update-motd.d` to ensure
only the managed hook remains selected. The tilde matters: ordinary run-parts
and PAM's LSB mode accept different filenames. Renaming in place preserves
relative symlinks and avoids changing a linked package-owned file's mode.
## Bounded probes
External probes run concurrently with configurable individual timeouts. The
wrapper adds a six-second overall timeout and one-second kill grace period.
It shows an unavailable notice on failure and returns success to PAM. Kernel
uninterruptible I/O cannot be forcibly timed out by normal userspace tools.
Python runs with `-I`, the command PATH is fixed, and text control characters
are removed. Only root should be able to modify installed code and settings.
Login does not access the network, run apt, or install dependencies. Package
updates come from Ubuntu's existing update-notifier cache; missing or old data
is unknown/stale. `/run/reboot-required` is an OS hint, not an independent audit.
Docker queries the local socket regardless of caller Docker context; containers
without healthchecks are not labeled healthy. A manual preview runs with the
caller's permissions and may show Docker unavailable without sudo.
## Backup, reinstall, uninstall
Original content, mode, ownership and symlink targets are recorded once per path
in `/var/lib/server-status/manifest.json`; the directory is root-only. Each
operation also snapshots its current touched files for exception rollback.
`flock` serializes installation changes; replacement writes are atomic per file.
Reinstall preserves current settings unless overrides are supplied. It also
disables new package MOTD hooks. After package upgrades, rerun setup if stock
messages or PAM display entries reappear.
Uninstall restores pre-install content, including both PAM files, and retains
backups. Save later manual edits you want to keep before uninstalling. File
replacement and exception rollback are not a multi-file power-loss transaction.
After SIGKILL or power loss, inspect the newest backup folder and manifest before
proceeding. VM snapshots provide a stronger recovery boundary.
## Troubleshooting
Check `server-status --check`, `sudo server-status`, `sudo sshd -T`, executable
hook permissions and the two PAM session-display entries. User MOTD opt-outs,
non-login shells, `su`/`sudo`, and SSH command/SFTP sessions do not necessarily
show a login message. Noninteractive SSH command output should remain clean.
Extra messages may come from `/etc/motd.d`, `/run/motd.d`, `/usr/lib/motd.d`, user
shell files or SSH `Banner`; those sources are not removed. Fixed-width Unicode
output depends on your terminal font. Select ASCII mode and a smaller width for
limited terminals.
## Remote bootstrap
GitHub Pages serves a generated Bash bootstrap and a versioned archive whose
SHA-256 is embedded in that script. Download and verification happen before
sudo and installation. The extractor rejects links, traversal paths and large
unexpected archives. The package is built from an explicit file allowlist;
local dotfiles, deployment notes, credentials and arbitrary files cannot enter
it by a recursive copy. Checksums detect mismatches and corruption, not a
compromised publisher. The website makes no requests to visitors' servers.
The verified source is retained in `/opt/shell-gleam` for future uninstall. Dry
runs execute from the temporary package without copying it into `/opt`.
Temporary downloads are removed on exit. For local integration tests only,
`SHELL_GLEAM_BASE_URL=http://127.0.0.1:PORT` can point to a local build.
+52
View File
@@ -0,0 +1,52 @@
# Website and release maintenance
ShellGleam is maintained in
[`meghdadfadaee/shell-gleam`](https://github.com/meghdadfadaee/shell-gleam).
- Website: `https://meghdadfadaee.github.io/shell-gleam/`
- Bootstrap: `https://meghdadfadaee.github.io/shell-gleam/setup.sh`
- License: MIT
## GitHub Pages
The **Pages** workflow tests the source, builds the static website and installer
package, and deploys `_site` from `main`. Repository Settings → Pages must use
**GitHub Actions** as the source. Run the workflow manually to redeploy the
current version without a source change.
Only the built `_site` directory is published. Do not enable branch publishing
from the repository root, where `setup.sh` is the local source installer.
## Build and inspect locally
```bash
python3 -m unittest discover -s tests -v
python3 scripts/build_site.py
python3 -m http.server 8000 --directory _site
```
The build creates a content-addressed payload, embedded-checksum bootstrap,
`release.json` and a checksum list under `_site/downloads`. The payload uses an
explicit source allowlist, normalized metadata and reproducible compression.
Public demo data is fictional and uses documentation-only IP addresses.
No live server deployment records or captured production outputs belong in
this repository. Sanitize screenshots and examples before committing them.
Use a GitHub no-reply commit email to keep your personal email private.
## Releases
Update `VERSION` and `CHANGELOG.md`, run tests, and push to `main` to redeploy.
Previously downloaded bootstrap scripts refer to their exact package; after a
later site deployment replaces that package, fetch a fresh bootstrap. A missing
old package fails safely rather than silently installing another version.
## Forks and custom domains
For another account or repository, update links in the README and `site/`.
The workflow passes its own account/repository URL to `scripts/build_site.py`.
For a custom domain, change the workflow's `SITE_URL` and the website's
`BASE_URL` in `site/app.js` together.
The landing page has no external fonts, analytics, trackers or runtime assets.
Its customization form only changes a local preview and generated command.