[agent-go]-简化Agent 剔除Harbor K8s Image相关的内容

This commit is contained in:
zeaslity
2025-01-22 15:09:43 +08:00
parent 4edaf9f35a
commit 0d3bb30eed
15 changed files with 2569 additions and 2666 deletions

View File

@@ -12,6 +12,7 @@ import (
)
var OctopusAgentInstallPrefix = "/root/wdd/"
var nfsDataPath = "/var/lib/docker/nfs_data"
type BaseFunc interface {
@@ -500,6 +501,41 @@ func (op *AgentOsOperator) InstallDefaultSshBastion() (bool, []string) {
}
}
func (op *AgentOsOperator) ModifySSHConfigBastion() (bool, []string) {
// 替换sshd文件
sshdConfigFile := "/etc/ssh/sshd_config"
sshConfigBackupFile := "/etc/ssh/sshd_config_wdd_back"
// 只备份第一次
if !BasicFileExistAndNotNull(sshConfigBackupFile) {
BasicAppendOverwriteContentToFile(sshdConfigFile, sshConfigBackupFile)
}
// AllowTcpForwarding yes
// AllowAgentForwarding yes
// X11Forwarding yes
// StrictMode no
// PermitRootLogin yes
// PasswordAuthentication yes
// PubkeyAuthentication yes
// 直接使用默认的sshd_config配置
if !BasicAppendOverwriteContentToFile(beans.DefaultSshdConfig, sshdConfigFile) {
return false, []string{
"error write default sshd config to sshd file",
}
}
ok, resultLog := BasicSystemdRestart("sshd")
if !ok {
return false, []string{
"sshd restart failed ! please check !",
}
}
return true, resultLog
}
func (op *AgentOsOperator) removeDocker() [][]string {
removeDockerLine := append(op.RemoveCommandPrefix, []string{