From bd62342fc0aa11f9cad42d75e434488b96680b2d Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Fri, 22 Sep 2023 11:13:28 +0800 Subject: [PATCH] feat: known host security key data --- gen/openapi/sync/v1/sync_service.swagger.json | 26 ++++++- gen/proto/sync/v1/host.pb.go | 77 ++++++++++++------- gen/proto/sync/v1/host.pb.ts | 2 + proto/sync/v1/host.proto | 8 +- 4 files changed, 82 insertions(+), 31 deletions(-) diff --git a/gen/openapi/sync/v1/sync_service.swagger.json b/gen/openapi/sync/v1/sync_service.swagger.json index b784475..ff594ac 100644 --- a/gen/openapi/sync/v1/sync_service.swagger.json +++ b/gen/openapi/sync/v1/sync_service.swagger.json @@ -125,6 +125,7 @@ }, { "name": "host.port", + "description": "port is from 1-65535 int 64 is too large. Need check", "in": "query", "required": false, "type": "string", @@ -137,6 +138,20 @@ "required": false, "type": "string" }, + { + "name": "host.knownHostPublicKeyType", + "description": "known host public key type like ssh-ed25519", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.knownHostPublicKey", + "description": "known host host publickey AAAAC3NzaC1lZDI1NTE5AAAAIIDI5EzaZ1AGKVwHLa3e/PpkAkJIUDLrDc/Q9lSxfEla", + "in": "query", + "required": false, + "type": "string" + }, { "name": "host.username", "description": "用户名", @@ -400,12 +415,21 @@ }, "port": { "type": "string", - "format": "int64" + "format": "int64", + "title": "port is from 1-65535 int 64 is too large. Need check" }, "charset": { "type": "string", "title": "字符集" }, + "knownHostPublicKeyType": { + "type": "string", + "title": "known host public key type like ssh-ed25519" + }, + "knownHostPublicKey": { + "type": "string", + "title": "known host host publickey AAAAC3NzaC1lZDI1NTE5AAAAIIDI5EzaZ1AGKVwHLa3e/PpkAkJIUDLrDc/Q9lSxfEla" + }, "username": { "type": "string", "title": "用户名" diff --git a/gen/proto/sync/v1/host.pb.go b/gen/proto/sync/v1/host.pb.go index 87202f1..a31db9f 100644 --- a/gen/proto/sync/v1/host.pb.go +++ b/gen/proto/sync/v1/host.pb.go @@ -26,19 +26,21 @@ type Host struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 - UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 - DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 - Label string `protobuf:"bytes,11,opt,name=label,proto3" json:"label,omitempty"` // 标签 - Tags []string `protobuf:"bytes,12,rep,name=tags,proto3" json:"tags,omitempty"` - Address string `protobuf:"bytes,13,opt,name=address,proto3" json:"address,omitempty"` // ip或host - Port int64 `protobuf:"varint,14,opt,name=port,proto3" json:"port,omitempty"` - Charset string `protobuf:"bytes,15,opt,name=charset,proto3" json:"charset,omitempty"` // 字符集 - Username string `protobuf:"bytes,21,opt,name=username,proto3" json:"username,omitempty"` // 用户名 - Password string `protobuf:"bytes,22,opt,name=password,proto3" json:"password,omitempty"` // 密码 - KeyId string `protobuf:"bytes,23,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` // 密钥ID - IdentityId string `protobuf:"bytes,24,opt,name=identity_id,json=identityId,proto3" json:"identity_id,omitempty"` // 身份ID 若身份ID不为空,则覆盖手动配置 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 + Label string `protobuf:"bytes,11,opt,name=label,proto3" json:"label,omitempty"` // 标签 + Tags []string `protobuf:"bytes,12,rep,name=tags,proto3" json:"tags,omitempty"` + Address string `protobuf:"bytes,13,opt,name=address,proto3" json:"address,omitempty"` // ip或host + Port int64 `protobuf:"varint,14,opt,name=port,proto3" json:"port,omitempty"` // port is from 1-65535 int 64 is too large. Need check + Charset string `protobuf:"bytes,15,opt,name=charset,proto3" json:"charset,omitempty"` // 字符集 + KnownHostPublicKeyType string `protobuf:"bytes,16,opt,name=known_host_public_key_type,json=knownHostPublicKeyType,proto3" json:"known_host_public_key_type,omitempty"` // known host public key type like ssh-ed25519 + KnownHostPublicKey string `protobuf:"bytes,17,opt,name=known_host_public_key,json=knownHostPublicKey,proto3" json:"known_host_public_key,omitempty"` // known host host publickey AAAAC3NzaC1lZDI1NTE5AAAAIIDI5EzaZ1AGKVwHLa3e/PpkAkJIUDLrDc/Q9lSxfEla + Username string `protobuf:"bytes,21,opt,name=username,proto3" json:"username,omitempty"` // 用户名 + Password string `protobuf:"bytes,22,opt,name=password,proto3" json:"password,omitempty"` // 密码 + KeyId string `protobuf:"bytes,23,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` // 密钥ID + IdentityId string `protobuf:"bytes,24,opt,name=identity_id,json=identityId,proto3" json:"identity_id,omitempty"` // 身份ID 若身份ID不为空,则覆盖手动配置 } func (x *Host) Reset() { @@ -136,6 +138,20 @@ func (x *Host) GetCharset() string { return "" } +func (x *Host) GetKnownHostPublicKeyType() string { + if x != nil { + return x.KnownHostPublicKeyType + } + return "" +} + +func (x *Host) GetKnownHostPublicKey() string { + if x != nil { + return x.KnownHostPublicKey + } + return "" +} + func (x *Host) GetUsername() string { if x != nil { return x.Username @@ -170,8 +186,8 @@ var file_sync_v1_host_proto_rawDesc = []byte{ 0x0a, 0x12, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, - 0x03, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, + 0x04, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, @@ -190,18 +206,25 @@ var file_sync_v1_host_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, - 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, - 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x17, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, - 0x65, 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, - 0x31, 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x1a, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, + 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, + 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x31, 0x0a, 0x15, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, + 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x6f, 0x73, 0x74, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, 0x65, + 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, + 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gen/proto/sync/v1/host.pb.ts b/gen/proto/sync/v1/host.pb.ts index f28903c..a0da5f8 100644 --- a/gen/proto/sync/v1/host.pb.ts +++ b/gen/proto/sync/v1/host.pb.ts @@ -15,6 +15,8 @@ export type Host = { address?: string port?: string charset?: string + knownHostPublicKeyType?: string + knownHostPublicKey?: string username?: string password?: string keyId?: string diff --git a/proto/sync/v1/host.proto b/proto/sync/v1/host.proto index 24431f1..13ff8fa 100644 --- a/proto/sync/v1/host.proto +++ b/proto/sync/v1/host.proto @@ -14,9 +14,11 @@ message Host { string label = 11; // 标签 repeated string tags = 12; - string address = 13; // ip或host - int64 port = 14; - string charset = 15; // 字符集 + string address = 13; // ip或host + int64 port = 14; // port is from 1-65535 int 64 is too large. Need check + string charset = 15; // 字符集 + string known_host_public_key_type = 16; // known host public key type like ssh-ed25519 + string known_host_public_key = 17; // known host host publickey AAAAC3NzaC1lZDI1NTE5AAAAIIDI5EzaZ1AGKVwHLa3e/PpkAkJIUDLrDc/Q9lSxfEla string username = 21; // 用户名 string password = 22; // 密码