File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ test_server_config() {
77 _server_config_storage
88 _server_config_auth_secret
99 _server_config_cluster_uuid
10+ _server_config_user_microcloud
1011
1112 kill_lxd " ${LXD_SERVERCONFIG_DIR} "
1213}
@@ -181,3 +182,23 @@ _server_config_storage() {
181182 # Cleanup
182183 lxc delete -f foo
183184}
185+
186+ _server_config_user_microcloud () {
187+ # Set config key user.microcloud, which is readable by untrusted clients
188+ lxc config set user.microcloud true
189+ [ " $( lxc config get user.microcloud) " = " true" ]
190+ [ " $( curl " https://${LXD_ADDR} /1.0" --insecure | jq ' .metadata.config["user.microcloud"]' ) " = ' "true"' ]
191+
192+ # Set config key user.foo, which is not exposed to untrusted clients
193+ lxc config set user.foo bar
194+ [ " $( lxc config get user.foo) " = " bar" ]
195+ [ " $( curl " https://${LXD_ADDR} /1.0" --insecure | jq ' .metadata.config["user.foo"]' ) " = ' null' ]
196+
197+ # Unset all config and check it worked
198+ lxc config unset user.microcloud
199+ lxc config unset user.foo
200+ [ " $( lxc config get user.microcloud) " = " " ]
201+ [ " $( lxc config get user.foo) " = " " ]
202+ [ " $( curl " https://${LXD_ADDR} /1.0" --insecure | jq ' .metadata.config["user.microcloud"]' ) " = ' null' ]
203+ [ " $( curl " https://${LXD_ADDR} /1.0" --insecure | jq ' .metadata.config["user.foo"]' ) " = ' null' ]
204+ }
You can’t perform that action at this time.
0 commit comments