mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-09 05:47:30 +08:00
Opt: Generate random ssh username
This commit is contained in:
parent
4fbefd73c2
commit
297b0267ca
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -106,16 +106,16 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
# [Format] host:port
|
||||
SSHServer: null
|
||||
# Filepath of SSH executable `ssh.exe`
|
||||
# [Default] null (use ssh in system PATH)
|
||||
# [Default] ssh (find ssh in system PATH)
|
||||
# If you don't have one, install OpenSSH or download it here (https://github.com/PowerShell/Win32-OpenSSH/releases)
|
||||
SSHExecutable: null
|
||||
SSHExecutable: ssh
|
||||
|
||||
Webui:
|
||||
# --host. Host to listen
|
||||
|
@ -75,7 +75,7 @@ class DeployConfig(ConfigModel):
|
||||
def show_config(self):
|
||||
logger.hr("Show deploy config", 1)
|
||||
for k, v in self.config.items():
|
||||
if k in ("Password"):
|
||||
if k in ("Password", "SSHUser"):
|
||||
continue
|
||||
if self.config_template[k] == v:
|
||||
continue
|
||||
|
@ -106,7 +106,7 @@ Deploy:
|
||||
# See here (http://app.azurlane.cloud/en.html) for more infomation.
|
||||
EnableRemoteAccess: false
|
||||
# Username when login into ssh server
|
||||
# [Default] null (use username logged in your system)
|
||||
# [Default] null (will generate a random one when startup)
|
||||
SSHUser: null
|
||||
# Server to connect
|
||||
# [Default] null
|
||||
|
@ -17,6 +17,7 @@ from subprocess import PIPE, Popen
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from module.logger import logger
|
||||
from module.config.utils import random_id
|
||||
from module.webui.setting import State
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -158,9 +159,11 @@ def start_remote_access_service(**kwagrs):
|
||||
else:
|
||||
local_host = State.deploy_config.WebuiHost
|
||||
|
||||
if State.deploy_config.SSHUser:
|
||||
server = f"{State.deploy_config.SSHUser}@{server}"
|
||||
if State.deploy_config.SSHUser is None:
|
||||
logger.info("SSHUser is not set, generate a random one")
|
||||
State.deploy_config.SSHUser = random_id(24)
|
||||
|
||||
server = f"{State.deploy_config.SSHUser}@{server}"
|
||||
kwagrs.setdefault("server", server)
|
||||
kwagrs.setdefault("server_port", server_port)
|
||||
kwagrs.setdefault("local_host", local_host)
|
||||
|
Loading…
Reference in New Issue
Block a user