mirror of
https://github.com/moul/sshportal.git
synced 2025-09-04 11:44:52 +08:00
logs_location -> logsLocation
This commit is contained in:
parent
57f894bfca
commit
ff46ee89d9
2 changed files with 4 additions and 4 deletions
|
@ -46,14 +46,14 @@ func ChannelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
|
|||
return pipe(lreqs, rreqs, lch, rch, config.Logs, user)
|
||||
}
|
||||
|
||||
func pipe(lreqs, rreqs <-chan *gossh.Request, lch, rch gossh.Channel, logs_location string, user string) error {
|
||||
func pipe(lreqs, rreqs <-chan *gossh.Request, lch, rch gossh.Channel, logsLocation string, user string) error {
|
||||
defer func() {
|
||||
_ = lch.Close()
|
||||
_ = rch.Close()
|
||||
}()
|
||||
|
||||
errch := make(chan error, 1)
|
||||
file_name := strings.Join([]string{logs_location, "/", user, "-", time.Now().Format(time.RFC3339)}, "") // get user
|
||||
file_name := strings.Join([]string{logsLocation, "/", user, "-", time.Now().Format(time.RFC3339)}, "") // get user
|
||||
f, err := os.OpenFile(file_name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0640)
|
||||
if err != nil {
|
||||
go func() {
|
||||
|
|
4
ssh.go
4
ssh.go
|
@ -96,7 +96,7 @@ func channelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
|
|||
}
|
||||
|
||||
actx := ctx.Value(authContextKey).(*authContext)
|
||||
logs_location := actx.globalContext.String("logs-location")
|
||||
logsLocation := actx.globalContext.String("logs-location")
|
||||
|
||||
switch actx.userType() {
|
||||
case UserTypeBastion:
|
||||
|
@ -130,7 +130,7 @@ func channelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
|
|||
|
||||
err = bastionsession.ChannelHandler(srv, conn, newChan, ctx, bastionsession.Config{
|
||||
Addr: host.Addr,
|
||||
Logs: logs_location,
|
||||
Logs: logsLocation,
|
||||
ClientConfig: clientConfig,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue