修改ssh部署,移除测试代码

pull/1/head v1.0.1
zhangchenhao 2025-05-07 17:38:52 +08:00
parent 60f0e1b53c
commit 5bc248ce4b
4 changed files with 9 additions and 20 deletions

View File

@ -6,7 +6,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
"path"
"strconv" "strconv"
) )
@ -124,9 +123,13 @@ func DeploySSH(cfg map[string]any) error {
default: default:
return fmt.Errorf("参数错误provider_id") return fmt.Errorf("参数错误provider_id")
} }
dir, ok := cfg["path"].(string) keyPath, ok := cfg["keyPath"].(string)
if !ok { if !ok {
return fmt.Errorf("参数错误path") return fmt.Errorf("参数错误keyPath")
}
certPath, ok := cfg["keyPath"].(string)
if !ok {
return fmt.Errorf("参数错误certPath")
} }
beforeCmd, ok := cfg["beforeCmd"].(string) beforeCmd, ok := cfg["beforeCmd"].(string)
if !ok { if !ok {
@ -152,8 +155,8 @@ func DeploySSH(cfg map[string]any) error {
} }
// 自动创建多级目录 // 自动创建多级目录
files := []RemoteFile{ files := []RemoteFile{
{Path: path.Join(dir, "cert.pem"), Content: certPem}, {Path: keyPath, Content: certPem},
{Path: path.Join(dir, "key.pem"), Content: keyPem}, {Path: certPath, Content: keyPem},
} }
err = writeMultipleFilesViaSSH(providerConfig, files, beforeCmd, afterCmd) err = writeMultipleFilesViaSSH(providerConfig, files, beforeCmd, afterCmd)
if err != nil { if err != nil {

View File

@ -3,7 +3,6 @@ package middleware
import ( import (
"ALLinSSL/backend/public" "ALLinSSL/backend/public"
"encoding/gob" "encoding/gob"
"fmt"
"github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/http" "net/http"
@ -28,18 +27,6 @@ func SessionAuthMiddleware() gin.HandlerFunc {
now := time.Now() now := time.Now()
gob.Register(time.Time{}) gob.Register(time.Time{})
last := session.Get("lastRequestTime") last := session.Get("lastRequestTime")
var form struct {
Skip string `form:"skip"`
}
err := c.Bind(&form)
if err != nil {
fmt.Println(err)
} else {
if form.Skip == "1" {
c.Next()
return
}
}
if routePath == public.Secure && session.Get("secure") == nil { if routePath == public.Secure && session.Get("secure") == nil {
// 访问安全入口,设置 session // 访问安全入口,设置 session

View File

@ -165,7 +165,6 @@ func init() {
create_time TEXT, create_time TEXT,
end_time TEXT, end_time TEXT,
workflow_id TEXT not null workflow_id TEXT not null
fail_reason TEXT,
); );
`) `)
insertDefaultData(db, "users", "INSERT INTO users (id, username, password, salt) VALUES (1, 'xxxx', 'xxxxxxx', '&*ghs^&%dag');") insertDefaultData(db, "users", "INSERT INTO users (id, username, password, salt) VALUES (1, 'xxxx', 'xxxxxxx', '&*ghs^&%dag');")

View File

@ -50,7 +50,7 @@ if [ $# -eq 0 ]; then
fi fi
function update_allinssl() { function update_allinssl() {
local url="http://192.168.69.167:8888/down/Kuguq0edGNRA.tar.gz" local url="https://download.allinssl.com/bin/allinssl.tar.gz"
local target_dir="${WORK_DIR}" local target_dir="${WORK_DIR}"
local temp_file=$(mktemp) local temp_file=$(mktemp)
local original_filename temp_file local original_filename temp_file