diff --git a/control/config_test.go b/control/config_test.go index 88ff3a029..a46b6ce6d 100644 --- a/control/config_test.go +++ b/control/config_test.go @@ -160,8 +160,8 @@ func TestControlConfigJSON(t *testing.T) { Convey("An error should not be returned when unmarshalling the config", func() { So(err, ShouldBeNil) }) - Convey("AutoDiscoverPath should be set to /some/directory/with/plugins", func() { - So(cfg.AutoDiscoverPath, ShouldEqual, "/some/directory/with/plugins") + Convey("AutoDiscoverPath should be set to /opt/snap/plugins:/opt/snap/tasks", func() { + So(cfg.AutoDiscoverPath, ShouldEqual, "/opt/snap/plugins:/opt/snap/tasks") }) Convey("CacheExpiration should be set to 750ms", func() { So(cfg.CacheExpiration.Duration, ShouldResemble, 750*time.Millisecond) @@ -178,8 +178,8 @@ func TestControlConfigJSON(t *testing.T) { Convey("ListenPort should be set to 10082", func() { So(cfg.ListenPort, ShouldEqual, 10082) }) - Convey("KeyringPaths should be set to /some/path/with/keyring/files", func() { - So(cfg.KeyringPaths, ShouldEqual, "/some/path/with/keyring/files") + Convey("KeyringPaths should be set to /etc/snap/keyrings", func() { + So(cfg.KeyringPaths, ShouldEqual, "/etc/snap/keyrings") }) Convey("PluginTrust should be set to 0", func() { So(cfg.PluginTrust, ShouldEqual, 0) @@ -233,8 +233,8 @@ func TestControlConfigYaml(t *testing.T) { Convey("An error should not be returned when unmarshalling the config", func() { So(err, ShouldBeNil) }) - Convey("AutoDiscoverPath should be set to /some/directory/with/plugins", func() { - So(cfg.AutoDiscoverPath, ShouldEqual, "/some/directory/with/plugins") + Convey("AutoDiscoverPath should be set to /opt/snap/plugins:/opt/snap/tasks", func() { + So(cfg.AutoDiscoverPath, ShouldEqual, "/opt/snap/plugins:/opt/snap/tasks") }) Convey("CacheExpiration should be set to 750ms", func() { So(cfg.CacheExpiration.Duration, ShouldResemble, 750*time.Millisecond) @@ -251,8 +251,8 @@ func TestControlConfigYaml(t *testing.T) { Convey("ListenPort should be set to 10082", func() { So(cfg.ListenPort, ShouldEqual, 10082) }) - Convey("KeyringPaths should be set to /some/path/with/keyring/files", func() { - So(cfg.KeyringPaths, ShouldEqual, "/some/path/with/keyring/files") + Convey("KeyringPaths should be set to /etc/snap/keyrings", func() { + So(cfg.KeyringPaths, ShouldEqual, "/etc/snap/keyrings") }) Convey("PluginTrust should be set to 0", func() { So(cfg.PluginTrust, ShouldEqual, 0) diff --git a/docs/SNAPTELD_CONFIGURATION.md b/docs/SNAPTELD_CONFIGURATION.md index e270d8386..14217d83a 100644 --- a/docs/SNAPTELD_CONFIGURATION.md +++ b/docs/SNAPTELD_CONFIGURATION.md @@ -71,9 +71,9 @@ The control section contains settings for configuring the Control module within ```yaml control: - # auto_discover_path sets a directory to auto load plugins on the start - # of the Snap daemon - auto_discover_path: /opt/snap/plugins + # auto_discover_path sets the directory(s) to auto load plugins and tasks on + # the start of the snap daemon. This can be a comma separated list of directories. + auto_discover_path: /opt/snap/plugins:/opt/snap/tasks # cache_expiration sets the time interval for the plugin cache to use before # expiring collection results from collect plugins. Default value is 500ms diff --git a/examples/configs/snap-config-sample.json b/examples/configs/snap-config-sample.json index 7380e95de..6dcfd6d72 100644 --- a/examples/configs/snap-config-sample.json +++ b/examples/configs/snap-config-sample.json @@ -5,14 +5,14 @@ "log_colors":true, "gomaxprocs":2, "control":{ - "auto_discover_path":"/some/directory/with/plugins", + "auto_discover_path":"/opt/snap/plugins:/opt/snap/tasks", "max_plugin_restarts":10, "cache_expiration":"750ms", "listen_addr":"0.0.0.0", "listen_port":10082, "max_running_plugins":1, "plugin_load_timeout":10, - "keyring_paths":"/some/path/with/keyring/files", + "keyring_paths":"/etc/snap/keyrings", "plugin_trust_level":0, "plugins":{ "all":{ @@ -81,8 +81,8 @@ "https":true, "rest_auth":true, "rest_auth_password":"changeme", - "rest_certificate":"/path/to/cert/file", - "rest_key":"/path/to/private/key", + "rest_certificate":"/etc/snap/cert.pem", + "rest_key":"/etc/snap/cert.key", "port":8282, "addr":"127.0.0.1:12345" }, @@ -93,4 +93,4 @@ "name":"localhost", "seed":"1.1.1.1:16000" } -} \ No newline at end of file +} diff --git a/examples/configs/snap-config-sample.yaml b/examples/configs/snap-config-sample.yaml index 32c3f6806..0eb967f35 100644 --- a/examples/configs/snap-config-sample.yaml +++ b/examples/configs/snap-config-sample.yaml @@ -8,7 +8,7 @@ log_level: 2 # default snapteld prints all logs to stdout. Any provided # path will send snapteld logs to a file called snapteld.log in # the provided directory. -log_path: /some/log/dir +log_path: /var/log/snap # log_truncate specifies how the log file with be opened # false => append @@ -27,9 +27,9 @@ gomaxprocs: 2 # Control sections for configuration settings for the plugin # control module of snapteld. control: - # auto_discover_path sets a directory to auto load plugins on the start - # of the snap daemon - auto_discover_path: /some/directory/with/plugins + # auto_discover_path sets the directory(s) to auto load plugins and tasks on + # the start of the snap daemon. This can be a comma separated list of directories. + auto_discover_path: /opt/snap/plugins:/opt/snap/tasks # cache_expiration sets the time interval for the plugin cache to use before # expiring collection results from collect plugins. Default value is 500ms @@ -53,7 +53,7 @@ control: # keyring_paths sets the directory(s) to search for keyring files for signed # plugins. This can be a comma separated list of directories - keyring_paths: /some/path/with/keyring/files + keyring_paths: /etc/snap/keyrings # plugin_trust_level sets the plugin trust level for snapteld. The default state # for plugin trust level is enabled (1). When enabled, only signed plugins that can @@ -141,11 +141,11 @@ restapi: rest_auth_password: changeme # rest_certificate is the path to the certificate to use for REST API when HTTPS is also enabled. - rest_certificate: /path/to/cert/file + rest_certificate: /etc/snap/cert.pem # rest_key is the path to the private key for the certificate in use by the REST API # when HTTPs is enabled. - rest_key: /path/to/private/key + rest_key: /etc/snap/cert.key # port sets the port to start the REST API server on. Default is 8181 port: 8282 diff --git a/mgmt/rest/server_test.go b/mgmt/rest/server_test.go index f57a87ccf..38c88f0c4 100644 --- a/mgmt/rest/server_test.go +++ b/mgmt/rest/server_test.go @@ -82,11 +82,11 @@ func TestRestAPIConfigJSON(t *testing.T) { Convey("RestAuthPassword should equal changeme", func() { So(cfg.RestAuthPassword, ShouldEqual, "changeme") }) - Convey("RestCertificate should equal /path/to/cert/file", func() { - So(cfg.RestCertificate, ShouldEqual, "/path/to/cert/file") + Convey("RestCertificate should equal /etc/snap/cert.pem", func() { + So(cfg.RestCertificate, ShouldEqual, "/etc/snap/cert.pem") }) - Convey("RestKey should equal /path/to/private/key", func() { - So(cfg.RestKey, ShouldEqual, "/path/to/private/key") + Convey("RestKey should equal /etc/snap/cert.key", func() { + So(cfg.RestKey, ShouldEqual, "/etc/snap/cert.key") }) }) @@ -124,11 +124,11 @@ func TestRestAPIConfigYaml(t *testing.T) { Convey("RestAuthPassword should equal changeme", func() { So(cfg.RestAuthPassword, ShouldEqual, "changeme") }) - Convey("RestCertificate should equal /path/to/cert/file", func() { - So(cfg.RestCertificate, ShouldEqual, "/path/to/cert/file") + Convey("RestCertificate should equal /etc/snap/cert.pem", func() { + So(cfg.RestCertificate, ShouldEqual, "/etc/snap/cert.pem") }) - Convey("RestKey should equal /path/to/private/key", func() { - So(cfg.RestKey, ShouldEqual, "/path/to/private/key") + Convey("RestKey should equal /etc/snap/cert.key", func() { + So(cfg.RestKey, ShouldEqual, "/etc/snap/cert.key") }) })