mirror of https://gogs.blitter.com/RLabs/xs
Make hkexshd log IP not hostname to wtmp/lastlog
This commit is contained in:
parent
f079b5b43d
commit
0d404470c1
|
@ -17,6 +17,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/user"
|
"os/user"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"blitter.com/go/goutmp"
|
"blitter.com/go/goutmp"
|
||||||
|
@ -319,7 +320,8 @@ func main() {
|
||||||
if rec.op[0] == 'c' {
|
if rec.op[0] == 'c' {
|
||||||
// Non-interactive command
|
// Non-interactive command
|
||||||
addr := hc.RemoteAddr()
|
addr := hc.RemoteAddr()
|
||||||
hname := goutmp.GetHost(addr.String())
|
//hname := goutmp.GetHost(addr.String())
|
||||||
|
hname := strings.Split(addr.String(), ":")[0]
|
||||||
|
|
||||||
log.Printf("[Running command for [%s@%s]]\n", rec.who, hname)
|
log.Printf("[Running command for [%s@%s]]\n", rec.who, hname)
|
||||||
runErr, cmdStatus := runShellAs(string(rec.who), string(rec.cmd), false, hc, chaffEnabled)
|
runErr, cmdStatus := runShellAs(string(rec.who), string(rec.cmd), false, hc, chaffEnabled)
|
||||||
|
@ -335,7 +337,8 @@ func main() {
|
||||||
} else if rec.op[0] == 's' {
|
} else if rec.op[0] == 's' {
|
||||||
// Interactive session
|
// Interactive session
|
||||||
addr := hc.RemoteAddr()
|
addr := hc.RemoteAddr()
|
||||||
hname := goutmp.GetHost(addr.String())
|
//hname := goutmp.GetHost(addr.String())
|
||||||
|
hname := strings.Split(addr.String(), ":")[0]
|
||||||
log.Printf("[Running shell for [%s@%s]]\n", rec.who, hname)
|
log.Printf("[Running shell for [%s@%s]]\n", rec.who, hname)
|
||||||
|
|
||||||
utmpx := goutmp.Put_utmp(string(rec.who), hname)
|
utmpx := goutmp.Put_utmp(string(rec.who), hname)
|
||||||
|
|
Loading…
Reference in New Issue