-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (33 loc) · 933 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"flag"
"log"
"time"
"github.com/burdzwastaken/osquery-s3-config/pkg/s3"
osquery "github.com/osquery/osquery-go"
)
func main() {
var (
flSocketPath = flag.String("socket", "", "")
flTimeout = flag.Int("timeout", 0, "")
_ = flag.Int("interval", 0, "")
_ = flag.Bool("verbose", false, "")
)
flag.Parse()
// allow for osqueryd to create the socket path
time.Sleep(2 * time.Second)
// create an extension server
server, err := osquery.NewExtensionManagerServer(
"com.burdzwastaken.osquery_s3_config",
*flSocketPath,
osquery.ServerTimeout(time.Duration(*flTimeout)*time.Second),
)
if err != nil {
log.Fatalf("Error creating extension: %s\n", err)
}
// create and register s3 config plugin.
// requires configuration to be available through environment variables.
server.RegisterPlugin(s3.New())
// run the extension server
log.Fatal(server.Run())
}