Commit 657fbc18 authored by Eric_Lee's avatar Eric_Lee Committed by Eric

修复关闭seesion的bug和移除无效的配置 (#80)

parent b8654e70
......@@ -30,27 +30,15 @@ BOOTSTRAP_TOKEN: <PleasgeChangeSameWithJumpserver>
# 设置日志级别 [DEBUG, INFO, WARN, ERROR, FATAL, CRITICAL]
# LOG_LEVEL: INFO
# 日志存放的目录
# LOG_DIR: logs
# SSH白名单
# ALLOW_SSH_USER: all
# SSH黑名单, 如果用户同时在白名单和黑名单,黑名单优先生效
# BLOCK_SSH_USER:
# -
# 和Jumpserver 保持心跳时间间隔
# 和Jumpserver 保持心跳时间间隔 (seconds)
# HEARTBEAT_INTERVAL: 5
# Admin的名字,出问题会提示给用户
# ADMINS: ''
# SSH连接超时时间 (default 15 seconds)
# SSH_TIMEOUT: 15
# 语言 [en,zh]
# LANGUAGE_CODE: zh
# LANG: zh
# SFTP的根目录, 可选 /tmp, Home其他自定义目录
# SFTP_ROOT: /tmp
......
......@@ -17,19 +17,22 @@ var lock = new(sync.RWMutex)
func HandleSessionTask(task model.TerminalTask) {
switch task.Name {
case "kill_session":
KillSession(task.Args)
if ok := KillSession(task.Args); ok{
service.FinishTask(task.ID)
}
default:
}
}
func KillSession(sessionID string) {
func KillSession(sessionID string) bool {
lock.RLock()
defer lock.RUnlock()
if sw, ok := sessionMap[sessionID]; ok {
sw.Terminate()
return true
}
return false
}
func GetAliveSessions() []string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment