From 180f9a484565114267ea7d933f46a4fbfdcce154 Mon Sep 17 00:00:00 2001 From: "Rasmi V. Mahmoud" Date: Sat, 7 May 2022 15:08:31 +0200 Subject: [PATCH] dns options for dhcpd --- client/main.go | 2 + dhcp/dhcpd.conf.tmpl | 5 + dhcp/proto/dhcp.pb.go | 217 +++++++++++++++++++++---------------- dhcp/proto/dhcp.proto | 5 +- dhcp/proto/dhcp_grpc.pb.go | 2 +- packer/scripts/secure.sh | 5 + 6 files changed, 141 insertions(+), 95 deletions(-) diff --git a/client/main.go b/client/main.go index 4deb155..c4f280d 100644 --- a/client/main.go +++ b/client/main.go @@ -65,6 +65,8 @@ func main() { Min: "10.10.11.6", Max: "10.10.11.255", Network: "10.10.11.0", + DnsServer: "10.10.11.3", + } Networks = append(Networks, &net) diff --git a/dhcp/dhcpd.conf.tmpl b/dhcp/dhcpd.conf.tmpl index 323ee54..71d779d 100644 --- a/dhcp/dhcpd.conf.tmpl +++ b/dhcp/dhcpd.conf.tmpl @@ -6,6 +6,7 @@ subnet {{.Network}} netmask 255.255.255.0 { range {{.Min}} {{.Max}}; option subnet-mask 255.255.255.0; option routers {{.Router}}; + option domain-name-servers {{.dnsserverIP}} } {{end}} @@ -14,5 +15,9 @@ host {{.Name}} { hardware ethernet {{.MacAddress}}; fixed-address {{.Address}}; max-lease-time 84600; + option routers {{.Router}}; + option domain-name-servers {{.dnsserverIP}}; + option domain-name {{.Domain}}; + } {{end}} diff --git a/dhcp/proto/dhcp.pb.go b/dhcp/proto/dhcp.pb.go index 0266ba4..8f36a5a 100644 --- a/dhcp/proto/dhcp.pb.go +++ b/dhcp/proto/dhcp.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.17.3 -// source: dhcp.proto +// protoc v3.15.6 +// source: dhcp/proto/dhcp.proto package proto @@ -33,7 +33,7 @@ type Resp struct { func (x *Resp) Reset() { *x = Resp{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[0] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -46,7 +46,7 @@ func (x *Resp) String() string { func (*Resp) ProtoMessage() {} func (x *Resp) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[0] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -59,7 +59,7 @@ func (x *Resp) ProtoReflect() protoreflect.Message { // Deprecated: Use Resp.ProtoReflect.Descriptor instead. func (*Resp) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{0} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{0} } func (x *Resp) GetSuccess() bool { @@ -88,7 +88,7 @@ type StartReq struct { func (x *StartReq) Reset() { *x = StartReq{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[1] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101,7 +101,7 @@ func (x *StartReq) String() string { func (*StartReq) ProtoMessage() {} func (x *StartReq) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[1] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114,7 +114,7 @@ func (x *StartReq) ProtoReflect() protoreflect.Message { // Deprecated: Use StartReq.ProtoReflect.Descriptor instead. func (*StartReq) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{1} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{1} } func (x *StartReq) GetNetworks() []*Network { @@ -136,16 +136,17 @@ type Network struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Router string `protobuf:"bytes,1,opt,name=router,proto3" json:"router,omitempty"` - Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` - Min string `protobuf:"bytes,3,opt,name=min,proto3" json:"min,omitempty"` - Max string `protobuf:"bytes,4,opt,name=max,proto3" json:"max,omitempty"` + Router string `protobuf:"bytes,1,opt,name=router,proto3" json:"router,omitempty"` + Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` + Min string `protobuf:"bytes,3,opt,name=min,proto3" json:"min,omitempty"` + Max string `protobuf:"bytes,4,opt,name=max,proto3" json:"max,omitempty"` + DnsServer string `protobuf:"bytes,5,opt,name=dns_server,json=dnsServer,proto3" json:"dns_server,omitempty"` } func (x *Network) Reset() { *x = Network{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[2] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -158,7 +159,7 @@ func (x *Network) String() string { func (*Network) ProtoMessage() {} func (x *Network) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[2] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -171,7 +172,7 @@ func (x *Network) ProtoReflect() protoreflect.Message { // Deprecated: Use Network.ProtoReflect.Descriptor instead. func (*Network) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{2} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{2} } func (x *Network) GetRouter() string { @@ -202,6 +203,13 @@ func (x *Network) GetMax() string { return "" } +func (x *Network) GetDnsServer() string { + if x != nil { + return x.DnsServer + } + return "" +} + type StaticHost struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -210,12 +218,14 @@ type StaticHost struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` MacAddress string `protobuf:"bytes,3,opt,name=macAddress,proto3" json:"macAddress,omitempty"` + DnsServer string `protobuf:"bytes,4,opt,name=dns_server,json=dnsServer,proto3" json:"dns_server,omitempty"` + DomainName string `protobuf:"bytes,5,opt,name=domain_name,json=domainName,proto3" json:"domain_name,omitempty"` } func (x *StaticHost) Reset() { *x = StaticHost{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[3] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -228,7 +238,7 @@ func (x *StaticHost) String() string { func (*StaticHost) ProtoMessage() {} func (x *StaticHost) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[3] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -241,7 +251,7 @@ func (x *StaticHost) ProtoReflect() protoreflect.Message { // Deprecated: Use StaticHost.ProtoReflect.Descriptor instead. func (*StaticHost) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{3} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{3} } func (x *StaticHost) GetName() string { @@ -265,6 +275,20 @@ func (x *StaticHost) GetMacAddress() string { return "" } +func (x *StaticHost) GetDnsServer() string { + if x != nil { + return x.DnsServer + } + return "" +} + +func (x *StaticHost) GetDomainName() string { + if x != nil { + return x.DomainName + } + return "" +} + type StopReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -274,7 +298,7 @@ type StopReq struct { func (x *StopReq) Reset() { *x = StopReq{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[4] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -287,7 +311,7 @@ func (x *StopReq) String() string { func (*StopReq) ProtoMessage() {} func (x *StopReq) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[4] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -300,7 +324,7 @@ func (x *StopReq) ProtoReflect() protoreflect.Message { // Deprecated: Use StopReq.ProtoReflect.Descriptor instead. func (*StopReq) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{4} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{4} } type UpdateReq struct { @@ -315,7 +339,7 @@ type UpdateReq struct { func (x *UpdateReq) Reset() { *x = UpdateReq{} if protoimpl.UnsafeEnabled { - mi := &file_dhcp_proto_msgTypes[5] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -328,7 +352,7 @@ func (x *UpdateReq) String() string { func (*UpdateReq) ProtoMessage() {} func (x *UpdateReq) ProtoReflect() protoreflect.Message { - mi := &file_dhcp_proto_msgTypes[5] + mi := &file_dhcp_proto_dhcp_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -341,7 +365,7 @@ func (x *UpdateReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead. func (*UpdateReq) Descriptor() ([]byte, []int) { - return file_dhcp_proto_rawDescGZIP(), []int{5} + return file_dhcp_proto_dhcp_proto_rawDescGZIP(), []int{5} } func (x *UpdateReq) GetNetworks() []*Network { @@ -358,65 +382,72 @@ func (x *UpdateReq) GetStaticHosts() []*StaticHost { return nil } -var File_dhcp_proto protoreflect.FileDescriptor - -var file_dhcp_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x64, 0x68, 0x63, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x2d, 0x0a, 0x0b, 0x73, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0b, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x0b, 0x73, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x5f, 0x0a, 0x07, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x61, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x09, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, - 0x71, 0x22, 0x60, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, - 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x08, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x2d, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, - 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, - 0x73, 0x74, 0x73, 0x32, 0x69, 0x0a, 0x04, 0x44, 0x48, 0x43, 0x50, 0x12, 0x1f, 0x0a, 0x09, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x44, 0x48, 0x43, 0x50, 0x12, 0x09, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x1d, 0x0a, 0x08, - 0x53, 0x74, 0x6f, 0x70, 0x44, 0x48, 0x43, 0x50, 0x12, 0x08, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, - 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x21, 0x0a, 0x0a, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x48, 0x43, 0x50, 0x12, 0x0a, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x2e, - 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x61, 0x6e, - 0x65, 0x73, 0x74, 0x6f, 0x6c, 0x65, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x72, 0x2f, 0x64, 0x68, 0x63, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_dhcp_proto_dhcp_proto protoreflect.FileDescriptor + +var file_dhcp_proto_dhcp_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x64, 0x68, 0x63, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x68, 0x63, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, + 0x24, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x08, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x2d, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, + 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, + 0x6f, 0x73, 0x74, 0x73, 0x22, 0x7e, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x6e, 0x73, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x6e, 0x73, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x22, 0x9a, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, + 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x61, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x6e, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0x09, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x22, 0x60, 0x0a, 0x09, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x08, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x12, + 0x2d, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, + 0x74, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x32, 0x69, + 0x0a, 0x04, 0x44, 0x48, 0x43, 0x50, 0x12, 0x1f, 0x0a, 0x09, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, + 0x48, 0x43, 0x50, 0x12, 0x09, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x05, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x1d, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x44, + 0x48, 0x43, 0x50, 0x12, 0x08, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x21, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x44, 0x48, 0x43, 0x50, 0x12, 0x0a, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x61, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x6c, + 0x65, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x64, + 0x68, 0x63, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( - file_dhcp_proto_rawDescOnce sync.Once - file_dhcp_proto_rawDescData = file_dhcp_proto_rawDesc + file_dhcp_proto_dhcp_proto_rawDescOnce sync.Once + file_dhcp_proto_dhcp_proto_rawDescData = file_dhcp_proto_dhcp_proto_rawDesc ) -func file_dhcp_proto_rawDescGZIP() []byte { - file_dhcp_proto_rawDescOnce.Do(func() { - file_dhcp_proto_rawDescData = protoimpl.X.CompressGZIP(file_dhcp_proto_rawDescData) +func file_dhcp_proto_dhcp_proto_rawDescGZIP() []byte { + file_dhcp_proto_dhcp_proto_rawDescOnce.Do(func() { + file_dhcp_proto_dhcp_proto_rawDescData = protoimpl.X.CompressGZIP(file_dhcp_proto_dhcp_proto_rawDescData) }) - return file_dhcp_proto_rawDescData + return file_dhcp_proto_dhcp_proto_rawDescData } -var file_dhcp_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_dhcp_proto_goTypes = []interface{}{ +var file_dhcp_proto_dhcp_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_dhcp_proto_dhcp_proto_goTypes = []interface{}{ (*Resp)(nil), // 0: Resp (*StartReq)(nil), // 1: StartReq (*Network)(nil), // 2: Network @@ -424,7 +455,7 @@ var file_dhcp_proto_goTypes = []interface{}{ (*StopReq)(nil), // 4: StopReq (*UpdateReq)(nil), // 5: UpdateReq } -var file_dhcp_proto_depIdxs = []int32{ +var file_dhcp_proto_dhcp_proto_depIdxs = []int32{ 2, // 0: StartReq.networks:type_name -> Network 3, // 1: StartReq.staticHosts:type_name -> StaticHost 2, // 2: UpdateReq.networks:type_name -> Network @@ -442,13 +473,13 @@ var file_dhcp_proto_depIdxs = []int32{ 0, // [0:4] is the sub-list for field type_name } -func init() { file_dhcp_proto_init() } -func file_dhcp_proto_init() { - if File_dhcp_proto != nil { +func init() { file_dhcp_proto_dhcp_proto_init() } +func file_dhcp_proto_dhcp_proto_init() { + if File_dhcp_proto_dhcp_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_dhcp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Resp); i { case 0: return &v.state @@ -460,7 +491,7 @@ func file_dhcp_proto_init() { return nil } } - file_dhcp_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StartReq); i { case 0: return &v.state @@ -472,7 +503,7 @@ func file_dhcp_proto_init() { return nil } } - file_dhcp_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Network); i { case 0: return &v.state @@ -484,7 +515,7 @@ func file_dhcp_proto_init() { return nil } } - file_dhcp_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StaticHost); i { case 0: return &v.state @@ -496,7 +527,7 @@ func file_dhcp_proto_init() { return nil } } - file_dhcp_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StopReq); i { case 0: return &v.state @@ -508,7 +539,7 @@ func file_dhcp_proto_init() { return nil } } - file_dhcp_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_dhcp_proto_dhcp_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateReq); i { case 0: return &v.state @@ -525,18 +556,18 @@ func file_dhcp_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dhcp_proto_rawDesc, + RawDescriptor: file_dhcp_proto_dhcp_proto_rawDesc, NumEnums: 0, NumMessages: 6, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_dhcp_proto_goTypes, - DependencyIndexes: file_dhcp_proto_depIdxs, - MessageInfos: file_dhcp_proto_msgTypes, + GoTypes: file_dhcp_proto_dhcp_proto_goTypes, + DependencyIndexes: file_dhcp_proto_dhcp_proto_depIdxs, + MessageInfos: file_dhcp_proto_dhcp_proto_msgTypes, }.Build() - File_dhcp_proto = out.File - file_dhcp_proto_rawDesc = nil - file_dhcp_proto_goTypes = nil - file_dhcp_proto_depIdxs = nil + File_dhcp_proto_dhcp_proto = out.File + file_dhcp_proto_dhcp_proto_rawDesc = nil + file_dhcp_proto_dhcp_proto_goTypes = nil + file_dhcp_proto_dhcp_proto_depIdxs = nil } diff --git a/dhcp/proto/dhcp.proto b/dhcp/proto/dhcp.proto index e22d6ce..d1ba568 100644 --- a/dhcp/proto/dhcp.proto +++ b/dhcp/proto/dhcp.proto @@ -24,16 +24,19 @@ message Network { string network = 2; string min = 3; string max = 4; + string dns_server=5; } message StaticHost { string name = 1; string address = 2; string macAddress = 3; + string dns_server =4; + string domain_name=5; } message StopReq { - + } message UpdateReq { diff --git a/dhcp/proto/dhcp_grpc.pb.go b/dhcp/proto/dhcp_grpc.pb.go index 409f109..643badd 100644 --- a/dhcp/proto/dhcp_grpc.pb.go +++ b/dhcp/proto/dhcp_grpc.pb.go @@ -169,5 +169,5 @@ var DHCP_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "dhcp.proto", + Metadata: "dhcp/proto/dhcp.proto", } diff --git a/packer/scripts/secure.sh b/packer/scripts/secure.sh index 9a6782f..5ce2034 100644 --- a/packer/scripts/secure.sh +++ b/packer/scripts/secure.sh @@ -5,3 +5,8 @@ ufw allow ssh ufw allow 5353/tcp ufw allow 5181/udp ufw allow 5182/udp + +#allow elastic-agent +ufw allow 8220/tcp +ufw allow 8220/udp +