From 8d153ca7a7e75cb7bd8bedcf5c72b8d170aa7895 Mon Sep 17 00:00:00 2001 From: Victor Vrantchan Date: Mon, 16 Oct 2017 14:54:48 -0400 Subject: [PATCH] add settings mdm command (#245) --- Gopkg.lock | 4 +- Gopkg.toml | 4 + command/event.go | 48 ++++ command/event_test.go | 1 + command/internal/commandproto/command.pb.go | 222 +++++++++++++----- command/internal/commandproto/command.proto | 21 +- .../Settings_hostname_devicename.plist | 28 +++ 7 files changed, 265 insertions(+), 63 deletions(-) create mode 100644 command/testdata/Settings_hostname_devicename.plist diff --git a/Gopkg.lock b/Gopkg.lock index 088e1408..47ffd68b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -101,7 +101,7 @@ branch = "master" name = "github.com/micromdm/mdm" packages = ["."] - revision = "97c19c7edf3498cf43b378042317d9d9caa84dc6" + revision = "adf70a87d7cc97f2dacd68033b8633611b57a569" [[projects]] name = "github.com/micromdm/scep" @@ -154,6 +154,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "f89bacfbc1e58f3f80d26c9b1a502920b10bf0d01b13718078e7bd967769982f" + inputs-digest = "783379f631fb5da2104405d76a8db595f3d54e4ee66d4181e0213303a3d84342" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 2c990654..832a3b4a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -18,3 +18,7 @@ [[constraint]] name = "github.com/satori/go.uuid" version = "v1.1.0" + +[[constraint]] + name = "github.com/micromdm/mdm" + branch = "master" diff --git a/command/event.go b/command/event.go index 370a486d..2bb86fdd 100644 --- a/command/event.go +++ b/command/event.go @@ -97,6 +97,27 @@ func MarshalEvent(e *Event) ([]byte, error) { NotManaged: cmd.NotManaged, ChangeManagementState: cmd.ChangeManagementState, } + case "Settings": + cmd := e.Payload.Command.Settings + var settings []*commandproto.Setting + for _, s := range cmd.Settings { + protoSetting := &commandproto.Setting{ + Item: s.Item, + } + if s.DeviceName != nil { + protoSetting.DeviceName = &commandproto.DeviceNameSetting{ + DeviceName: *s.DeviceName, + } + } + + if s.HostName != nil { + protoSetting.Hostname = &commandproto.HostnameSetting{ + Hostname: *s.HostName, + } + } + settings = append(settings, protoSetting) + } + payload.Command.Settings = &commandproto.Settings{Settings: settings} } return proto.Marshal(&commandproto.Event{ Id: e.ID, @@ -188,6 +209,33 @@ func UnmarshalEvent(data []byte, e *Event) error { ManagementFlags: int(cmd.GetManagementFlags()), ChangeManagementState: cmd.GetChangeManagementState(), } + case "Settings": + cmd := pb.Payload.Command.GetSettings() + var settings []mdm.Setting + for _, s := range cmd.GetSettings() { + mdmSetting := mdm.Setting{ + Item: s.GetItem(), + } + + if s.GetDeviceName() != nil { + mdmSetting.DeviceName = stringPtr(s.GetDeviceName().GetDeviceName()) + } + + if s.GetHostname() != nil { + mdmSetting.HostName = stringPtr(s.GetHostname().GetHostname()) + } + + settings = append(settings, mdmSetting) + } + e.Payload.Command.Settings = mdm.Settings{Settings: settings} } return nil } + +func stringPtr(s string) *string { + return &s +} + +func boolPtr(b bool) *bool { + return &b +} diff --git a/command/event_test.go b/command/event_test.go index e101c2da..8ee21dd4 100644 --- a/command/event_test.go +++ b/command/event_test.go @@ -16,6 +16,7 @@ var marshalTests = []string{ "DeviceInformation", "DeviceInformation_empty_queries", "InstallProfile", + "Settings_hostname_devicename", } func TestMarshalEvent(t *testing.T) { diff --git a/command/internal/commandproto/command.pb.go b/command/internal/commandproto/command.pb.go index e6eb2460..db8c37bb 100644 --- a/command/internal/commandproto/command.pb.go +++ b/command/internal/commandproto/command.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: command.proto -// DO NOT EDIT! /* Package commandproto is a generated protocol buffer package. @@ -22,6 +21,10 @@ It has these top-level messages: RemoveProfile DeleteUser InstallApplication + Settings + Setting + DeviceNameSetting + HostnameSetting */ package commandproto @@ -114,6 +117,7 @@ type Command struct { ScheduleOsUpdateScan *ScheduleOSUpdateScan `protobuf:"bytes,7,opt,name=schedule_os_update_scan,json=scheduleOsUpdateScan" json:"schedule_os_update_scan,omitempty"` RemoveProfile *RemoveProfile `protobuf:"bytes,8,opt,name=remove_profile,json=removeProfile" json:"remove_profile,omitempty"` DeleteUser *DeleteUser `protobuf:"bytes,9,opt,name=delete_user,json=deleteUser" json:"delete_user,omitempty"` + Settings *Settings `protobuf:"bytes,10,opt,name=settings" json:"settings,omitempty"` } func (m *Command) Reset() { *m = Command{} } @@ -184,6 +188,13 @@ func (m *Command) GetDeleteUser() *DeleteUser { return nil } +func (m *Command) GetSettings() *Settings { + if m != nil { + return m.Settings + } + return nil +} + type ScheduleOSUpdate struct { Updates []*OSUpdate `protobuf:"bytes,1,rep,name=updates" json:"updates,omitempty"` } @@ -440,6 +451,86 @@ func (m *InstallApplication) GetChangeManagementState() string { return "" } +type Settings struct { + Settings []*Setting `protobuf:"bytes,1,rep,name=settings" json:"settings,omitempty"` +} + +func (m *Settings) Reset() { *m = Settings{} } +func (m *Settings) String() string { return proto.CompactTextString(m) } +func (*Settings) ProtoMessage() {} +func (*Settings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *Settings) GetSettings() []*Setting { + if m != nil { + return m.Settings + } + return nil +} + +type Setting struct { + Item string `protobuf:"bytes,1,opt,name=item" json:"item,omitempty"` + DeviceName *DeviceNameSetting `protobuf:"bytes,2,opt,name=device_name,json=deviceName" json:"device_name,omitempty"` + Hostname *HostnameSetting `protobuf:"bytes,3,opt,name=hostname" json:"hostname,omitempty"` +} + +func (m *Setting) Reset() { *m = Setting{} } +func (m *Setting) String() string { return proto.CompactTextString(m) } +func (*Setting) ProtoMessage() {} +func (*Setting) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *Setting) GetItem() string { + if m != nil { + return m.Item + } + return "" +} + +func (m *Setting) GetDeviceName() *DeviceNameSetting { + if m != nil { + return m.DeviceName + } + return nil +} + +func (m *Setting) GetHostname() *HostnameSetting { + if m != nil { + return m.Hostname + } + return nil +} + +type DeviceNameSetting struct { + DeviceName string `protobuf:"bytes,1,opt,name=device_name,json=deviceName" json:"device_name,omitempty"` +} + +func (m *DeviceNameSetting) Reset() { *m = DeviceNameSetting{} } +func (m *DeviceNameSetting) String() string { return proto.CompactTextString(m) } +func (*DeviceNameSetting) ProtoMessage() {} +func (*DeviceNameSetting) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +func (m *DeviceNameSetting) GetDeviceName() string { + if m != nil { + return m.DeviceName + } + return "" +} + +type HostnameSetting struct { + Hostname string `protobuf:"bytes,1,opt,name=hostname" json:"hostname,omitempty"` +} + +func (m *HostnameSetting) Reset() { *m = HostnameSetting{} } +func (m *HostnameSetting) String() string { return proto.CompactTextString(m) } +func (*HostnameSetting) ProtoMessage() {} +func (*HostnameSetting) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *HostnameSetting) GetHostname() string { + if m != nil { + return m.Hostname + } + return "" +} + func init() { proto.RegisterType((*Event)(nil), "commandproto.Event") proto.RegisterType((*Payload)(nil), "commandproto.Payload") @@ -454,67 +545,78 @@ func init() { proto.RegisterType((*RemoveProfile)(nil), "commandproto.RemoveProfile") proto.RegisterType((*DeleteUser)(nil), "commandproto.DeleteUser") proto.RegisterType((*InstallApplication)(nil), "commandproto.InstallApplication") + proto.RegisterType((*Settings)(nil), "commandproto.Settings") + proto.RegisterType((*Setting)(nil), "commandproto.Setting") + proto.RegisterType((*DeviceNameSetting)(nil), "commandproto.DeviceNameSetting") + proto.RegisterType((*HostnameSetting)(nil), "commandproto.HostnameSetting") } func init() { proto.RegisterFile("command.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 903 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x95, 0x4f, 0x6f, 0x23, 0x35, - 0x18, 0xc6, 0x95, 0x64, 0xdb, 0x24,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a0, 0xe3, 0x76, 0x70, 0x65, 0x41, 0x16, - 0xb5, 0x8b, 0xaf, 0x8f, 0x1c, 0xf1, 0xa7, 0x28, 0xc6, 0xb7, 0x83, 0xfb, 0x5e, 0xbd, 0xae, 0xc5, - 0xf4, 0xaf, 0x26, 0xa0, 0xed, 0x4b, 0x10, 0x7d, 0x02, 0x47, 0xc2, 0xd8, 0x92, 0x6b, 0xa2, 0x8d, - 0x54, 0x9c, 0xd4, 0x0f, 0x4c, 0x0b, 0xf7, 0x83, 0x3c, 0x72, 0xea, 0x0d, 0xdb, 0xe8, 0xb7, 0xb9, - 0xd9, 0xaf, 0x7b, 0x45, 0x0a, 0x5a, 0x8a, 0x89, 0x7b, 0x46, 0xac, 0xca, 0xfd, 0xba, 0x77, 0x71, - 0x2f, 0x6a, 0x63, 0x95, 0xa3, 0xa7, 0x70, 0x5c, 0xd0, 0x92, 0x4e, 0x79, 0xc1, 0x4b, 0x43, 0x26, - 0x39, 0x9d, 0x6a, 0xbf, 0x01, 0x2d, 0x7c, 0xb4, 0xd4, 0xbf, 0x75, 0xb2, 0x3b, 0xb3, 0xa5, 0x34, - 0x24, 0xc8, 0xcc, 0x5f, 0xbe, 0x1d, 0x0c, 0xa5, 0x34, 0xaf, 0x82, 0x82, 0xbe, 0x82, 0x47, 0xd9, - 0x8c, 0x96, 0x53, 0x4e, 0x56, 0x90, 0xda, 0xc4, 0x3b, 0xb5, 0x8b, 0x4f, 0xc2, 0xf0, 0xab, 0xc5, - 0xe8, 0xc8, 0x0d, 0xfe, 0xbe, 0xef, 0xc3, 0xfa, 0xe5, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x64, - 0x22, 0x5e, 0x9f, 0xfc, 0x07, 0x00, 0x00, + // 1019 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x56, 0x5d, 0x6f, 0x1c, 0x35, + 0x14, 0xd5, 0xee, 0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 0x51, + 0x29, 0x2d, 0xe3, 0xfe, 0xaa, 0x44, 0x17, 0x25, 0x47, 0x29, 0x2d, 0xf1, 0xde, 0xa2, 0xac, 0x41, + 0xd1, 0xb7, 0xb0, 0x2d, 0x59, 0x21, 0x6e, 0x58, 0x53, 0x9a, 0xc8, 0x2a, 0xde, 0x9b, 0x57, 0xc4, + 0x96, 0x13, 0x2a, 0x33, 0x94, 0xed, 0x10, 0x3d, 0x35, 0xf6, 0xce, 0x99, 0x66, 0xa4, 0x56, 0x4c, + 0xc6, 0x03, 0x2b, 0x10, 0x2f, 0x1a, 0xc5, 0x10, 0xae, 0x15, 0x93, 0xc6, 0xf8, 0xe1, 0x1b, 0x3d, + 0x81, 0x48, 0x31, 0xad, 0x79, 0x39, 0x51, 0x31, 0xd8, 0x79, 0x07, 0x0b, 0xbf, 0xe2, 0x47, 0x71, + 0xc3, 0x4b, 0xce, 0x61, 0x77, 0xf1, 0x07, 0xd1, 0x67, 0xd0, 0x77, 0xbb, 0xa2, 0xe2, 0xce, 0x51, + 0x6f, 0x59, 0xa6, 0xd9, 0xdc, 0x40, 0x4b, 0x30, 0x44, 0xcd, 0xec, 0x43, 0xd8, 0xac, 0xa4, 0xc8, + 0xea, 0x54, 0x93, 0xd7, 0x6c, 0xe6, 0x8f, 0x04, 0x78, 0xe8, 0x7b, 0x36, 0x43, 0x1f, 0xc1, 0x76, + 0x63, 0xbd, 0xb4, 0x39, 0x0d, 0x03, 0x3c, 0x0c, 0x9e, 0xb2, 0x60, 0xf2, 0x29, 0xec, 0xad, 0xda, + 0x7a, 0xb4, 0x07, 0xeb, 0x63, 0x21, 0x53, 0x77, 0xd8, 0x22, 0xec, 0x82, 0xe4, 0xdf, 0x2e, 0xec, + 0x9d, 0xad, 0x36, 0xcf, 0xb1, 0x7a, 0xcd, 0x2b, 0x52, 0x49, 0x5e, 0x50, 0x39, 0x23, 0x8a, 0xe9, + 0xba, 0x22, 0x8d, 0x51, 0x25, 0x73, 0x1e, 0x75, 0x62, 0x87, 0x86, 0x7a, 0xe5, 0x98, 0x23, 0x43, + 0x0c, 0x92, 0x9e, 0x86, 0x7e, 0x86, 0x87, 0x8a, 0xe9, 0xb7, 0x88, 0x51, 0x45, 0x24, 0x9b, 0xd4, + 0x39, 0x95, 0xae, 0x76, 0x5d, 0xab, 0x79, 0xac, 0x98, 0x5e, 0x21, 0x79, 0xa6, 0xb0, 0xe3, 0xda, + 0xd2, 0x11, 0x78, 0x97, 0xd6, 0x5a, 0x04, 0xc1, 0xac, 0xe0, 0x65, 0x90, 0x55, 0x71, 0xcf, 0x16, + 0xe1, 0xc3, 0x85, 0xf3, 0x53, 0x6b, 0xe1, 0xf4, 0x0c, 0xd9, 0x8b, 0x2a, 0x7c, 0x40, 0x57, 0xe2, + 0xc9, 0xdf, 0x1d, 0x38, 0x58, 0x3d, 0x05, 0xdd, 0x07, 0x50, 0x53, 0x21, 0x35, 0x29, 0x69, 0x11, + 0x5a, 0xd8, 0xc0, 0x22, 0xaf, 0x68, 0xc1, 0xd0, 0x3d, 0x18, 0x8c, 0xeb, 0x3c, 0x77, 0xa3, 0xae, + 0x52, 0x91, 0x01, 0xec, 0xe0, 0x31, 0x0c, 0x2b, 0xaa, 0xd4, 0x1f, 0x42, 0x66, 0x64, 0x4a, 0xd5, + 0xd4, 0xf6, 0xa2, 0x2d, 0xbc, 0x15, 0xc0, 0x17, 0x54, 0x4d, 0xd1, 0x01, 0x6c, 0x4c, 0x79, 0x96, + 0x31, 0xd7, 0x5e, 0x22, 0xec, 0xa3, 0xe4, 0x11, 0xdc, 0x59, 0x6a, 0x79, 0x28, 0x86, 0xfe, 0x9b, + 0x9a, 0x49, 0xee, 0xcd, 0x37, 0xc0, 0x21, 0x4c, 0x3e, 0x81, 0xed, 0xf9, 0xa6, 0x66, 0xb8, 0xe1, + 0xee, 0xe8, 0xd8, 0x75, 0x43, 0x98, 0x3c, 0x86, 0xe1, 0xdc, 0x29, 0x43, 0x0f, 0x00, 0x78, 0xc6, + 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x0f, 0x5c, 0xb3, 0xc2, 0xd7, 0xc3, 0x7e, 0xa3, 0x6f, 0x9a, 0xb7, 0x40, 0xe3, 0xce, + 0xb7, 0xdc, 0xaa, 0xc6, 0xad, 0x41, 0xdf, 0x3f, 0x16, 0xac, 0x81, 0x9f, 0x42, 0x34, 0x15, 0x4a, + 0xdb, 0xe9, 0xee, 0x1e, 0xbd, 0x3f, 0x3f, 0xfd, 0x85, 0x1f, 0x6d, 0x92, 0x0b, 0xf4, 0xe4, 0xcb, + 0x60, 0xdf, 0x96, 0x76, 0xeb, 0x75, 0xd2, 0x32, 0x4f, 0x6b, 0xc1, 0xe4, 0x11, 0xec, 0x2c, 0x48, + 0x1a, 0xb7, 0x35, 0x39, 0x78, 0xb7, 0x85, 0xf8, 0xf7, 0x0d, 0x9b, 0xc5, 0x17, 0xff, 0x07, 0x00, + 0x00, 0xff, 0xff, 0x84, 0x9f, 0x25, 0x5c, 0x71, 0x09, 0x00, 0x00, } diff --git a/command/internal/commandproto/command.proto b/command/internal/commandproto/command.proto index a4c21369..6e9b0204 100644 --- a/command/internal/commandproto/command.proto +++ b/command/internal/commandproto/command.proto @@ -24,6 +24,7 @@ message Command { ScheduleOSUpdateScan schedule_os_update_scan = 7; RemoveProfile remove_profile = 8; DeleteUser delete_user = 9; + Settings settings = 10; } message ScheduleOSUpdate { @@ -69,7 +70,6 @@ message DeleteUser { bool force_deletion = 2; } - message InstallApplication { int64 itunes_store_id = 1; string identifier = 2; @@ -78,3 +78,22 @@ message InstallApplication { bool not_managed = 5; string change_management_state = 6; } + +message Settings { + repeated Setting settings = 1; +} + +message Setting { + string item = 1; + DeviceNameSetting device_name = 2; + HostnameSetting hostname = 3; +} + +message DeviceNameSetting { + string device_name = 1; +} + + +message HostnameSetting { + string hostname = 1; +} diff --git a/command/testdata/Settings_hostname_devicename.plist b/command/testdata/Settings_hostname_devicename.plist new file mode 100644 index 00000000..b11d32df --- /dev/null +++ b/command/testdata/Settings_hostname_devicename.plist @@ -0,0 +1,28 @@ + + + + + Command + + RequestType + Settings + Settings + + + DeviceName + foo + Item + DeviceName + + + HostName + foo-bar + Item + HostName + + + + CommandUUID + 19a68ea7-eb45-4ced-a7e6-5aa0b0eb71bc + +