docs: update documentation for v4.0.0 release
- Rewrite README.md for Deno-based binary distribution - Update installation instructions for binary downloads - Document new subcommand CLI structure - Add troubleshooting, security, and development sections - Remove Node.js references, add Deno information - Add comprehensive v4.0.0 changelog entry - Document all breaking changes - List new features and technical improvements - Provide migration guide and command mapping - Include technical details and benefits - Create MIGRATION.md guide for v3.x to v4.0 upgrade - Step-by-step migration instructions - Configuration compatibility information - Troubleshooting common migration issues - Rollback procedures - Post-migration best practices
This commit is contained in:
563
readme.md
563
readme.md
@@ -1,6 +1,8 @@
|
||||
# NUPST - Node.js UPS Shutdown Tool
|
||||
# NUPST - Network UPS Shutdown Tool
|
||||
|
||||
NUPST is a command-line tool that monitors SNMP-enabled UPS devices and initiates system shutdown when power outages are detected and battery levels are low.
|
||||
NUPST is a lightweight, self-contained command-line tool that monitors SNMP-enabled UPS devices and initiates system shutdown when power outages are detected and battery levels are low.
|
||||
|
||||
**Version 4.0+** is powered by Deno and distributed as pre-compiled binaries requiring zero dependencies.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -8,52 +10,58 @@ NUPST is a command-line tool that monitors SNMP-enabled UPS devices and initiate
|
||||
- **Group Management**: Organize UPS devices into groups with different operating modes
|
||||
- **Redundant Mode**: Only shutdown when ALL UPS devices in a group are in critical condition
|
||||
- **Non-Redundant Mode**: Shutdown when ANY UPS device in a group is in critical condition
|
||||
- Monitors UPS devices using SNMP (v1, v2c, and v3 supported)
|
||||
- Automatic shutdown when battery level falls below threshold
|
||||
- Automatic shutdown when runtime remaining falls below threshold
|
||||
- Supports multiple UPS brands (CyberPower, APC, Eaton, TrippLite, Liebert/Vertiv)
|
||||
- Simple systemd service integration
|
||||
- Regular status logging for monitoring
|
||||
- Real-time log viewing with journalctl
|
||||
- Version checking and automatic updates
|
||||
- Self-contained - includes its own Node.js runtime
|
||||
- **SNMP Protocol Support**: Full support for SNMP v1, v2c, and v3 with authentication and encryption
|
||||
- **Multiple UPS Brands**: Works with CyberPower, APC, Eaton, TrippLite, Liebert/Vertiv, and custom OID configurations
|
||||
- **Systemd Integration**: Simple service installation and management
|
||||
- **Real-time Monitoring**: Live status updates and log viewing
|
||||
- **Zero Dependencies**: Single self-contained binary with no runtime requirements
|
||||
- **Cross-Platform**: Binaries available for Linux (x64, ARM64), macOS (Intel, Apple Silicon), and Windows
|
||||
|
||||
## Installation
|
||||
|
||||
### Quick Install (One-line command)
|
||||
### Quick Install (Recommended)
|
||||
|
||||
The easiest way to install NUPST is using the automated installer:
|
||||
|
||||
```bash
|
||||
# Method 1: Download and run (most reliable across all environments)
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh -o nupst-install.sh && sudo bash nupst-install.sh && rm nupst-install.sh
|
||||
# Download and run installer (most reliable)
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh -o nupst-install.sh
|
||||
sudo bash nupst-install.sh
|
||||
rm nupst-install.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
# Method 2: Pipe with automatic yes for dependencies (non-interactive)
|
||||
# One-line installation (non-interactive with auto-confirm)
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- -y
|
||||
```
|
||||
|
||||
```bash
|
||||
# Method 3: Process substitution (only on systems that support /dev/fd/)
|
||||
# Note: This may fail on some systems with "No such file or directory" errors
|
||||
sudo bash <(curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh)
|
||||
```
|
||||
The installer will:
|
||||
1. Auto-detect your platform (OS and architecture)
|
||||
2. Download the latest pre-compiled binary from releases
|
||||
3. Install to `/opt/nupst/nupst`
|
||||
4. Create a symlink in `/usr/local/bin/nupst` for global access
|
||||
|
||||
### Direct from Git
|
||||
### Manual Installation
|
||||
|
||||
Download the appropriate binary for your platform from the [releases page](https://code.foss.global/serve.zone/nupst/releases):
|
||||
|
||||
- **Linux x64**: `nupst-linux-x64`
|
||||
- **Linux ARM64**: `nupst-linux-arm64`
|
||||
- **macOS Intel**: `nupst-macos-x64`
|
||||
- **macOS Apple Silicon**: `nupst-macos-arm64`
|
||||
- **Windows x64**: `nupst-windows-x64.exe`
|
||||
|
||||
Then install manually:
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://code.foss.global/serve.zone/nupst.git
|
||||
cd nupst
|
||||
# Download binary (replace with your platform)
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/nupst-linux-x64 -o nupst
|
||||
|
||||
# Option 1: Quick install (requires root privileges)
|
||||
sudo ./install.sh
|
||||
# Make executable
|
||||
chmod +x nupst
|
||||
|
||||
# Option 1a: Quick install with auto-yes for dependencies
|
||||
sudo ./install.sh -y
|
||||
|
||||
# Option 2: Manual setup
|
||||
./setup.sh
|
||||
sudo ln -s $(pwd)/bin/nupst /usr/local/bin/nupst
|
||||
# Move to system path
|
||||
sudo mv nupst /usr/local/bin/nupst
|
||||
```
|
||||
|
||||
### Installation Options
|
||||
@@ -61,14 +69,20 @@ sudo ln -s $(pwd)/bin/nupst /usr/local/bin/nupst
|
||||
The installer script (`install.sh`) supports the following options:
|
||||
|
||||
```
|
||||
-y, --yes Automatically answer yes to all prompts (like installing git)
|
||||
-h, --help Show the help message
|
||||
-y, --yes Automatically answer yes to all prompts
|
||||
-h, --help Show help message
|
||||
--version VERSION Install specific version (e.g., --version v4.0.0)
|
||||
--install-dir DIR Custom installation directory (default: /opt/nupst)
|
||||
```
|
||||
|
||||
### From NPM
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
npm install -g @serve.zone/nupst
|
||||
# Install specific version
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- --version v4.0.0
|
||||
|
||||
# Custom installation directory
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- --install-dir /usr/local/nupst
|
||||
```
|
||||
|
||||
## System Changes
|
||||
@@ -79,99 +93,137 @@ When installed, NUPST makes the following changes to your system:
|
||||
|
||||
| Path | Description |
|
||||
|------|-------------|
|
||||
| `/opt/nupst/` | Main installation directory containing the NUPST files |
|
||||
| `/opt/nupst/nupst` | Pre-compiled binary (default location) |
|
||||
| `/etc/nupst/config.json` | Configuration file |
|
||||
| `/usr/local/bin/nupst` | Symlink to the NUPST executable |
|
||||
| `/usr/local/bin/nupst` | Symlink to the NUPST binary |
|
||||
| `/etc/systemd/system/nupst.service` | Systemd service file (when enabled) |
|
||||
|
||||
### Service Changes
|
||||
|
||||
- Creates and enables a systemd service called `nupst.service` (when enabled with `nupst enable`)
|
||||
- Creates and enables a systemd service called `nupst.service` (when enabled with `nupst service enable`)
|
||||
- The service runs with root permissions to allow system shutdown capabilities
|
||||
|
||||
### Network Access
|
||||
|
||||
- NUPST only communicates with your UPS device via SNMP (default port 161)
|
||||
- Brief connections to npmjs.org to check for updates
|
||||
- No external network connections required after installation
|
||||
|
||||
## Uninstallation
|
||||
|
||||
```bash
|
||||
# Using the CLI tool:
|
||||
sudo nupst uninstall
|
||||
# Disable and remove service first
|
||||
sudo nupst service disable
|
||||
|
||||
# If installed from git repository:
|
||||
cd /path/to/nupst
|
||||
# Remove binary and config
|
||||
sudo rm /usr/local/bin/nupst
|
||||
sudo rm /opt/nupst/nupst
|
||||
sudo rm -rf /etc/nupst/
|
||||
|
||||
# Or use the uninstall script if installed from git
|
||||
sudo ./uninstall.sh
|
||||
|
||||
# If installed from npm:
|
||||
npm uninstall -g @serve.zone/nupst
|
||||
```
|
||||
|
||||
The uninstaller will:
|
||||
- Stop and disable the systemd service (if installed)
|
||||
- Remove the systemd service file from `/etc/systemd/system/nupst.service`
|
||||
- Remove the symlink from `/usr/local/bin/nupst`
|
||||
- Optionally remove configuration files from `/etc/nupst/`
|
||||
- Remove the repository directory from `/opt/nupst/` (when using `nupst uninstall`)
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
NUPST - Node.js UPS Shutdown Tool
|
||||
### Command Structure (v4.0+)
|
||||
|
||||
Usage:
|
||||
nupst enable - Install and enable the systemd service (requires root)
|
||||
nupst disable - Stop and uninstall the systemd service (requires root)
|
||||
nupst daemon-start - Start the daemon process directly
|
||||
nupst logs - Show logs of the systemd service in real-time
|
||||
nupst stop - Stop the systemd service
|
||||
nupst start - Start the systemd service
|
||||
nupst status - Show status of the systemd service and UPS status
|
||||
NUPST v4.0 uses a subcommand structure for better organization:
|
||||
|
||||
```
|
||||
NUPST - Network UPS Shutdown Tool
|
||||
Version: 4.0.0
|
||||
|
||||
Usage: nupst <command> [subcommand] [options]
|
||||
|
||||
Service Management:
|
||||
nupst service enable - Install and enable the systemd service
|
||||
nupst service disable - Stop and disable the systemd service
|
||||
nupst service start - Start the systemd service
|
||||
nupst service stop - Stop the systemd service
|
||||
nupst service restart - Restart the systemd service
|
||||
nupst service status - Show service and UPS status
|
||||
nupst service logs - Show service logs in real-time
|
||||
nupst service start-daemon - Start daemon directly (for testing)
|
||||
|
||||
UPS Management:
|
||||
nupst add - Add a new UPS device
|
||||
nupst edit [id] - Edit an existing UPS (default UPS if no ID provided)
|
||||
nupst delete <id> - Delete a UPS by ID
|
||||
nupst list - List all configured UPS devices
|
||||
nupst setup - Alias for 'nupst edit' (backward compatibility)
|
||||
|
||||
Group Management:
|
||||
nupst group list - List all UPS groups
|
||||
nupst group add - Add a new UPS group
|
||||
nupst group edit <id> - Edit an existing UPS group
|
||||
nupst group delete <id> - Delete a UPS group
|
||||
|
||||
System Commands:
|
||||
nupst test - Test the current configuration by connecting to all UPS devices
|
||||
nupst config - Display the current configuration
|
||||
nupst update - Update NUPST from repository and refresh systemd service (requires root)
|
||||
nupst uninstall - Completely uninstall NUPST from the system (requires root)
|
||||
nupst help - Show this help message
|
||||
nupst ups add - Add a new UPS device
|
||||
nupst ups edit [id] - Edit a UPS device (prompts if no ID)
|
||||
nupst ups remove <id> - Remove a UPS device by ID
|
||||
nupst ups list - List all configured UPS devices
|
||||
nupst ups test - Test UPS connections
|
||||
|
||||
Options:
|
||||
--debug, -d - Enable debug mode for detailed SNMP logging
|
||||
(Example: nupst test --debug)
|
||||
Group Management:
|
||||
nupst group add - Add a new UPS group
|
||||
nupst group edit <id> - Edit a UPS group
|
||||
nupst group remove <id> - Remove a UPS group
|
||||
nupst group list - List all UPS groups
|
||||
|
||||
Configuration:
|
||||
nupst config show - Display current configuration
|
||||
|
||||
Global Options:
|
||||
--version, -v - Show version information
|
||||
--help, -h - Show help message
|
||||
--debug, -d - Enable debug mode for detailed logging
|
||||
|
||||
Aliases (for backward compatibility):
|
||||
nupst ls - Alias for 'nupst ups list'
|
||||
nupst rm <id> - Alias for 'nupst ups remove'
|
||||
```
|
||||
|
||||
### Quick Start Guide
|
||||
|
||||
1. **Install NUPST** (see Installation section above)
|
||||
|
||||
2. **Add your first UPS device:**
|
||||
```bash
|
||||
sudo nupst ups add
|
||||
```
|
||||
Follow the interactive prompts to configure your UPS.
|
||||
|
||||
3. **Test the configuration:**
|
||||
```bash
|
||||
nupst ups test
|
||||
```
|
||||
|
||||
4. **Enable the service:**
|
||||
```bash
|
||||
sudo nupst service enable
|
||||
sudo nupst service start
|
||||
```
|
||||
|
||||
5. **Check status:**
|
||||
```bash
|
||||
nupst service status
|
||||
```
|
||||
|
||||
6. **View logs:**
|
||||
```bash
|
||||
nupst service logs
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
NUPST supports monitoring multiple UPS devices organized into groups. You can set up your UPS devices using the interactive commands:
|
||||
NUPST supports monitoring multiple UPS devices organized into groups. The configuration file is located at `/etc/nupst/config.json`.
|
||||
|
||||
### Interactive Configuration
|
||||
|
||||
The easiest way to configure NUPST is through the interactive commands:
|
||||
|
||||
```bash
|
||||
# Add a new UPS device
|
||||
nupst add
|
||||
sudo nupst ups add
|
||||
|
||||
# Create a new group
|
||||
nupst group add
|
||||
# Create a group
|
||||
sudo nupst group add
|
||||
|
||||
# Assign UPS devices to groups
|
||||
nupst group edit <group-id>
|
||||
sudo nupst group edit <group-id>
|
||||
```
|
||||
|
||||
### Configuration File Structure
|
||||
|
||||
The configuration file is located at `/etc/nupst/config.json`. Here's an example of a multi-UPS configuration:
|
||||
Here's an example configuration with multiple UPS devices in a redundant group:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -217,7 +269,7 @@ The configuration file is located at `/etc/nupst/config.json`. Here's an example
|
||||
"id": "datacenter",
|
||||
"name": "Data Center",
|
||||
"mode": "redundant",
|
||||
"description": "Main data center UPS group"
|
||||
"description": "Main data center UPS group with redundant power"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -225,141 +277,274 @@ The configuration file is located at `/etc/nupst/config.json`. Here's an example
|
||||
|
||||
### Configuration Fields
|
||||
|
||||
#### Global Settings
|
||||
|
||||
- `checkInterval`: How often to check UPS status in milliseconds (default: 30000)
|
||||
- `upsDevices`: Array of UPS device configurations
|
||||
- `id`: Unique identifier for the UPS
|
||||
- `name`: Friendly name for the UPS
|
||||
- `snmp`: SNMP connection settings
|
||||
- `host`: IP address of your UPS (default: 127.0.0.1)
|
||||
- `port`: SNMP port (default: 161)
|
||||
- `version`: SNMP version (1, 2, or 3)
|
||||
- `timeout`: Timeout in milliseconds (default: 5000)
|
||||
- `upsModel`: The UPS model ('cyberpower', 'apc', 'eaton', 'tripplite', 'liebert', or 'custom')
|
||||
- For SNMPv1/v2c:
|
||||
- `community`: SNMP community string (default: public)
|
||||
- For SNMPv3:
|
||||
- `securityLevel`: Security level ('noAuthNoPriv', 'authNoPriv', or 'authPriv')
|
||||
- `username`: SNMPv3 username
|
||||
- `authProtocol`: Authentication protocol ('MD5' or 'SHA')
|
||||
- `authKey`: Authentication password/key
|
||||
- `privProtocol`: Privacy/encryption protocol ('DES' or 'AES')
|
||||
- `privKey`: Privacy password/key
|
||||
- For custom UPS models:
|
||||
- `customOIDs`: Object containing custom OIDs for your UPS:
|
||||
- `POWER_STATUS`: OID for power status
|
||||
- `BATTERY_CAPACITY`: OID for battery capacity percentage
|
||||
- `BATTERY_RUNTIME`: OID for runtime remaining in minutes
|
||||
- `thresholds`: When to trigger shutdown
|
||||
- `battery`: Battery percentage threshold (default: 60%)
|
||||
- `runtime`: Runtime minutes threshold (default: 20 minutes)
|
||||
- `groups`: Array of group IDs this UPS belongs to
|
||||
- `groups`: Array of group configurations
|
||||
- `id`: Unique identifier for the group
|
||||
- `name`: Friendly name for the group
|
||||
- `mode`: Group operating mode ('redundant' or 'nonRedundant')
|
||||
- `description`: Optional description of the group
|
||||
|
||||
#### UPS Device Settings
|
||||
|
||||
- `id`: Unique identifier for the UPS
|
||||
- `name`: Friendly name for the UPS
|
||||
- `groups`: Array of group IDs this UPS belongs to
|
||||
|
||||
**SNMP Configuration:**
|
||||
- `host`: IP address or hostname of your UPS
|
||||
- `port`: SNMP port (default: 161)
|
||||
- `version`: SNMP version (1, 2, or 3)
|
||||
- `timeout`: Timeout in milliseconds (default: 5000)
|
||||
- `upsModel`: UPS brand ('cyberpower', 'apc', 'eaton', 'tripplite', 'liebert', or 'custom')
|
||||
|
||||
**For SNMPv1/v2c:**
|
||||
- `community`: SNMP community string (default: "public")
|
||||
|
||||
**For SNMPv3:**
|
||||
- `securityLevel`: 'noAuthNoPriv', 'authNoPriv', or 'authPriv'
|
||||
- `username`: SNMPv3 username
|
||||
- `authProtocol`: 'MD5' or 'SHA'
|
||||
- `authKey`: Authentication password
|
||||
- `privProtocol`: 'DES' or 'AES' (for authPriv level)
|
||||
- `privKey`: Privacy/encryption password
|
||||
|
||||
**For Custom UPS Models:**
|
||||
- `customOIDs`: Custom OID mappings
|
||||
- `POWER_STATUS`: OID for AC power status
|
||||
- `BATTERY_CAPACITY`: OID for battery percentage
|
||||
- `BATTERY_RUNTIME`: OID for runtime remaining (minutes)
|
||||
|
||||
**Shutdown Thresholds:**
|
||||
- `battery`: Battery percentage threshold (default: 60%)
|
||||
- `runtime`: Runtime minutes threshold (default: 20 minutes)
|
||||
|
||||
#### Group Settings
|
||||
|
||||
- `id`: Unique identifier for the group
|
||||
- `name`: Friendly name for the group
|
||||
- `mode`: Operating mode ('redundant' or 'nonRedundant')
|
||||
- `description`: Optional description
|
||||
|
||||
### Group Modes
|
||||
|
||||
- **Redundant Mode**: The system will only initiate shutdown if ALL UPS devices in the group are in critical condition (below threshold). This is ideal for redundant power setups where one UPS can keep systems running.
|
||||
|
||||
- **Non-Redundant Mode**: The system will initiate shutdown if ANY UPS device in the group is in critical condition. This is useful for scenarios where all UPS devices must be operational for the system to function properly.
|
||||
- **Redundant Mode**: System shuts down only when ALL UPS devices in the group are critical. Ideal for setups with backup UPS units where one can maintain power.
|
||||
|
||||
- **Non-Redundant Mode**: System shuts down when ANY UPS device in the group is critical. Used when all UPS devices must be operational for system stability.
|
||||
|
||||
## Setup as a Service
|
||||
|
||||
To set up NUPST as a systemd service:
|
||||
Enable NUPST as a systemd service for automatic monitoring:
|
||||
|
||||
```bash
|
||||
sudo nupst enable
|
||||
sudo nupst start
|
||||
```
|
||||
# Enable and start service
|
||||
sudo nupst service enable
|
||||
sudo nupst service start
|
||||
|
||||
To check the status:
|
||||
# Check status
|
||||
nupst service status
|
||||
|
||||
```bash
|
||||
nupst status
|
||||
```
|
||||
# View real-time logs
|
||||
nupst service logs
|
||||
|
||||
To view logs in real-time:
|
||||
# Stop service
|
||||
sudo nupst service stop
|
||||
|
||||
```bash
|
||||
nupst logs
|
||||
# Disable service
|
||||
sudo nupst service disable
|
||||
```
|
||||
|
||||
## Updating NUPST
|
||||
|
||||
NUPST checks for updates automatically and will notify you when an update is available. To update to the latest version:
|
||||
### Automatic Update
|
||||
|
||||
Re-run the installer to update to the latest version:
|
||||
|
||||
```bash
|
||||
sudo nupst update
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- -y
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Pull the latest changes from the git repository
|
||||
2. Run the installation scripts
|
||||
3. Force-update Node.js and all dependencies, even if they already exist
|
||||
4. Refresh the systemd service configuration
|
||||
5. Restart the service if it was running
|
||||
The installer will:
|
||||
1. Download the latest binary
|
||||
2. Replace the existing installation
|
||||
3. Preserve your configuration at `/etc/nupst/config.json`
|
||||
4. Restart the service if it was running
|
||||
|
||||
You can also manually run the setup script with the force flag to update Node.js and dependencies without updating the application code:
|
||||
### Manual Update
|
||||
|
||||
1. Download the latest binary from [releases](https://code.foss.global/serve.zone/nupst/releases)
|
||||
2. Replace the existing binary:
|
||||
```bash
|
||||
sudo nupst service stop
|
||||
sudo mv nupst-linux-x64 /opt/nupst/nupst # adjust for your platform
|
||||
sudo chmod +x /opt/nupst/nupst
|
||||
sudo nupst service start
|
||||
```
|
||||
|
||||
### Version Checking
|
||||
|
||||
Check your current version:
|
||||
|
||||
```bash
|
||||
# If you're in the nupst directory:
|
||||
bash ./setup.sh --force
|
||||
|
||||
# If you're in another directory, specify the full path:
|
||||
bash /opt/nupst/setup.sh --force
|
||||
nupst --version
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
NUPST was designed with security in mind:
|
||||
NUPST is designed with security as a priority:
|
||||
|
||||
### Minimal Dependencies
|
||||
### Architecture Security
|
||||
|
||||
- **Minimal Runtime Dependencies**: NUPST uses only one carefully selected NPM package (net-snmp) to minimize the attack surface and avoid supply chain risks while providing robust SNMP functionality.
|
||||
- **Self-contained Node.js**: NUPST ships with its own Node.js binary, isolated from the system's Node.js installation. This ensures:
|
||||
- No dependency on system Node.js versions
|
||||
- Minimal external libraries that could become compromised
|
||||
- Consistent, tested environment for execution
|
||||
- Reduced risk of dependency-based attacks
|
||||
- **Single Binary**: Self-contained executable with no external dependencies
|
||||
- **No Runtime Dependencies**: Unlike v3.x (Node.js), v4.0+ requires no runtime environment
|
||||
- **Minimal Attack Surface**: Compiled Deno binary with only essential SNMP functionality
|
||||
- **No Supply Chain Risk**: Pre-compiled binaries verified with SHA256 checksums
|
||||
- **Isolated Execution**: Runs with minimal required privileges
|
||||
|
||||
### Implementation Security
|
||||
### SNMP Security
|
||||
|
||||
- **Privilege Separation**: Only specific commands that require elevated permissions (`enable`, `disable`, `update`) check for root access; all other functionality runs with minimal privileges.
|
||||
- **Limited Network Access**: NUPST only communicates with the UPS device over SNMP and contacts npmjs.org only to check for updates.
|
||||
- **Isolated Execution**: The application runs in its working directory (`/opt/nupst`) or specified installation location, minimizing the impact on the rest of the system.
|
||||
|
||||
### SNMP Security Features
|
||||
|
||||
- **SNMPv3 Support with Secure Authentication and Privacy**:
|
||||
- Three security levels available:
|
||||
- `noAuthNoPriv`: No authentication or encryption (basic access)
|
||||
- `authNoPriv`: Authentication without encryption (verifies identity)
|
||||
- `authPriv`: Full authentication and encryption (most secure)
|
||||
- Authentication protocols: MD5 or SHA
|
||||
- Privacy/encryption protocols: DES or AES
|
||||
- Automatic fallback mechanisms for compatibility
|
||||
- Context support for segmented SNMP deployments
|
||||
- Configurable timeouts based on security level
|
||||
- **Graceful degradation**: If authentication or privacy details are missing or invalid, NUPST will automatically fall back to a lower security level while logging appropriate warnings.
|
||||
- **Interactive setup**: Guided setup process to properly configure SNMPv3 security settings with clear explanations of each security option.
|
||||
- **SNMPv3 Support**: Full authentication and encryption support
|
||||
- `noAuthNoPriv`: Basic access (no security)
|
||||
- `authNoPriv`: Authentication without encryption
|
||||
- `authPriv`: Full authentication and encryption (recommended)
|
||||
- **Authentication**: MD5 or SHA protocols
|
||||
- **Encryption**: DES or AES privacy protocols
|
||||
- **Secure Defaults**: Automatic timeout adjustment based on security level
|
||||
|
||||
### Installation Security
|
||||
|
||||
- The installation script can be reviewed before execution (`curl -sSL [url] | less`)
|
||||
- All setup scripts download only verified versions and check integrity
|
||||
- Installation is transparent and places files in standard locations (`/opt/nupst`, `/usr/local/bin`, `/etc/systemd/system`)
|
||||
- Automatically detects platform architecture and OS for proper binary selection
|
||||
- Installs production dependencies locally without requiring global npm packages
|
||||
- **Checksum Verification**: SHA256SUMS.txt provided for all releases
|
||||
- **Transparent Installation**: Standard locations with clear documentation
|
||||
- **Minimal Permissions**: Only systemd operations require root access
|
||||
- **Source Available**: Full source code available for audit
|
||||
|
||||
### Audit and Review
|
||||
### Network Security
|
||||
|
||||
The codebase is small, focused, and designed to be easily auditable. All code is open source and available for review.
|
||||
- **Local-Only Communication**: Only connects to UPS devices on local network
|
||||
- **No Telemetry**: No data sent to external servers
|
||||
- **No Update Checks**: Manual update process only
|
||||
|
||||
### Verifying Downloads
|
||||
|
||||
All releases include SHA256 checksums:
|
||||
|
||||
```bash
|
||||
# Download binary and checksums
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/nupst-linux-x64 -o nupst
|
||||
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/SHA256SUMS.txt -o SHA256SUMS.txt
|
||||
|
||||
# Verify checksum
|
||||
sha256sum -c SHA256SUMS.txt --ignore-missing
|
||||
```
|
||||
|
||||
## Migration from v3.x
|
||||
|
||||
If you're upgrading from NUPST v3.x (Node.js-based), see [MIGRATION.md](./MIGRATION.md) for detailed migration instructions.
|
||||
|
||||
**Key Changes in v4.0:**
|
||||
- Powered by Deno instead of Node.js
|
||||
- Distributed as pre-compiled binaries
|
||||
- New subcommand structure (backward compatible)
|
||||
- Zero dependencies required
|
||||
- Smaller installation footprint
|
||||
- Faster startup and execution
|
||||
|
||||
**Configuration Compatibility:**
|
||||
Your existing `/etc/nupst/config.json` from v3.x is fully compatible with v4.0. No changes required.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Binary Won't Execute
|
||||
|
||||
```bash
|
||||
# Make sure it's executable
|
||||
chmod +x /opt/nupst/nupst
|
||||
|
||||
# Check architecture matches your system
|
||||
uname -m # Should match binary (x86_64 = x64, aarch64 = arm64)
|
||||
```
|
||||
|
||||
### Service Won't Start
|
||||
|
||||
```bash
|
||||
# Check service status
|
||||
sudo systemctl status nupst
|
||||
|
||||
# Check logs for errors
|
||||
sudo journalctl -u nupst -n 50
|
||||
|
||||
# Verify configuration
|
||||
nupst config show
|
||||
```
|
||||
|
||||
### Can't Connect to UPS
|
||||
|
||||
```bash
|
||||
# Test SNMP connectivity
|
||||
nupst ups test --debug
|
||||
|
||||
# Check network connectivity
|
||||
ping <ups-ip-address>
|
||||
|
||||
# Verify SNMP port is accessible
|
||||
nc -zv <ups-ip-address> 161
|
||||
```
|
||||
|
||||
### Permission Denied Errors
|
||||
|
||||
Most operations that modify the system require root:
|
||||
|
||||
```bash
|
||||
# Service management
|
||||
sudo nupst service enable
|
||||
sudo nupst service start
|
||||
|
||||
# Configuration changes
|
||||
sudo nupst ups add
|
||||
sudo nupst group add
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Building from Source
|
||||
|
||||
Requirements:
|
||||
- [Deno](https://deno.land/) v1.x or later
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://code.foss.global/serve.zone/nupst.git
|
||||
cd nupst
|
||||
|
||||
# Run directly with Deno
|
||||
deno run --allow-all mod.ts help
|
||||
|
||||
# Compile for current platform
|
||||
deno compile --allow-all --output nupst mod.ts
|
||||
|
||||
# Compile for all platforms
|
||||
bash scripts/compile-all.sh
|
||||
```
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
deno test --allow-all tests/
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
Contributions are welcome! Please:
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Submit a pull request
|
||||
|
||||
## Support
|
||||
|
||||
- **Issues**: [Report bugs or request features](https://code.foss.global/serve.zone/nupst/issues)
|
||||
- **Documentation**: [Full documentation](https://code.foss.global/serve.zone/nupst)
|
||||
- **Source Code**: [View source](https://code.foss.global/serve.zone/nupst)
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
@@ -369,9 +554,9 @@ This project is owned and maintained by Task Venture Capital GmbH. The names and
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
Reference in New Issue
Block a user