diff --git a/internal/api/message.go b/internal/api/message.go index 8263910..b9da4e2 100644 --- a/internal/api/message.go +++ b/internal/api/message.go @@ -16,9 +16,6 @@ const ( TypeNone = iota TypeOK TypeError - TypeVPNConnect - TypeVPNDisconnect - TypeVPNQuery TypeVPNConfigUpdate TypeUndefined ) diff --git a/internal/api/message_test.go b/internal/api/message_test.go index 8ca4310..48ab0f4 100644 --- a/internal/api/message_test.go +++ b/internal/api/message_test.go @@ -13,8 +13,6 @@ func TestNewMessage(t *testing.T) { TypeNone, TypeOK, TypeError, - TypeVPNConnect, - TypeVPNQuery, TypeVPNConfigUpdate, TypeUndefined, } { diff --git a/internal/api/server.go b/internal/api/server.go index a4b762d..866e119 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -62,9 +62,6 @@ func (s *Server) handleRequest(conn net.Conn) { // check if its a known message type switch msg.Type { - case TypeVPNConnect: - case TypeVPNDisconnect: - case TypeVPNQuery: case TypeVPNConfigUpdate: default: // send Error and disconnect @@ -120,8 +117,8 @@ func (s *Server) Start() { } s.listen = listen - // make sure everyone can access the sock file - if err := os.Chmod(s.sockFile, 0777); err != nil { + // make sure only we can access the sock file + if err := os.Chmod(s.sockFile, 0700); err != nil { log.WithError(err).Error("Daemon could not set permissions of sock file") } diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 01f236d..b0e2975 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -232,16 +232,6 @@ func (d *Daemon) disconnectVPN() { d.runner.Disconnect() } -// sendVPNStatus sends the VPN status back to the client -func (d *Daemon) sendVPNStatus(request *api.Request) { - // send OK with VPN status - b, err := d.status.JSON() - if err != nil { - log.WithError(err).Fatal("Daemon could not convert status to JSON") - } - request.Reply(b) -} - // setupRouting sets up routing using config // TODO: move somewhere else? func (d *Daemon) setupRouting(config *vpnconfig.Config) { @@ -412,26 +402,6 @@ func (d *Daemon) handleClientRequest(request *api.Request) { log.Debug("Daemon handling client request") switch request.Type() { - case api.TypeVPNConnect: - // parse login info - login, err := logininfo.LoginInfoFromJSON(request.Data()) - if err != nil { - log.WithError(err).Error("Daemon could not parse login info JSON") - request.Error("invalid login info in connect message") - break - } - - // connect VPN - d.connectVPN(login) - - case api.TypeVPNDisconnect: - // diconnect VPN - d.disconnectVPN() - - case api.TypeVPNQuery: - // send vpn status - d.sendVPNStatus(request) - case api.TypeVPNConfigUpdate: // update VPN config d.updateVPNConfig(request)