360 Secure SkillHub
360 安全技能中心

ProxMox-Power

该 Skill 提供状态检测、唤醒和关机脚本:用 Wake-on-LAN 发送魔术包,并通过仅允许执行关机命令的 SSH 密钥远程关机。用户需一次性配置服务器地址、MAC 和广播地址,并在服务器端安装受限公钥;不包含自动修改服务器 WoL 或 BIOS 设置。

分类:自动化
mrpace1976
mrpace1976
热度 37.66
最近更新 2026-12-02 14:51:02

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add mrpace1976/proxmox-power
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
proxmox-power
description
Wake (power on), shut down (power off) or check a home server such as a Proxmox host, using Wake-on-LAN and a locked-down SSH shutdown key. Use when the user asks to wake, turn on, start, boot, shut down, turn off, power off or stop the server / Proxmox / homelab, or asks whether it is up, on or online.

ProxMox-Power (Wake-on-LAN + safe SSH shutdown)

Powers a home server (e.g. Proxmox) on with Wake-on-LAN, shuts it down cleanly over SSH, and checks whether it is up. Works from Linux, macOS and WSL (under WSL it sends the magic packet from Windows, because WSL's NAT network can't broadcast onto the LAN).

Commands

Run these with the exec tool. Each one prints a short result; pass it on to the user briefly.

  • Check if the server is up: bash {baseDir}/scripts/status.sh
  • Wake / turn on: bash {baseDir}/scripts/wake.sh Sends the magic packet, then waits (default 5 minutes) for the server to answer ping. Servers usually take 1 to 3 minutes. Tell the user you're waking it before you run it.
  • Shut down / turn off: bash {baseDir}/scripts/shutdown.sh Only when the user clearly asks to turn the server off. Sends a clean shutdown (Proxmox stops guests first), then waits (default 3 minutes) for it to stop answering. Tell the user it's shutting down before you run it.

Exit codes and what to tell the user

  • 0 success (or already in the requested state).
  • 1 timed out: on wake, the packet went out but the server never answered (sender not on the server's LAN, cable not in the WoL-enabled NIC, WoL disabled in BIOS/OS, or no power); on shutdown, the command was accepted but the server still answers (guests may still be stopping). Report it; don't retry in a loop.
  • 2 shutdown was NOT sent (SSH failed, usually "Permission denied" because the key isn't installed on the server). Tell the user; don't try other logins or credentials.
  • 3 missing config. 4 couldn't send the magic packet.

One-time setup

  1. Copy {baseDir}/config.example.env to ~/.config/proxmox-power/config.env and fill in the server's address, the MAC address(es) of its WoL-enabled NIC(s), and broadcast address(es). PROXMOX_POWER_CONFIG can point to a different path.
  2. Turn on Wake-on-LAN in the server's BIOS and OS (on Proxmox/Debian, e.g. ethtool -s <nic> wol g, made persistent in /etc/network/interfaces).
  3. Run bash {baseDir}/scripts/setup-key.sh. It creates a dedicated SSH key and prints an authorized_keys line. The user adds that line on the server (e.g. Proxmox web UI → node → Shell → nano /root/.ssh/authorized_keys). The line pins the key to shutdown -h now with no shell, forwarding or PTY, so the key can't be used for anything else.
  4. Test with status.sh, wake.sh and shutdown.sh.

Security notes

  • The agent never gets a shell on the server: the only SSH key it uses is forced to a single shutdown command on the server side.
  • Your addresses and MACs live in your local config file, not in the skill.
  • The magic packet needs no credentials; anyone on your LAN can send one.