log web access

This commit is contained in:
Xavier Henner
2019-07-17 15:13:40 +02:00
parent e4c5718f6d
commit 0d918b7540
2 changed files with 6 additions and 4 deletions

View File

@@ -122,13 +122,14 @@ func (s *OpenVpnMgt) Stats() map[string]map[int]*vpnSession {
return s.clients
}
func (s *OpenVpnMgt) Kill(session string, id int) error {
func (s *OpenVpnMgt) Kill(session string, id int, killer string) error {
if _, ok := s.clients[session]; !ok {
return errors.New("unknown session")
}
if _, ok := s.clients[session][id]; !ok {
return errors.New("unknown session id")
}
log.Printf("user %s's session killed from the web by %s\n", s.clients[session][id].Login, killer)
err, _ := s.sendCommand([]string{fmt.Sprintf("client-kill %d", id)}, session)
return err
}