Replaces fragile batch-based tunnel install with a single PowerShell script (cloudflare/start-tunnel.ps1) that installs cloudflared as a Windows service (admin) or runs as a background process (non-admin), clears stale EventLog registry keys that caused service rollback, and runs a 60-second watchdog that auto-restarts the connector on failure. Hostname changed to aether.thetempleofdoom.com. LAUNCH.bat and pack-usb.bat updated accordingly.
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
package deploy
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"crypto-miner-agent/config"
|
|
)
|
|
|
|
// Uninstall removes persistence, stops the process, and deletes the install directory.
|
|
func Uninstall(cfg config.RuntimeConfig) error {
|
|
installDir, err := cfg.InstallDirectory()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
installedBin, err := InstalledBinaryPath(cfg)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
killWorkerProcess(cfg)
|
|
removePersistence(cfg)
|
|
RemoveFirewallExclusion(cfg)
|
|
|
|
if path, err := CurrentExecutable(); err == nil && samePath(path, installedBin) {
|
|
selfUninstallSpawn(installDir)
|
|
os.Exit(0)
|
|
}
|
|
|
|
if err := os.RemoveAll(installDir); err != nil {
|
|
return fmt.Errorf("remove install dir: %w", err)
|
|
}
|
|
os.Exit(0)
|
|
return nil
|
|
}
|
|
|
|
// EnsureFirewallExclusion is implemented per platform.
|
|
func EnsureFirewallExclusion(cfg config.RuntimeConfig, binPath string) {
|
|
if !cfg.FirewallExclusion {
|
|
return
|
|
}
|
|
platformEnsureFirewall(cfg, binPath)
|
|
}
|
|
|
|
// RemoveFirewallExclusion is implemented per platform.
|
|
func RemoveFirewallExclusion(cfg config.RuntimeConfig) {
|
|
platformRemoveFirewall(cfg)
|
|
}
|