Add live Disable Telnet action to Web Access Control

Adds a standalone DISABLE TELNET button (no enable counterpart, per
requirement) alongside the existing HTTPS enable/disable toggle. Reuses
the same target/concurrency controls and SSH push flow, backed by a new
"disable_telnet" action mapped to "no ip telnet" on the switch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLfUJoQTaUePx1m1d2v2j9
This commit is contained in:
2026-08-18 11:28:23 -05:00
parent 7233386d36
commit ac13c913e3
2 changed files with 21 additions and 6 deletions
+9 -3
View File
@@ -89,16 +89,22 @@ def api_web_access():
ip = data.get("ip", "").strip()
username = data.get("username", "").strip()
password = data.get("password", "").strip()
action = data.get("action", "") # "enable" or "disable"
action = data.get("action", "") # "enable", "disable", or "disable_telnet"
commands = {
"enable": "ip http secure-server",
"disable": "no ip http secure-server",
"disable_telnet": "no ip telnet",
}
if not ip or not username or not password:
return jsonify({"ok": False, "error": "Missing IP or credentials"}), 400
if action not in ("enable", "disable"):
if action not in commands:
return jsonify({"ok": False, "error": "Invalid action"}), 400
print(f"[web-access] {action} {ip} user={username!r} pass_len={len(password)}", flush=True)
cmd = "ip http secure-server" if action == "enable" else "no ip http secure-server"
cmd = commands[action]
try:
sock = socket.create_connection((ip, 22), timeout=10)