diff --git a/common/bashout.go b/common/bashout.go index 3a0f13b..5759ca6 100644 --- a/common/bashout.go +++ b/common/bashout.go @@ -4,7 +4,10 @@ package common // P4wnP1 or startup scripts) import ( + "bufio" + "bytes" "fmt" + "os" "os/exec" ) @@ -13,7 +16,15 @@ type LogWriter struct { } func (lw LogWriter) Write(p []byte) (n int, err error) { - fmt.Printf("%s: %s\n", lw.Prefix, string(p)) + //fmt.Printf("%s: %s", lw.Prefix, string(p)) + + lineScanner := bufio.NewScanner(bytes.NewReader(p)) + lineScanner.Split(bufio.ScanLines) + for lineScanner.Scan() { + fmt.Printf("%s: %s\n", lw.Prefix, string(lineScanner.Bytes())) + } + + return len(p),nil } @@ -27,3 +38,15 @@ func RunBashScript(scriptPath string) (err error) { if err != nil { return } return cmd.Wait() } + +func RunBashScriptEnv(scriptPath string, env ...string) (err error) { + cmd := exec.Command("/bin/bash", scriptPath) + cmd.Env = append(os.Environ(), env...) // keep os environment and append additional env + wStdout := LogWriter{scriptPath} + wStderr := LogWriter{scriptPath + " error"} + cmd.Stdout = wStdout + cmd.Stderr = wStderr + err = cmd.Start() + if err != nil { return } + return cmd.Wait() +} diff --git a/desktest.go b/desktest.go new file mode 100644 index 0000000..85295b0 --- /dev/null +++ b/desktest.go @@ -0,0 +1,131 @@ +package main + +import ( + "fmt" + "github.com/mame82/P4wnP1_go/common_web" + pb "github.com/mame82/P4wnP1_go/proto" + "github.com/mame82/P4wnP1_go/service" + "log" + "os" + "os/signal" + "syscall" + "time" +) + +/* + +#!/bin/bash +# /tmp/test.sh +echo "Bash DHCP Lease" +echo "Interface: $DHCP_LEASE_IFACE" +echo "Mac: $DHCP_LEASE_MAC" +echo "IP: $DHCP_LEASE_IP" + + +#!/bin/bash +# /tmp/test1.sh +echo "Bash SSH Login" +echo "Interface: $SSH_LOGIN_USER" + + */ + +func main() { + pseudoService := &service.Service{ + SubSysEvent: service.NewEventManager(10), + } + tam := service.NewTriggerActionManager(pseudoService) + + pseudoService.SubSysEvent.Start() + tam.Start() + + // create test trigger + serviceUpRunScript := &pb.TriggerAction{ + Trigger: &pb.TriggerAction_ServiceStarted{ + ServiceStarted: &pb.TriggerServiceStarted{}, + }, + Action: &pb.TriggerAction_BashScript{ + BashScript: &pb.ActionStartBashScript{ + ScriptPath: "/usr/local/P4wnP1/scripts/servicestart1.sh", + }, + }, + } + dhcpLeaseScript := &pb.TriggerAction{ + Trigger: &pb.TriggerAction_DhcpLeaseGranted{ + DhcpLeaseGranted: &pb.TriggerDHCPLeaseGranted{}, + }, + Action: &pb.TriggerAction_BashScript{ + BashScript: &pb.ActionStartBashScript{ + ScriptPath: "/tmp/test.sh", + }, + }, + } + sshLoginScript := &pb.TriggerAction{ + OneShot: true, + Trigger: &pb.TriggerAction_SshLogin{ + SshLogin: &pb.TriggerSSHLogin{}, + }, + Action: &pb.TriggerAction_BashScript{ + BashScript: &pb.ActionStartBashScript{ + ScriptPath: "/tmp/test1.sh", + }, + }, + } + serviceUpLog := &pb.TriggerAction{ + Trigger: &pb.TriggerAction_ServiceStarted{ + ServiceStarted: &pb.TriggerServiceStarted{}, + }, + Action: &pb.TriggerAction_Log{ + Log: &pb.ActionLog{}, + }, + } + tam.AddTriggerAction(serviceUpRunScript) + tam.AddTriggerAction(serviceUpLog) + tam.AddTriggerAction(dhcpLeaseScript) + tam.AddTriggerAction(sshLoginScript) + + /* + // Pause TriggerActionManager after 5 seconds for 5 seconds + go func() { + time.Sleep(time.Second * 5) + tam.Stop() + time.Sleep(time.Second * 5) + tam.Start() + }() + */ + + go func() { + for { + pseudoService.SubSysEvent.Emit(service.ConstructEventTriggerDHCPLease("wlan0", "aa:bb:cc:dd:ee:ff", "172.24.0.6")) + time.Sleep(1800*time.Millisecond) + } + }() + + go func() { + time.Sleep(time.Second) + for { + pseudoService.SubSysEvent.Emit(service.ConstructEventTriggerSSHLogin("testuser")) + time.Sleep(5*time.Second) + } + + }() + + go func() { + time.Sleep(2*time.Second) + for { + pseudoService.SubSysEvent.Emit(service.ConstructEventTrigger(common_web.EVT_TRIGGER_TYPE_SERVICE_STARTED)) + time.Sleep(5*time.Second) + } + + }() + + //use a channel to wait for SIGTERM or SIGINT + fmt.Println("P4wnP1 service initialized, stop with SIGTERM or SIGINT") + sig := make(chan os.Signal) + signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM) + si := <-sig + log.Printf("Signal (%v) received, ending P4wnP1_service ...\n", si) + pseudoService.SubSysEvent.Stop() + tam.Stop() + return + +} diff --git a/proto/gopherjs/grpc.pb.gopherjs.go b/proto/gopherjs/grpc.pb.gopherjs.go index e2b1762..be8be18 100644 --- a/proto/gopherjs/grpc.pb.gopherjs.go +++ b/proto/gopherjs/grpc.pb.gopherjs.go @@ -262,7 +262,8 @@ func (m *TriggerActionSettings) Unmarshal(rawBytes []byte) (*TriggerActionSettin } type TriggerAction struct { - Id uint32 + Id uint32 + OneShot bool // Types that are valid to be assigned to Trigger: // *TriggerAction_ServiceStarted // *TriggerAction_UsbGadgetConnected @@ -377,6 +378,14 @@ func (m *TriggerAction) GetId() (x uint32) { return m.Id } +// GetOneShot gets the OneShot of the TriggerAction. +func (m *TriggerAction) GetOneShot() (x bool) { + if m == nil { + return x + } + return m.OneShot +} + // GetServiceStarted gets the ServiceStarted of the TriggerAction. func (m *TriggerAction) GetServiceStarted() (x *TriggerServiceStarted) { if v, ok := m.GetTrigger().(*TriggerAction_ServiceStarted); ok { @@ -547,6 +556,10 @@ func (m *TriggerAction) MarshalToWriter(writer jspb.Writer) { writer.WriteUint32(1, m.Id) } + if m.OneShot { + writer.WriteBool(13, m.OneShot) + } + return } @@ -567,6 +580,8 @@ func (m *TriggerAction) UnmarshalFromReader(reader jspb.Reader) *TriggerAction { switch reader.GetFieldNumber() { case 1: m.Id = reader.ReadUint32() + case 13: + m.OneShot = reader.ReadBool() case 2: reader.ReadMessage(func() { m.Trigger = &TriggerAction_ServiceStarted{ diff --git a/proto/grpc.pb.go b/proto/grpc.pb.go index e18bc3c..b08eade 100644 --- a/proto/grpc.pb.go +++ b/proto/grpc.pb.go @@ -228,7 +228,8 @@ func (m *TriggerActionSettings) GetRegisteredTriggerActions() []*TriggerAction { } type TriggerAction struct { - Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + OneShot bool `protobuf:"varint,13,opt,name=oneShot" json:"oneShot,omitempty"` // Types that are valid to be assigned to Trigger: // *TriggerAction_ServiceStarted // *TriggerAction_UsbGadgetConnected @@ -324,6 +325,13 @@ func (m *TriggerAction) GetId() uint32 { return 0 } +func (m *TriggerAction) GetOneShot() bool { + if m != nil { + return m.OneShot + } + return false +} + func (m *TriggerAction) GetServiceStarted() *TriggerServiceStarted { if x, ok := m.GetTrigger().(*TriggerAction_ServiceStarted); ok { return x.ServiceStarted @@ -3128,188 +3136,189 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("grpc.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 2918 bytes of a gzipped FileDescriptorProto + // 2934 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x5a, 0x5b, 0x77, 0xdb, 0xc6, 0xf1, 0x27, 0x45, 0x4a, 0x22, 0x87, 0xa2, 0x04, 0x6d, 0x2c, 0x99, 0x56, 0x1c, 0x5f, 0xf6, 0xef, 0x24, 0xfe, 0x3b, 0x3d, 0x6a, 0xe2, 0x3a, 0x6e, 0x8e, 0x4f, 0x7b, 0x12, 0x5e, 0x45, 0xda, 0xbc, 0x9d, 0x05, 0x69, 0xf5, 0xf2, 0xc0, 0x40, 0xc0, 0x8a, 0x44, 0x4d, 0x02, 0x2c, 0x76, 0x29, 0x47, - 0x7d, 0xc8, 0x43, 0xfb, 0xde, 0xd7, 0x7e, 0x82, 0xbe, 0xf6, 0x33, 0xf5, 0xa5, 0x9f, 0xa3, 0x3d, - 0xbb, 0xb8, 0x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12, 0xea, 0x40, 0xf9, 0xbd, 0x79, - 0x69, 0x56, 0x87, 0xbe, 0x25, 0xb6, 0x25, 0xf4, 0xe3, 0x24, 0xe8, 0xf3, 0x30, 0x63, 0x3b, 0x43, - 0xa2, 0x92, 0xc2, 0x0e, 0x82, 0x10, 0xa8, 0x5f, 0x65, 0x2a, 0xd7, 0x2a, 0x3b, 0xe9, 0x76, 0x38, - 0xbf, 0xc1, 0x2d, 0xec, 0x70, 0x13, 0x03, 0xbd, 0x82, 0x02, 0x63, 0xb3, 0xae, 0x3d, 0x35, 0xad, - 0xca, 0xae, 0xc4, 0xbb, 0x9f, 0x78, 0x52, 0x6a, 0x5b, 0xf2, 0xb4, 0x33, 0x24, 0xe0, 0x47, 0x04, - 0x14, 0x63, 0xa6, 0x2f, 0xbb, 0x54, 0x63, 0xf4, 0xcc, 0xd1, 0x2c, 0xb1, 0xc7, 0x82, 0xc4, 0x78, - 0x92, 0x84, 0xd1, 0x68, 0xd7, 0x87, 0x61, 0xde, 0x76, 0x86, 0xdc, 0x90, 0x47, 0x0d, 0x80, 0x0b, - 0x8d, 0xcd, 0x54, 0xdd, 0x31, 0x97, 0xbc, 0x52, 0x4c, 0xf0, 0x1d, 0xcf, 0xd5, 0x85, 0x65, 0x6a, - 0x01, 0x67, 0x3b, 0x4b, 0x42, 0x72, 0xa8, 0x0a, 0xc5, 0x99, 0x69, 0x78, 0x20, 0x90, 0x60, 0xf6, - 0x10, 0x48, 0xbb, 0xd3, 0x08, 0x30, 0xd6, 0x52, 0x48, 0x87, 0x63, 0x83, 0x2e, 0xe7, 0xf6, 0xb5, - 0x7f, 0xa9, 0x46, 0x74, 0xb1, 0x9c, 0x6b, 0x9c, 0x56, 0x4a, 0x09, 0x1e, 0xe2, 0xe2, 0x35, 0x12, - 0x05, 0xda, 0x59, 0x92, 0x02, 0x85, 0x9e, 0x41, 0x6e, 0x6e, 0x4f, 0x2b, 0x7b, 0x12, 0xf1, 0x38, - 0x01, 0xb1, 0x6b,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, 0xa8, 0x6a, 0xa7, 0xe1, 0xfb, 0x91, 0x18, 0x23, 0x05, 0x72, - 0x43, 0xf5, 0x8d, 0x17, 0x84, 0xc4, 0x10, 0x3f, 0x86, 0xb2, 0xca, 0x1d, 0x71, 0xd4, 0x94, 0x31, - 0xe1, 0xea, 0x0a, 0xe4, 0x16, 0x6c, 0xea, 0x49, 0x89, 0x21, 0xfe, 0x12, 0x50, 0x84, 0xa5, 0xea, - 0x38, 0xda, 0xb5, 0x70, 0xc9, 0x05, 0x9b, 0xca, 0xb1, 0x7c, 0xc1, 0x15, 0x49, 0x30, 0xc7, 0xa7, - 0xb0, 0xd7, 0xbc, 0xa2, 0x16, 0xf7, 0x6e, 0x93, 0x70, 0x51, 0x71, 0x68, 0xd4, 0x12, 0x37, 0x57, - 0x42, 0xe7, 0x48, 0x88, 0x82, 0x35, 0x00, 0xc9, 0xff, 0x56, 0x9b, 0xaf, 0x84, 0xb3, 0xef, 0x72, - 0x26, 0x17, 0x74, 0xb5, 0x68, 0x67, 0x88, 0x4f, 0x40, 0xc7, 0xb0, 0xcd, 0x2f, 0x6c, 0xdb, 0xb5, - 0x69, 0xa1, 0x9d, 0x21, 0xee, 0x14, 0x55, 0x60, 0x87, 0x9b, 0x16, 0x7f, 0xf9, 0x42, 0x5a, 0x35, - 0xd7, 0xce, 0x10, 0x6f, 0x5e, 0xdb, 0x86, 0xdc, 0x95, 0x36, 0xc7, 0x5d, 0xd8, 0x96, 0x4b, 0x08, - 0xb3, 0xf0, 0xb5, 0x16, 0x72, 0x8c, 0x7e, 0x0e, 0x3b, 0x57, 0x62, 0x69, 0x71, 0x71, 0x6f, 0xba, - 0xd5, 0x5a, 0x35, 0xe2, 0xb1, 0xe1, 0xef, 0xe1, 0x8e, 0xb8, 0xfb, 0x0d, 0xd3, 0x19, 0x38, 0x2d, - 0x73, 0x4e, 0xfd, 0x8d, 0x2a, 0x90, 0x33, 0x4c, 0x3f, 0x8f, 0x88, 0xa1, 0x70, 0xae, 0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0xae, 0x3d, 0x35, + 0xad, 0xca, 0xae, 0xc4, 0xbb, 0x9f, 0x78, 0x52, 0x6a, 0x5b, 0xf2, 0xb4, 0x33, 0x24, 0xe0, 0x47, + 0x04, 0x14, 0x63, 0xa6, 0x2f, 0xbb, 0x54, 0x63, 0xf4, 0xcc, 0xd1, 0x2c, 0xb1, 0xc7, 0x82, 0xc4, + 0x78, 0x92, 0x84, 0xd1, 0x68, 0xd7, 0x87, 0x61, 0xde, 0x76, 0x86, 0xdc, 0x90, 0x47, 0x0d, 0x80, + 0x0b, 0x8d, 0xcd, 0x54, 0xdd, 0x31, 0x97, 0xbc, 0x52, 0x4c, 0xf0, 0x1d, 0xef, 0x12, 0x08, 0xcb, + 0xd4, 0x02, 0xce, 0x76, 0x96, 0x84, 0xe4, 0x50, 0x15, 0x8a, 0x33, 0xd3, 0xf0, 0x40, 0x20, 0xc1, + 0xec, 0x21, 0x90, 0x76, 0xa7, 0x11, 0x60, 0xac, 0xa5, 0x90, 0x0e, 0xc7, 0x06, 0x5d, 0xce, 0xed, + 0x6b, 0xff, 0xba, 0x8d, 0xe8, 0x62, 0x39, 0xd7, 0x38, 0xad, 0x94, 0x12, 0x3c, 0xc4, 0xc5, 0x6b, + 0x24, 0x0a, 0xb4, 0xb3, 0x24, 0x05, 0x0a, 0x3d, 0x83, 0xdc, 0xdc, 0x9e, 0x56, 0xf6, 0x24, 0xe2, + 0x71, 0x02, 0x62, 0xd7, 0x9e, 0xb6, 0xb3, 0x44, 0x30, 0xd5, 0x8a, 0xb0, 0xeb, 0x19, 0xb2, 0x56, + 0x80, 0x1d, 0xf7, 0x33, 0xbe, 0x1b, 0xc4, 0x86, 0xe8, 0x5d, 0xc2, 0x65, 0x28, 0x79, 0x1f, 0xce, + 0x86, 0x9d, 0x01, 0xfe, 0x18, 0xee, 0xa5, 0xde, 0x10, 0xfc, 0x00, 0xee, 0x6f, 0xf2, 0x70, 0x7c, + 0x0c, 0x77, 0x92, 0xdc, 0x34, 0x04,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 0xf3, 0xd3, 0x40, 0xd3, 0xf7, 0xdd, 0x83, 0x7b, 0x12, 0xcb, 0x4f, 0x18, 0x1f, 0x0c, + 0x99, 0xbc, 0xe5, 0x81, 0x7b, 0x1c, 0x09, 0xea, 0x25, 0x1d, 0xc7, 0xc3, 0x74, 0x7c, 0xb7, 0x6d, + 0x9d, 0xb9, 0xd8, 0x91, 0xff, 0x76, 0xf8, 0xc5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x27, 0xe0, + 0xf5, 0x82, 0xfb, 0x20, 0x00, 0x00, } diff --git a/proto/grpc.proto b/proto/grpc.proto index 9d9bb66..018183f 100644 --- a/proto/grpc.proto +++ b/proto/grpc.proto @@ -57,6 +57,7 @@ message TriggerActionSettings { message TriggerAction { uint32 id = 1; // assigned by service, used as identifier to allow deletion of trigger actions + bool oneShot = 13; oneof Trigger { TriggerServiceStarted serviceStarted = 2; TriggerUSBGadgetConnected usbGadgetConnected = 3; diff --git a/service/Event.go b/service/Event.go index 552713c..231bcd4 100644 --- a/service/Event.go +++ b/service/Event.go @@ -177,6 +177,28 @@ func ConstructEventTrigger(triggerType common_web.EvtTriggerType) *pb.Event { } } +func ConstructEventTriggerDHCPLease(iface, mac, ip string) *pb.Event { + return &pb.Event{ + Type: common_web.EVT_TRIGGER, + Values: []*pb.EventValue{ + {Val: &pb.EventValue_Tint64{Tint64: int64(common_web.EVT_TRIGGER_TYPE_DHCP_LEASE_GRANTED)}}, + {Val: &pb.EventValue_Tstring{Tstring: iface}}, + {Val: &pb.EventValue_Tstring{Tstring: mac}}, + {Val: &pb.EventValue_Tstring{Tstring: ip}}, + }, + } +} + +func ConstructEventTriggerSSHLogin(username string) *pb.Event { + return &pb.Event{ + Type: common_web.EVT_TRIGGER, + Values: []*pb.EventValue{ + {Val: &pb.EventValue_Tint64{Tint64: int64(common_web.EVT_TRIGGER_TYPE_SSH_LOGIN)}}, + {Val: &pb.EventValue_Tstring{Tstring: username}}, + }, + } +} + func ConstructEventHID(hidEvent hid.Event) *pb.Event { //subType, vmID, jobID int, error bool, resString, errString, message string vmID := -1 diff --git a/service/triggerAction.go b/service/triggerAction.go index 25d5765..f7af172 100644 --- a/service/triggerAction.go +++ b/service/triggerAction.go @@ -2,6 +2,7 @@ package service import ( "fmt" + "github.com/mame82/P4wnP1_go/common" "github.com/mame82/P4wnP1_go/common_web" pb "github.com/mame82/P4wnP1_go/proto" "sync" @@ -13,6 +14,7 @@ type TriggerActionManager struct { registeredTriggerActionMutex *sync.Mutex registeredTriggerAction []*pb.TriggerAction + nextID uint32 } @@ -28,7 +30,7 @@ func (tam *TriggerActionManager) processing_loop() { if evt == nil { break Outer // abort loop on "nil" event, as this indicates the EventQueue channel has been closed } - fmt.Println("TriggerActionManager received unfiltered event", evt) + //fmt.Println("TriggerActionManager received unfiltered event", evt) tam.dispatchTriggerEvent(evt) // check if relevant and dispatch to triggers case <- tam.evtRcv.Ctx.Done(): @@ -39,93 +41,225 @@ func (tam *TriggerActionManager) processing_loop() { fmt.Println("TAM processing loop finished") } -func (tam *TriggerActionManager) dispatchTriggerEvent(evt *pb.Event) { - if evt.Type != common_web.EVT_TRIGGER { return } - - triggerTypeRcv := common_web.EvtTriggerType(evt.Values[0].GetTint64()) - - tam.registeredTriggerActionMutex.Lock() - defer tam.registeredTriggerActionMutex.Unlock() - for _,ta := range tam.registeredTriggerAction { - switch triggerType := ta.Trigger.(type) { - case *pb.TriggerAction_ServiceStarted: - if triggerTypeRcv == common_web.EVT_TRIGGER_TYPE_SERVICE_STARTED { - // trigger action of ta - tam.fireAction(ta.Trigger, ta.Action) - } - case *pb.TriggerAction_UsbGadgetConnected: - if triggerTypeRcv == common_web.EVT_TRIGGER_TYPE_USB_GADGET_CONNECTED { - // trigger action of ta - tam.fireAction(triggerType.UsbGadgetConnected, ta.Action) - } - case *pb.TriggerAction_UsbGadgetDisconnected: - if triggerTypeRcv == common_web.EVT_TRIGGER_TYPE_USB_GADGET_DISCONNECTED { - // trigger action of ta - tam.fireAction(triggerType.UsbGadgetDisconnected, ta.Action) - } - case *pb.TriggerAction_DhcpLeaseGranted: - if triggerTypeRcv == common_web.EVT_TRIGGER_TYPE_USB_GADGET_DISCONNECTED { - // trigger action of ta - tam.fireAction(triggerType.DhcpLeaseGranted, ta.Action) - } - } - } -} - -func (tam *TriggerActionManager) fireAction(trigger interface{}, action interface{}) (err error ) { - switch actionType := action.(type) { +func (tam *TriggerActionManager) fireActionNoArgs(ta *pb.TriggerAction) (err error ) { + switch actionType := ta.Action.(type) { case *pb.TriggerAction_BashScript: bs := actionType.BashScript + go common.RunBashScriptEnv(bs.ScriptPath) fmt.Printf("Fire bash script '%s'\n", bs.ScriptPath) case *pb.TriggerAction_HidScript: + // ToDo: Implement hs := actionType.HidScript - fmt.Printf("Starting HID script '%s'\n", hs.ScriptName) + fmt.Printf("Placeholder: Starting HID script '%s'\n", hs.ScriptName) case *pb.TriggerAction_DeploySettingsTemplate: + // ToDo: Implement st := actionType.DeploySettingsTemplate strType := pb.ActionDeploySettingsTemplate_TemplateType_name[int32(st.Type)] - fmt.Printf("Deploy settings template of type [%s] with name '%s'\n", strType, st.TemplateName) + fmt.Printf("Placeholder: Deploy settings template of type [%s] with name '%s'\n", strType, st.TemplateName) case *pb.TriggerAction_Log: - fmt.Printf("Logging trigger '%+v'\n", trigger) + fmt.Printf("Logging trigger '%+v'\n", ta.Trigger) } return nil } + +func (tam *TriggerActionManager) fireActionServiceStarted(ta *pb.TriggerAction) error { + return tam.fireActionNoArgs(ta) +} + +func (tam *TriggerActionManager) fireActionSSHLogin(loginUser string, ta *pb.TriggerAction) error { + switch actionType := ta.Action.(type) { + case *pb.TriggerAction_BashScript: + bs := actionType.BashScript + envUser := fmt.Sprintf("SSH_LOGIN_USER=%s", loginUser) + go common.RunBashScriptEnv(bs.ScriptPath, envUser) + //go common.RunBashScript(bs.ScriptPath) + fmt.Printf("Started bash script '%s' (%s)\n", bs.ScriptPath, envUser) + case *pb.TriggerAction_HidScript: + // ToDo: Implement + hs := actionType.HidScript + fmt.Printf("Placeholder: Starting HID script '%s'\n", hs.ScriptName) + case *pb.TriggerAction_DeploySettingsTemplate: + // ToDo: Implement + st := actionType.DeploySettingsTemplate + strType := pb.ActionDeploySettingsTemplate_TemplateType_name[int32(st.Type)] + fmt.Printf("Placeholder: Deploy settings template of type [%s] with name '%s'\n", strType, st.TemplateName) + case *pb.TriggerAction_Log: + fmt.Printf("Logging action: SSHLogin user: '%s'\n", loginUser) + } + return nil +} + +func (tam *TriggerActionManager) fireActionWifiConnectedAsSta(ta *pb.TriggerAction) error { + return tam.fireActionNoArgs(ta) +} + +func (tam *TriggerActionManager) fireActionWifiApStarted(ta *pb.TriggerAction) error { + return tam.fireActionNoArgs(ta) +} + +func (tam *TriggerActionManager) fireActionDhcpLeaseGranted(iface string, mac string, ip string, ta *pb.TriggerAction) error { + switch actionType := ta.Action.(type) { + case *pb.TriggerAction_BashScript: + bs := actionType.BashScript + envIface := fmt.Sprintf("DHCP_LEASE_IFACE=%s", iface) + envMac := fmt.Sprintf("DHCP_LEASE_MAC=%s", mac) + envIp := fmt.Sprintf("DHCP_LEASE_IP=%s", ip) + go common.RunBashScriptEnv(bs.ScriptPath, envIface, envMac, envIp) + //go common.RunBashScript(bs.ScriptPath) + fmt.Printf("Started bash script '%s' (%s, %s, %s)\n", bs.ScriptPath, envIface, envMac, envIp) + case *pb.TriggerAction_HidScript: + // ToDo: Implement + hs := actionType.HidScript + fmt.Printf("Placeholder: Starting HID script '%s'\n", hs.ScriptName) + case *pb.TriggerAction_DeploySettingsTemplate: + // ToDo: Implement + st := actionType.DeploySettingsTemplate + strType := pb.ActionDeploySettingsTemplate_TemplateType_name[int32(st.Type)] + fmt.Printf("Placeholder: Deploy settings template of type [%s] with name '%s'\n", strType, st.TemplateName) + case *pb.TriggerAction_Log: + fmt.Printf("Logging action: DHCPLeaseGranted interface: '%s' mac:'%s' IP: '%s'\n", iface, mac, ip) + } + return nil +} + +func (tam *TriggerActionManager) fireActionUsbGadgetConnected(ta *pb.TriggerAction) error { + return tam.fireActionNoArgs(ta) +} + +func (tam *TriggerActionManager) fireActionUsbGadgetDisconnected(ta *pb.TriggerAction) error { + return tam.fireActionNoArgs(ta) +} + +// checks if the triggerType of the given event (if trigger event at all), matches the TriggerType of the TriggerAction +func taTriggerTypeMatchesEvtTriggerType(ta *pb.TriggerAction, evt *pb.Event) bool { + if evt.Type != common_web.EVT_TRIGGER { return false } + triggerTypeEvt := common_web.EvtTriggerType(evt.Values[0].GetTint64()) + switch triggerTypeEvt { + case common_web.EVT_TRIGGER_TYPE_SERVICE_STARTED: + if _,match := ta.Trigger.(*pb.TriggerAction_ServiceStarted); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_DHCP_LEASE_GRANTED: + if _,match := ta.Trigger.(*pb.TriggerAction_DhcpLeaseGranted); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_WIFI_AP_STARTED: + if _,match := ta.Trigger.(*pb.TriggerAction_WifiAPStarted); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_WIFI_CONNECTED_AS_STA: + if _,match := ta.Trigger.(*pb.TriggerAction_WifiConnectedAsSta); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_USB_GADGET_CONNECTED: + if _,match := ta.Trigger.(*pb.TriggerAction_UsbGadgetConnected); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_USB_GADGET_DISCONNECTED: + if _,match := ta.Trigger.(*pb.TriggerAction_UsbGadgetDisconnected); match { + return true + } else { + return false + } + case common_web.EVT_TRIGGER_TYPE_SSH_LOGIN: + if _,match := ta.Trigger.(*pb.TriggerAction_SshLogin); match { + return true + } else { + return false + } + default: + return false + } +} + +func (tam *TriggerActionManager) dispatchTriggerEvent(evt *pb.Event) { + //fmt.Printf("Remaining triggerActions: %+v\n", tam.registeredTriggerAction) + //fmt.Printf("Received event: %+v\n", evt) + tam.registeredTriggerActionMutex.Lock() + defer tam.registeredTriggerActionMutex.Unlock() + markedForRemoval := []int{} + for idx,ta := range tam.registeredTriggerAction { + // ToDo: handle errors of fireAction* methods + if taTriggerTypeMatchesEvtTriggerType(ta, evt) { + switch ttEvt := common_web.EvtTriggerType(evt.Values[0].GetTint64()); ttEvt { + case common_web.EVT_TRIGGER_TYPE_SERVICE_STARTED: + tam.fireActionServiceStarted(ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_SSH_LOGIN: + loginUser := evt.Values[1].GetTstring() + tam.fireActionSSHLogin(loginUser, ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_WIFI_CONNECTED_AS_STA: + tam.fireActionWifiConnectedAsSta(ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_WIFI_AP_STARTED: + tam.fireActionWifiApStarted(ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_DHCP_LEASE_GRANTED: + // extract iface, mac and ip from event + iface := evt.Values[1].GetTstring() + mac := evt.Values[2].GetTstring() + ip := evt.Values[3].GetTstring() + tam.fireActionDhcpLeaseGranted(iface, mac, ip, ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_USB_GADGET_CONNECTED: + tam.fireActionUsbGadgetConnected(ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + case common_web.EVT_TRIGGER_TYPE_USB_GADGET_DISCONNECTED: + tam.fireActionUsbGadgetDisconnected(ta) + if ta.OneShot { + markedForRemoval = append(markedForRemoval,idx) + } + default: + fmt.Println("unhandled trigger: ", ttEvt) + } + } + } + + //fmt.Println("Indexes of TriggerActions to remove, because thy are OneShots and have fired", markedForRemoval) + for _,delIdx := range markedForRemoval { + // doesn't preserve order + tam.registeredTriggerAction[delIdx] = tam.registeredTriggerAction[len(tam.registeredTriggerAction)-1] + tam.registeredTriggerAction = tam.registeredTriggerAction[:len(tam.registeredTriggerAction)-1] + } + return +} + + func (tam *TriggerActionManager) AddTriggerAction(ta *pb.TriggerAction) (err error) { tam.registeredTriggerActionMutex.Lock() defer tam.registeredTriggerActionMutex.Unlock() ta.Id = tam.nextID tam.nextID++ tam.registeredTriggerAction = append(tam.registeredTriggerAction, ta) + return nil } func (tam *TriggerActionManager) Start() { - - - - // create test trigger - serviceUpRunScript := &pb.TriggerAction{ - Trigger: &pb.TriggerAction_ServiceStarted{ - ServiceStarted: &pb.TriggerServiceStarted{}, - }, - Action: &pb.TriggerAction_BashScript{ - BashScript: &pb.ActionStartBashScript{ - ScriptPath: "/usr/local/P4wnP1/scripts/servicestart.sh", - }, - }, - } - serviceUpLog := &pb.TriggerAction{ - Trigger: &pb.TriggerAction_ServiceStarted{ - ServiceStarted: &pb.TriggerServiceStarted{}, - }, - Action: &pb.TriggerAction_Log{ - Log: &pb.ActionLog{}, - }, - } - tam.AddTriggerAction(serviceUpRunScript) - tam.AddTriggerAction(serviceUpLog) - - fmt.Printf("TEST TRIGGER ACTION: Service up %+v\n", serviceUpRunScript) go tam.processing_loop() } @@ -139,6 +273,7 @@ func NewTriggerActionManager(rootService *Service) (tam *TriggerActionManager) { registeredTriggerActionMutex: &sync.Mutex{}, rootSvc: rootService, } + return tam }