Added logic to handle changes/notifications from the GUI.

- Allow to perform the following actions from the GUI:
  * Load/unload firewall (i.e.: interception)
  * Change daemon default configuration.
  * Enable/disable rules.
  * Delete rules.
  * Change/Add rules.
  * Change log level.
This commit is contained in:
Gustavo Iñiguez Goia 2020-05-10 17:44:56 +02:00
parent c44fdf4342
commit 85699622f6
3 changed files with 362 additions and 113 deletions

View file

@ -1,49 +1,146 @@
package ui
import (
"fmt"
"io"
"io/ioutil"
"strings"
"time"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/core"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/firewall"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/log"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/procmon"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/rule"
"github.com/gustavo-iniguez-goya/opensnitch/daemon/ui/protocol"
"golang.org/x/net/context"
)
func (c *Client) getClientConfig() *protocol.ClientConfig {
raw, _ := ioutil.ReadFile(configFile)
nodeName, _ := ioutil.ReadFile("/proc/sys/kernel/hostname")
nodeVersion, _ := ioutil.ReadFile("/proc/sys/kernel/version")
var ts time.Time
return &protocol.ClientConfig{
Id: uint64(ts.UnixNano()),
Name: strings.Replace(string(nodeName), "\n", "", -1),
Version: strings.Replace(string(nodeVersion), "\n", "", -1),
IsFirewallRunning: firewall.IsRunning(),
Config: strings.Replace(string(raw), "\n", "", -1),
LogLevel: uint32(log.MinLevel),
// TODO
Rules: nil,
// NewReply constructs a new protocol notification reply
func NewReply(rID uint64, replyCode protocol.NotificationReplyCode, data string) *protocol.NotificationReply {
return &protocol.NotificationReply{
Id: rID,
Code: replyCode,
Data: data,
}
}
func (c *Client) handleNotification(notification *protocol.Notification) {
func (c *Client) getClientConfig() *protocol.ClientConfig {
raw, _ := ioutil.ReadFile(configFile)
nodeName := core.GetHostname()
nodeVersion := core.GetKernelVersion()
var ts time.Time
rulesTotal := len(c.rules.GetAll())
ruleList := make([]*protocol.Rule, rulesTotal)
idx := 0
for _, r := range c.rules.GetAll() {
ruleList[idx] = r.Serialize()
idx++
}
return &protocol.ClientConfig{
Id: uint64(ts.UnixNano()),
Name: nodeName,
Version: nodeVersion,
IsFirewallRunning: firewall.IsRunning(),
Config: strings.Replace(string(raw), "\n", "", -1),
LogLevel: uint32(log.MinLevel),
Rules: ruleList,
}
}
func (c *Client) handleNotification(stream protocol.UI_NotificationsClient, notification *protocol.Notification) {
switch {
case notification.Type == protocol.Action_CHANGE_CONFIG:
log.Info("[notification] Reloading configuration")
// this save operation triggers a re-loadConfiguration()
c.saveConfiguration(notification.Data)
err := c.saveConfiguration(notification.Data)
if err != nil {
log.Warning("[notification] CHANGE_CONFIG not applied")
}
// XXX: can the Reload() happen before finishing loading conf?
procmon.Reload()
c.sendNotificationReply(stream, notification.Id, err)
case notification.Type == protocol.Action_LOAD_FIREWALL:
log.Info("[notification] starting firewall")
firewall.Init(nil)
c.sendNotificationReply(stream, notification.Id, nil)
case notification.Type == protocol.Action_UNLOAD_FIREWALL:
log.Info("[notification] stopping firewall")
firewall.Stop(nil)
c.sendNotificationReply(stream, notification.Id, nil)
// ENABLE_RULE just replaces the rule on disk
case notification.Type == protocol.Action_ENABLE_RULE:
var rErr error
for _, rul := range notification.Rules {
log.Info("[notification] enable rule: ", rul.Name)
// protocol.Rule(protobuf) != rule.Rule(json)
r := rule.Deserialize(rul)
r.Enabled = true
// save to disk only if the duration is rule.Always
if err := c.rules.Replace(r, r.Duration == rule.Always); err != nil {
rErr = err
}
}
c.sendNotificationReply(stream, notification.Id, rErr)
case notification.Type == protocol.Action_DISABLE_RULE:
var rErr error
for _, rul := range notification.Rules {
log.Info("[notification] disable: ", rul)
r := rule.Deserialize(rul)
r.Enabled = false
if err := c.rules.Replace(r, r.Duration == rule.Always); err != nil {
rErr = err
}
}
c.sendNotificationReply(stream, notification.Id, rErr)
case notification.Type == protocol.Action_DELETE_RULE:
var rErr error
for _, rul := range notification.Rules {
log.Info("[notification] delete rule: ", rul.Name, notification.Id)
r := rule.Deserialize(rul)
if r == nil {
rErr = fmt.Errorf("Invalid rule")
continue
}
if err := c.rules.Delete(r.Name); err != nil {
log.Error("deleting rule: ", err, r)
rErr = err
}
}
c.sendNotificationReply(stream, notification.Id, rErr)
// CHANGE_RULE can add() or replace) an existing rule.
case notification.Type == protocol.Action_CHANGE_RULE:
var rErr error
for _, rul := range notification.Rules {
r := rule.Deserialize(rul)
if r == nil {
rErr = fmt.Errorf("Invalid rule")
continue
}
log.Info("[notification] change rule: ", r, notification.Id)
if err := c.rules.Replace(r, r.Duration == rule.Always); err != nil {
log.Error("[notification] Error changing rule: ", err, r)
rErr = err
}
}
c.sendNotificationReply(stream, notification.Id, rErr)
}
}
func (c *Client) sendNotificationReply(stream protocol.UI_NotificationsClient, nID uint64, err error) {
reply := NewReply(nID, protocol.NotificationReplyCode_OK, "")
if err != nil {
reply.Code = protocol.NotificationReplyCode_ERROR
reply.Data = fmt.Sprint(err)
}
if err := stream.Send(reply); err != nil {
log.Error("Error replying to notification:", err, reply.Id)
}
}
@ -51,16 +148,33 @@ func (c *Client) handleNotification(notification *protocol.Notification) {
// receiving notifications.
// It firstly sends the daemon status and configuration.
func (c *Client) Subscribe() {
log.Info("Subscribe")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if _, err := c.client.Subscribe(ctx, c.getClientConfig()); err != nil {
log.Error("Subscribing to GUI", err)
return
}
c.listenForNotifications()
}
// Notifications is the channel where the daemon receives messages from the server.
// It consists of 2 grpc streams (send/receive) that are never closed,
// this way we can share messages in realtime.
// If the GUI is closed, we'll receive an error reading from the channel.
func (c *Client) listenForNotifications() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// open the stream channel
streamReply := &protocol.NotificationReply{Id: 0, Code: protocol.NotificationReplyCode_OK}
notisStream, err := c.client.Notifications(ctx)
if err != nil {
log.Error("establishing notifications channel", err)
return
}
if err := notisStream.Send(c.getClientConfig()); err != nil {
// send the first notification
if err := notisStream.Send(streamReply); err != nil {
log.Error("sending notfication HELLO", err)
return
}
@ -75,10 +189,7 @@ func (c *Client) Subscribe() {
log.Error("getting notifications: ", err, noti)
break
}
c.handleNotification(noti)
//if err := notisStream.Send(c.getNotificationConfig()); err != nil {
// log.Error("Error Subscribe()2 sending initial packet")
//}
c.handleNotification(notisStream, noti)
}
notisStream.CloseSend()

View file

@ -33,8 +33,10 @@ const (
Action_CHANGE_CONFIG Action = 3
Action_ENABLE_RULE Action = 4
Action_DISABLE_RULE Action = 5
Action_LOG_LEVEL Action = 6
Action_STOP Action = 7
Action_DELETE_RULE Action = 6
Action_CHANGE_RULE Action = 7
Action_LOG_LEVEL Action = 8
Action_STOP Action = 9
)
var Action_name = map[int32]string{
@ -44,8 +46,10 @@ var Action_name = map[int32]string{
3: "CHANGE_CONFIG",
4: "ENABLE_RULE",
5: "DISABLE_RULE",
6: "LOG_LEVEL",
7: "STOP",
6: "DELETE_RULE",
7: "CHANGE_RULE",
8: "LOG_LEVEL",
9: "STOP",
}
var Action_value = map[string]int32{
@ -55,8 +59,10 @@ var Action_value = map[string]int32{
"CHANGE_CONFIG": 3,
"ENABLE_RULE": 4,
"DISABLE_RULE": 5,
"LOG_LEVEL": 6,
"STOP": 7,
"DELETE_RULE": 6,
"CHANGE_RULE": 7,
"LOG_LEVEL": 8,
"STOP": 9,
}
func (x Action) String() string {
@ -67,6 +73,31 @@ func (Action) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_63867a62624c1283, []int{0}
}
type NotificationReplyCode int32
const (
NotificationReplyCode_OK NotificationReplyCode = 0
NotificationReplyCode_ERROR NotificationReplyCode = 1
)
var NotificationReplyCode_name = map[int32]string{
0: "OK",
1: "ERROR",
}
var NotificationReplyCode_value = map[string]int32{
"OK": 0,
"ERROR": 1,
}
func (x NotificationReplyCode) String() string {
return proto.EnumName(NotificationReplyCode_name, int32(x))
}
func (NotificationReplyCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_63867a62624c1283, []int{1}
}
type Event struct {
Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
Connection *Connection `protobuf:"bytes,2,opt,name=connection,proto3" json:"connection,omitempty"`
@ -417,9 +448,10 @@ func (m *Operator) GetData() string {
type Rule struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
Duration string `protobuf:"bytes,3,opt,name=duration,proto3" json:"duration,omitempty"`
Operator *Operator `protobuf:"bytes,4,opt,name=operator,proto3" json:"operator,omitempty"`
Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`
Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
Duration string `protobuf:"bytes,4,opt,name=duration,proto3" json:"duration,omitempty"`
Operator *Operator `protobuf:"bytes,5,opt,name=operator,proto3" json:"operator,omitempty"`
}
func (m *Rule) Reset() { *m = Rule{} }
@ -436,6 +468,13 @@ func (m *Rule) GetName() string {
return ""
}
func (m *Rule) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func (m *Rule) GetAction() string {
if m != nil {
return m.Action
@ -457,12 +496,13 @@ func (m *Rule) GetOperator() *Operator {
return nil
}
// client configuration sent on Subscribe()
type ClientConfig struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
IsFirewallRunning bool `protobuf:"varint,4,opt,name=isFirewallRunning,proto3" json:"isFirewallRunning,omitempty"`
// json string
// daemon configuration as json string
Config string `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
LogLevel uint32 `protobuf:"varint,6,opt,name=logLevel,proto3" json:"logLevel,omitempty"`
Rules []*Rule `protobuf:"bytes,7,rep,name=rules,proto3" json:"rules,omitempty"`
@ -524,6 +564,7 @@ func (m *ClientConfig) GetRules() []*Rule {
return nil
}
// notification sent to the clients (daemons)
type Notification struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
ClientName string `protobuf:"bytes,2,opt,name=clientName,proto3" json:"clientName,omitempty"`
@ -583,8 +624,44 @@ func (m *Notification) GetRules() []*Rule {
return nil
}
// notification reply sent to the server (GUI)
type NotificationReply struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Code NotificationReplyCode `protobuf:"varint,2,opt,name=code,proto3,enum=protocol.NotificationReplyCode" json:"code,omitempty"`
Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *NotificationReply) Reset() { *m = NotificationReply{} }
func (m *NotificationReply) String() string { return proto.CompactTextString(m) }
func (*NotificationReply) ProtoMessage() {}
func (*NotificationReply) Descriptor() ([]byte, []int) {
return fileDescriptor_63867a62624c1283, []int{9}
}
func (m *NotificationReply) GetId() uint64 {
if m != nil {
return m.Id
}
return 0
}
func (m *NotificationReply) GetCode() NotificationReplyCode {
if m != nil {
return m.Code
}
return NotificationReplyCode_OK
}
func (m *NotificationReply) GetData() string {
if m != nil {
return m.Data
}
return ""
}
func init() {
proto.RegisterEnum("protocol.Action", Action_name, Action_value)
proto.RegisterEnum("protocol.NotificationReplyCode", NotificationReplyCode_name, NotificationReplyCode_value)
proto.RegisterType((*Event)(nil), "protocol.Event")
proto.RegisterType((*Statistics)(nil), "protocol.Statistics")
proto.RegisterType((*PingRequest)(nil), "protocol.PingRequest")
@ -594,6 +671,7 @@ func init() {
proto.RegisterType((*Rule)(nil), "protocol.Rule")
proto.RegisterType((*ClientConfig)(nil), "protocol.ClientConfig")
proto.RegisterType((*Notification)(nil), "protocol.Notification")
proto.RegisterType((*NotificationReply)(nil), "protocol.NotificationReply")
}
func init() {
@ -601,77 +679,83 @@ func init() {
}
var fileDescriptor_63867a62624c1283 = []byte{
// 1120 bytes of a gzipped FileDescriptorProto
// 1213 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 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0x1a, 0xb4, 0x4e, 0x26, 0xe4, 0x21,
0xb4, 0xe5, 0xa5, 0x48, 0xb6, 0xea, 0x1e, 0x35, 0xee, 0xdb, 0xed, 0x1b, 0xe7, 0xe1, 0x2c, 0x5e,
0xda, 0x6b, 0xe4, 0x5b, 0xe8, 0x8e, 0xf9, 0x7b, 0x3c, 0xb9, 0x97, 0xfe, 0x61, 0xdc, 0x3e, 0xf7,
0xf1, 0xec, 0x35, 0xf2, 0x3d, 0x98, 0xc7, 0x85, 0xcf, 0x83, 0x3c, 0xf2, 0x19, 0xb9, 0xd5, 0x10,
0x35, 0xce, 0xd8, 0xf6, 0x15, 0xb8, 0xbd, 0x46, 0x7e, 0x84, 0x41, 0xb3, 0x34, 0x4e, 0x6e, 0x7f,
0xe2, 0xa3, 0x36, 0xe3, 0x34, 0x49, 0x7b, 0x6d, 0x57, 0xfb, 0x46, 0xf3, 0x75, 0x24, 0x1f, 0xfc,
0x17, 0x00, 0x00, 0xff, 0xff, 0x75, 0x04, 0xb2, 0x3f, 0x31, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -688,6 +772,7 @@ const _ = grpc.SupportPackageIsVersion4
type UIClient interface {
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error)
AskRule(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*Rule, error)
Subscribe(ctx context.Context, in *ClientConfig, opts ...grpc.CallOption) (*ClientConfig, error)
Notifications(ctx context.Context, opts ...grpc.CallOption) (UI_NotificationsClient, error)
}
@ -717,6 +802,15 @@ func (c *uIClient) AskRule(ctx context.Context, in *Connection, opts ...grpc.Cal
return out, nil
}
func (c *uIClient) Subscribe(ctx context.Context, in *ClientConfig, opts ...grpc.CallOption) (*ClientConfig, error) {
out := new(ClientConfig)
err := c.cc.Invoke(ctx, "/protocol.UI/Subscribe", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *uIClient) Notifications(ctx context.Context, opts ...grpc.CallOption) (UI_NotificationsClient, error) {
stream, err := c.cc.NewStream(ctx, &_UI_serviceDesc.Streams[0], "/protocol.UI/Notifications", opts...)
if err != nil {
@ -727,7 +821,7 @@ func (c *uIClient) Notifications(ctx context.Context, opts ...grpc.CallOption) (
}
type UI_NotificationsClient interface {
Send(*ClientConfig) error
Send(*NotificationReply) error
Recv() (*Notification, error)
grpc.ClientStream
}
@ -736,7 +830,7 @@ type uINotificationsClient struct {
grpc.ClientStream
}
func (x *uINotificationsClient) Send(m *ClientConfig) error {
func (x *uINotificationsClient) Send(m *NotificationReply) error {
return x.ClientStream.SendMsg(m)
}
@ -752,6 +846,7 @@ func (x *uINotificationsClient) Recv() (*Notification, error) {
type UIServer interface {
Ping(context.Context, *PingRequest) (*PingReply, error)
AskRule(context.Context, *Connection) (*Rule, error)
Subscribe(context.Context, *ClientConfig) (*ClientConfig, error)
Notifications(UI_NotificationsServer) error
}
@ -765,6 +860,9 @@ func (*UnimplementedUIServer) Ping(ctx context.Context, req *PingRequest) (*Ping
func (*UnimplementedUIServer) AskRule(ctx context.Context, req *Connection) (*Rule, error) {
return nil, status.Errorf(codes.Unimplemented, "method AskRule not implemented")
}
func (*UnimplementedUIServer) Subscribe(ctx context.Context, req *ClientConfig) (*ClientConfig, error) {
return nil, status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func (*UnimplementedUIServer) Notifications(srv UI_NotificationsServer) error {
return status.Errorf(codes.Unimplemented, "method Notifications not implemented")
}
@ -809,13 +907,31 @@ func _UI_AskRule_Handler(srv interface{}, ctx context.Context, dec func(interfac
return interceptor(ctx, in, info, handler)
}
func _UI_Subscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClientConfig)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UIServer).Subscribe(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/protocol.UI/Subscribe",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UIServer).Subscribe(ctx, req.(*ClientConfig))
}
return interceptor(ctx, in, info, handler)
}
func _UI_Notifications_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(UIServer).Notifications(&uINotificationsServer{stream})
}
type UI_NotificationsServer interface {
Send(*Notification) error
Recv() (*ClientConfig, error)
Recv() (*NotificationReply, error)
grpc.ServerStream
}
@ -827,8 +943,8 @@ func (x *uINotificationsServer) Send(m *Notification) error {
return x.ServerStream.SendMsg(m)
}
func (x *uINotificationsServer) Recv() (*ClientConfig, error) {
m := new(ClientConfig)
func (x *uINotificationsServer) Recv() (*NotificationReply, error) {
m := new(NotificationReply)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
@ -847,6 +963,10 @@ var _UI_serviceDesc = grpc.ServiceDesc{
MethodName: "AskRule",
Handler: _UI_AskRule_Handler,
},
{
MethodName: "Subscribe",
Handler: _UI_Subscribe_Handler,
},
},
Streams: []grpc.StreamDesc{
{

View file

@ -5,7 +5,8 @@ package protocol;
service UI {
rpc Ping(PingRequest) returns (PingReply) {}
rpc AskRule (Connection) returns (Rule) {}
rpc Notifications (stream ClientConfig) returns (stream Notification) {}
rpc Subscribe (ClientConfig) returns (ClientConfig) {}
rpc Notifications (stream NotificationReply) returns (stream Notification) {}
}
message Event {
@ -64,9 +65,10 @@ message Operator {
message Rule {
string name = 1;
string action = 2;
string duration = 3;
Operator operator = 4;
bool enabled = 2;
string action = 3;
string duration = 4;
Operator operator = 5;
}
enum Action {
@ -76,10 +78,13 @@ enum Action {
CHANGE_CONFIG = 3;
ENABLE_RULE = 4;
DISABLE_RULE = 5;
LOG_LEVEL = 6;
STOP = 7;
DELETE_RULE = 6;
CHANGE_RULE = 7;
LOG_LEVEL = 8;
STOP = 9;
}
// client configuration sent on Subscribe()
message ClientConfig {
uint64 id = 1;
string name = 2;
@ -91,6 +96,7 @@ message ClientConfig {
repeated Rule rules = 7;
}
// notification sent to the clients (daemons)
message Notification {
uint64 id = 1;
string clientName = 2;
@ -100,3 +106,15 @@ message Notification {
string data = 5;
repeated Rule rules = 6;
}
// notification reply sent to the server (GUI)
message NotificationReply {
uint64 id = 1;
NotificationReplyCode code = 2;
string data = 3;
}
enum NotificationReplyCode {
OK = 0;
ERROR = 1;
}