Clear private keys
This commit is contained in:
parent
4a5c60c66d
commit
0763310b16
5 changed files with 68 additions and 409 deletions
|
@ -22,7 +22,6 @@ INFO[0000] tunnel created tunnel=guard0
|
||||||
INFO[0000] created guard0 tunnel
|
INFO[0000] created guard0 tunnel
|
||||||
{
|
{
|
||||||
"id": "guard0",
|
"id": "guard0",
|
||||||
"private_key": "+A4O44heAgTmLcVipqSFAYxigpAv61UbWigU0xoHbng=",
|
|
||||||
"listen_port": "10100",
|
"listen_port": "10100",
|
||||||
"address": "10.199.199.1/32",
|
"address": "10.199.199.1/32",
|
||||||
"public_key": "37uzie/EZzzDpRbVTUOtuVXwhht/599pdhseh9MJ7QE=",
|
"public_key": "37uzie/EZzzDpRbVTUOtuVXwhht/599pdhseh9MJ7QE=",
|
||||||
|
@ -50,7 +49,6 @@ The last argument is used as the tunnel ID and interface name on the server.
|
||||||
|
|
||||||
{
|
{
|
||||||
"id": "wg0",
|
"id": "wg0",
|
||||||
"private_key": "+EymZwYNHxGVe5T1gmTbwKmQgWksDlZzldTwoZi5lnQ=",
|
|
||||||
"listen_port": "31000",
|
"listen_port": "31000",
|
||||||
"address": "192.168.5.1/32",
|
"address": "192.168.5.1/32",
|
||||||
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
||||||
|
@ -94,7 +92,6 @@ Endpoint = 127.0.0.1:31000
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "wg0",
|
"id": "wg0",
|
||||||
"private_key": "+EymZwYNHxGVe5T1gmTbwKmQgWksDlZzldTwoZi5lnQ=",
|
|
||||||
"listen_port": "31000",
|
"listen_port": "31000",
|
||||||
"address": "192.168.5.1/32",
|
"address": "192.168.5.1/32",
|
||||||
"peers": [
|
"peers": [
|
||||||
|
@ -104,7 +101,6 @@ Endpoint = 127.0.0.1:31000
|
||||||
"allowed_ips": [
|
"allowed_ips": [
|
||||||
"192.168.5.2/32"
|
"192.168.5.2/32"
|
||||||
],
|
],
|
||||||
"private_key": "kFJ6VSq+l6sBPaI2DUbEWSVI83Kcfz/yo7WfVheT+FI="
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
||||||
|
@ -122,7 +118,6 @@ You can remove and update peers using the `peers` commands.
|
||||||
|
|
||||||
{
|
{
|
||||||
"id": "wg0",
|
"id": "wg0",
|
||||||
"private_key": "+EymZwYNHxGVe5T1gmTbwKmQgWksDlZzldTwoZi5lnQ=",
|
|
||||||
"listen_port": "31000",
|
"listen_port": "31000",
|
||||||
"address": "192.168.5.1/32",
|
"address": "192.168.5.1/32",
|
||||||
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
"public_key": "irDV3wkkNe6f1GLAPFNGjj0xsQsoxPCNko4Lf3igcjM=",
|
||||||
|
|
|
@ -189,47 +189,6 @@ func (m *NewPeerRequest) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_NewPeerRequest proto.InternalMessageInfo
|
var xxx_messageInfo_NewPeerRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
type AddPeerRequest struct {
|
|
||||||
// id of the tunnel
|
|
||||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
||||||
Peer *Peer `protobuf:"bytes,2,opt,name=peer,proto3" json:"peer,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AddPeerRequest) Reset() { *m = AddPeerRequest{} }
|
|
||||||
func (*AddPeerRequest) ProtoMessage() {}
|
|
||||||
func (*AddPeerRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{4}
|
|
||||||
}
|
|
||||||
func (m *AddPeerRequest) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *AddPeerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_AddPeerRequest.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalTo(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *AddPeerRequest) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_AddPeerRequest.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *AddPeerRequest) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *AddPeerRequest) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_AddPeerRequest.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_AddPeerRequest proto.InternalMessageInfo
|
|
||||||
|
|
||||||
type DeletePeerRequest struct {
|
type DeletePeerRequest struct {
|
||||||
// id of the tunnel
|
// id of the tunnel
|
||||||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
@ -242,7 +201,7 @@ type DeletePeerRequest struct {
|
||||||
func (m *DeletePeerRequest) Reset() { *m = DeletePeerRequest{} }
|
func (m *DeletePeerRequest) Reset() { *m = DeletePeerRequest{} }
|
||||||
func (*DeletePeerRequest) ProtoMessage() {}
|
func (*DeletePeerRequest) ProtoMessage() {}
|
||||||
func (*DeletePeerRequest) Descriptor() ([]byte, []int) {
|
func (*DeletePeerRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{5}
|
return fileDescriptor_ebe0601dd3932458, []int{4}
|
||||||
}
|
}
|
||||||
func (m *DeletePeerRequest) XXX_Unmarshal(b []byte) error {
|
func (m *DeletePeerRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -282,7 +241,7 @@ type DeleteRequest struct {
|
||||||
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
|
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
|
||||||
func (*DeleteRequest) ProtoMessage() {}
|
func (*DeleteRequest) ProtoMessage() {}
|
||||||
func (*DeleteRequest) Descriptor() ([]byte, []int) {
|
func (*DeleteRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{6}
|
return fileDescriptor_ebe0601dd3932458, []int{5}
|
||||||
}
|
}
|
||||||
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -321,7 +280,7 @@ type ListResponse struct {
|
||||||
func (m *ListResponse) Reset() { *m = ListResponse{} }
|
func (m *ListResponse) Reset() { *m = ListResponse{} }
|
||||||
func (*ListResponse) ProtoMessage() {}
|
func (*ListResponse) ProtoMessage() {}
|
||||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{7}
|
return fileDescriptor_ebe0601dd3932458, []int{6}
|
||||||
}
|
}
|
||||||
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -368,7 +327,7 @@ type Tunnel struct {
|
||||||
func (m *Tunnel) Reset() { *m = Tunnel{} }
|
func (m *Tunnel) Reset() { *m = Tunnel{} }
|
||||||
func (*Tunnel) ProtoMessage() {}
|
func (*Tunnel) ProtoMessage() {}
|
||||||
func (*Tunnel) Descriptor() ([]byte, []int) {
|
func (*Tunnel) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{8}
|
return fileDescriptor_ebe0601dd3932458, []int{7}
|
||||||
}
|
}
|
||||||
func (m *Tunnel) XXX_Unmarshal(b []byte) error {
|
func (m *Tunnel) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -412,7 +371,7 @@ type Peer struct {
|
||||||
func (m *Peer) Reset() { *m = Peer{} }
|
func (m *Peer) Reset() { *m = Peer{} }
|
||||||
func (*Peer) ProtoMessage() {}
|
func (*Peer) ProtoMessage() {}
|
||||||
func (*Peer) Descriptor() ([]byte, []int) {
|
func (*Peer) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{9}
|
return fileDescriptor_ebe0601dd3932458, []int{8}
|
||||||
}
|
}
|
||||||
func (m *Peer) XXX_Unmarshal(b []byte) error {
|
func (m *Peer) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -451,7 +410,7 @@ type Masquerade struct {
|
||||||
func (m *Masquerade) Reset() { *m = Masquerade{} }
|
func (m *Masquerade) Reset() { *m = Masquerade{} }
|
||||||
func (*Masquerade) ProtoMessage() {}
|
func (*Masquerade) ProtoMessage() {}
|
||||||
func (*Masquerade) Descriptor() ([]byte, []int) {
|
func (*Masquerade) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ebe0601dd3932458, []int{10}
|
return fileDescriptor_ebe0601dd3932458, []int{9}
|
||||||
}
|
}
|
||||||
func (m *Masquerade) XXX_Unmarshal(b []byte) error {
|
func (m *Masquerade) XXX_Unmarshal(b []byte) error {
|
||||||
return m.Unmarshal(b)
|
return m.Unmarshal(b)
|
||||||
|
@ -485,7 +444,6 @@ func init() {
|
||||||
proto.RegisterType((*TunnelResponse)(nil), "com.crosbymichael.guard.v1.TunnelResponse")
|
proto.RegisterType((*TunnelResponse)(nil), "com.crosbymichael.guard.v1.TunnelResponse")
|
||||||
proto.RegisterType((*PeerResponse)(nil), "com.crosbymichael.guard.v1.PeerResponse")
|
proto.RegisterType((*PeerResponse)(nil), "com.crosbymichael.guard.v1.PeerResponse")
|
||||||
proto.RegisterType((*NewPeerRequest)(nil), "com.crosbymichael.guard.v1.NewPeerRequest")
|
proto.RegisterType((*NewPeerRequest)(nil), "com.crosbymichael.guard.v1.NewPeerRequest")
|
||||||
proto.RegisterType((*AddPeerRequest)(nil), "com.crosbymichael.guard.v1.AddPeerRequest")
|
|
||||||
proto.RegisterType((*DeletePeerRequest)(nil), "com.crosbymichael.guard.v1.DeletePeerRequest")
|
proto.RegisterType((*DeletePeerRequest)(nil), "com.crosbymichael.guard.v1.DeletePeerRequest")
|
||||||
proto.RegisterType((*DeleteRequest)(nil), "com.crosbymichael.guard.v1.DeleteRequest")
|
proto.RegisterType((*DeleteRequest)(nil), "com.crosbymichael.guard.v1.DeleteRequest")
|
||||||
proto.RegisterType((*ListResponse)(nil), "com.crosbymichael.guard.v1.ListResponse")
|
proto.RegisterType((*ListResponse)(nil), "com.crosbymichael.guard.v1.ListResponse")
|
||||||
|
@ -499,53 +457,52 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_ebe0601dd3932458 = []byte{
|
var fileDescriptor_ebe0601dd3932458 = []byte{
|
||||||
// 736 bytes of a gzipped FileDescriptorProto
|
// 713 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0xda, 0x48,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x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, 0x34, 0x65, 0x47, 0xa9, 0x97, 0x9a, 0x6a, 0x3c, 0xa9, 0xe5, 0xda,
|
||||||
0x69, 0x3d, 0xd7, 0x69, 0x1b, 0x39, 0x6a, 0x91, 0x2a, 0x6c, 0xa0, 0x6b, 0xf9, 0x1e, 0x75, 0x43,
|
0x2d, 0x2b, 0x47, 0x1d, 0x52, 0x81, 0x35, 0xf4, 0x9d, 0x30, 0xa0, 0x3e, 0xd7, 0x72, 0x89, 0xd7,
|
||||||
0x25, 0x17, 0x7b, 0x8d, 0x9b, 0x33, 0x51, 0xa0, 0x68, 0x5a, 0x56, 0x80, 0x8c, 0x29, 0x79, 0xee,
|
0xba, 0x3a, 0x13, 0x0d, 0x8a, 0xb6, 0xe3, 0x44, 0xc8, 0x98, 0x96, 0x17, 0xae, 0xd9, 0x51, 0x3f,
|
||||||
0x9a, 0x1d, 0xd5, 0x23, 0xa8, 0xbc, 0x1d, 0xb9, 0x2e, 0x3a, 0x06, 0x32, 0xdf, 0x73, 0x19, 0x92,
|
0x80, 0xcd, 0x4f, 0x43, 0xdf, 0x47, 0xcf, 0x42, 0x16, 0x06, 0x3e, 0x43, 0xf2, 0x02, 0x54, 0x2e,
|
||||||
0x27, 0x20, 0x87, 0xdc, 0xc2, 0x6b, 0x94, 0xf7, 0x55, 0x6d, 0xf9, 0x40, 0x5a, 0x92, 0x9b, 0x64,
|
0x2c, 0x22, 0x47, 0x79, 0x4f, 0x37, 0x96, 0x37, 0x64, 0x4c, 0xb1, 0x53, 0x84, 0x7e, 0xae, 0xc0,
|
||||||
0xa8, 0x97, 0x12, 0x6c, 0x76, 0x11, 0x83, 0x87, 0xb8, 0x8c, 0x3c, 0x82, 0x82, 0x8f, 0x18, 0xf0,
|
0x7a, 0x07, 0x31, 0xba, 0x8b, 0xcb, 0xc8, 0x33, 0x28, 0x84, 0x88, 0x91, 0x68, 0xa6, 0xbc, 0xb7,
|
||||||
0x61, 0xca, 0xfb, 0xbb, 0x59, 0x99, 0xbc,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||||
0xf5, 0xff, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0xa8, 0x29, 0xc6, 0x27, 0x08, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
@ -568,8 +525,6 @@ type WireguardClient interface {
|
||||||
List(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *types.Empty, opts ...grpc.CallOption) (*ListResponse, error)
|
||||||
// NewPeer to the tunnel with gernerated keys
|
// NewPeer to the tunnel with gernerated keys
|
||||||
NewPeer(ctx context.Context, in *NewPeerRequest, opts ...grpc.CallOption) (*PeerResponse, error)
|
NewPeer(ctx context.Context, in *NewPeerRequest, opts ...grpc.CallOption) (*PeerResponse, error)
|
||||||
// AddPeer to the tunnel
|
|
||||||
AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error)
|
|
||||||
// DeletePeer from a tunnel
|
// DeletePeer from a tunnel
|
||||||
DeletePeer(ctx context.Context, in *DeletePeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error)
|
DeletePeer(ctx context.Context, in *DeletePeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error)
|
||||||
}
|
}
|
||||||
|
@ -618,15 +573,6 @@ func (c *wireguardClient) NewPeer(ctx context.Context, in *NewPeerRequest, opts
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *wireguardClient) AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error) {
|
|
||||||
out := new(TunnelResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/com.crosbymichael.guard.v1.Wireguard/AddPeer", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wireguardClient) DeletePeer(ctx context.Context, in *DeletePeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error) {
|
func (c *wireguardClient) DeletePeer(ctx context.Context, in *DeletePeerRequest, opts ...grpc.CallOption) (*TunnelResponse, error) {
|
||||||
out := new(TunnelResponse)
|
out := new(TunnelResponse)
|
||||||
err := c.cc.Invoke(ctx, "/com.crosbymichael.guard.v1.Wireguard/DeletePeer", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/com.crosbymichael.guard.v1.Wireguard/DeletePeer", in, out, opts...)
|
||||||
|
@ -646,8 +592,6 @@ type WireguardServer interface {
|
||||||
List(context.Context, *types.Empty) (*ListResponse, error)
|
List(context.Context, *types.Empty) (*ListResponse, error)
|
||||||
// NewPeer to the tunnel with gernerated keys
|
// NewPeer to the tunnel with gernerated keys
|
||||||
NewPeer(context.Context, *NewPeerRequest) (*PeerResponse, error)
|
NewPeer(context.Context, *NewPeerRequest) (*PeerResponse, error)
|
||||||
// AddPeer to the tunnel
|
|
||||||
AddPeer(context.Context, *AddPeerRequest) (*TunnelResponse, error)
|
|
||||||
// DeletePeer from a tunnel
|
// DeletePeer from a tunnel
|
||||||
DeletePeer(context.Context, *DeletePeerRequest) (*TunnelResponse, error)
|
DeletePeer(context.Context, *DeletePeerRequest) (*TunnelResponse, error)
|
||||||
}
|
}
|
||||||
|
@ -728,24 +672,6 @@ func _Wireguard_NewPeer_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Wireguard_AddPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(AddPeerRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WireguardServer).AddPeer(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/com.crosbymichael.guard.v1.Wireguard/AddPeer",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WireguardServer).AddPeer(ctx, req.(*AddPeerRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Wireguard_DeletePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Wireguard_DeletePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(DeletePeerRequest)
|
in := new(DeletePeerRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
|
@ -784,10 +710,6 @@ var _Wireguard_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "NewPeer",
|
MethodName: "NewPeer",
|
||||||
Handler: _Wireguard_NewPeer_Handler,
|
Handler: _Wireguard_NewPeer_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "AddPeer",
|
|
||||||
Handler: _Wireguard_AddPeer_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "DeletePeer",
|
MethodName: "DeletePeer",
|
||||||
Handler: _Wireguard_DeletePeer_Handler,
|
Handler: _Wireguard_DeletePeer_Handler,
|
||||||
|
@ -947,43 +869,6 @@ func (m *NewPeerRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AddPeerRequest) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalTo(dAtA)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AddPeerRequest) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
var i int
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.ID) > 0 {
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
i++
|
|
||||||
i = encodeVarintGuard(dAtA, i, uint64(len(m.ID)))
|
|
||||||
i += copy(dAtA[i:], m.ID)
|
|
||||||
}
|
|
||||||
if m.Peer != nil {
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
i++
|
|
||||||
i = encodeVarintGuard(dAtA, i, uint64(m.Peer.Size()))
|
|
||||||
n4, err := m.Peer.MarshalTo(dAtA[i:])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i += n4
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *DeletePeerRequest) Marshal() (dAtA []byte, err error) {
|
func (m *DeletePeerRequest) Marshal() (dAtA []byte, err error) {
|
||||||
size := m.Size()
|
size := m.Size()
|
||||||
dAtA = make([]byte, size)
|
dAtA = make([]byte, size)
|
||||||
|
@ -1138,11 +1023,11 @@ func (m *Tunnel) MarshalTo(dAtA []byte) (int, error) {
|
||||||
dAtA[i] = 0x3a
|
dAtA[i] = 0x3a
|
||||||
i++
|
i++
|
||||||
i = encodeVarintGuard(dAtA, i, uint64(m.Masquerade.Size()))
|
i = encodeVarintGuard(dAtA, i, uint64(m.Masquerade.Size()))
|
||||||
n5, err := m.Masquerade.MarshalTo(dAtA[i:])
|
n4, err := m.Masquerade.MarshalTo(dAtA[i:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
i += n5
|
i += n4
|
||||||
}
|
}
|
||||||
if len(m.PublicKey) > 0 {
|
if len(m.PublicKey) > 0 {
|
||||||
dAtA[i] = 0x42
|
dAtA[i] = 0x42
|
||||||
|
@ -1347,26 +1232,6 @@ func (m *NewPeerRequest) Size() (n int) {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AddPeerRequest) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.ID)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovGuard(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Peer != nil {
|
|
||||||
l = m.Peer.Size()
|
|
||||||
n += 1 + l + sovGuard(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *DeletePeerRequest) Size() (n int) {
|
func (m *DeletePeerRequest) Size() (n int) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -1586,18 +1451,6 @@ func (this *NewPeerRequest) String() string {
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
func (this *AddPeerRequest) String() string {
|
|
||||||
if this == nil {
|
|
||||||
return "nil"
|
|
||||||
}
|
|
||||||
s := strings.Join([]string{`&AddPeerRequest{`,
|
|
||||||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
|
||||||
`Peer:` + strings.Replace(fmt.Sprintf("%v", this.Peer), "Peer", "Peer", 1) + `,`,
|
|
||||||
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
|
||||||
`}`,
|
|
||||||
}, "")
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
func (this *DeletePeerRequest) String() string {
|
func (this *DeletePeerRequest) String() string {
|
||||||
if this == nil {
|
if this == nil {
|
||||||
return "nil"
|
return "nil"
|
||||||
|
@ -2202,128 +2055,6 @@ func (m *NewPeerRequest) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m *AddPeerRequest) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowGuard
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: AddPeerRequest: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: AddPeerRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowGuard
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.ID = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowGuard
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Peer == nil {
|
|
||||||
m.Peer = &Peer{}
|
|
||||||
}
|
|
||||||
if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipGuard(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if skippy < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) < 0 {
|
|
||||||
return ErrInvalidLengthGuard
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *DeletePeerRequest) Unmarshal(dAtA []byte) error {
|
func (m *DeletePeerRequest) Unmarshal(dAtA []byte) error {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|
|
@ -16,8 +16,6 @@ service Wireguard {
|
||||||
rpc List(google.protobuf.Empty) returns (ListResponse);
|
rpc List(google.protobuf.Empty) returns (ListResponse);
|
||||||
// NewPeer to the tunnel with gernerated keys
|
// NewPeer to the tunnel with gernerated keys
|
||||||
rpc NewPeer(NewPeerRequest) returns (PeerResponse);
|
rpc NewPeer(NewPeerRequest) returns (PeerResponse);
|
||||||
// AddPeer to the tunnel
|
|
||||||
rpc AddPeer(AddPeerRequest) returns (TunnelResponse);
|
|
||||||
// DeletePeer from a tunnel
|
// DeletePeer from a tunnel
|
||||||
rpc DeletePeer(DeletePeerRequest) returns (TunnelResponse);
|
rpc DeletePeer(DeletePeerRequest) returns (TunnelResponse);
|
||||||
}
|
}
|
||||||
|
@ -45,12 +43,6 @@ message NewPeerRequest {
|
||||||
string address = 3;
|
string address = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddPeerRequest {
|
|
||||||
// id of the tunnel
|
|
||||||
string id = 1 [(gogoproto.customname) = "ID"];
|
|
||||||
Peer peer = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeletePeerRequest {
|
message DeletePeerRequest {
|
||||||
// id of the tunnel
|
// id of the tunnel
|
||||||
string id = 1 [(gogoproto.customname) = "ID"];
|
string id = 1 [(gogoproto.customname) = "ID"];
|
||||||
|
|
41
main.go
41
main.go
|
@ -290,47 +290,6 @@ var peersCommand = cli.Command{
|
||||||
return t.Render(os.Stdout)
|
return t.Render(os.Stdout)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "add",
|
|
||||||
Description: "add a peer",
|
|
||||||
Flags: []cli.Flag{
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "key,k",
|
|
||||||
Usage: "public key",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "ip,i",
|
|
||||||
Usage: "ip cidr for the peer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Action: func(clix *cli.Context) error {
|
|
||||||
conn, err := grpc.Dial(clix.GlobalString("address"), grpc.WithInsecure())
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "dial server")
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
var (
|
|
||||||
ctx = cancelContext()
|
|
||||||
client = v1.NewWireguardClient(conn)
|
|
||||||
)
|
|
||||||
|
|
||||||
r, err := client.AddPeer(ctx, &v1.AddPeerRequest{
|
|
||||||
ID: clix.GlobalString("tunnel"),
|
|
||||||
Peer: &v1.Peer{
|
|
||||||
ID: clix.Args().First(),
|
|
||||||
PublicKey: clix.String("key"),
|
|
||||||
AllowedIPs: []string{
|
|
||||||
clix.String("ip"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return jsonTunnel(r.Tunnel)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "delete",
|
Name: "delete",
|
||||||
Description: "delete a peer",
|
Description: "delete a peer",
|
||||||
|
|
46
server.go
46
server.go
|
@ -126,6 +126,8 @@ func (s *server) Create(ctx context.Context, r *v1.CreateRequest) (*v1.TunnelRes
|
||||||
return nil, errors.Wrap(err, "start tunnel")
|
return nil, errors.Wrap(err, "start tunnel")
|
||||||
}
|
}
|
||||||
log.Info("tunnel created")
|
log.Info("tunnel created")
|
||||||
|
|
||||||
|
clearTunnel(&t)
|
||||||
return &v1.TunnelResponse{
|
return &v1.TunnelResponse{
|
||||||
Tunnel: &t,
|
Tunnel: &t,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -162,7 +164,8 @@ func (s *server) NewPeer(ctx context.Context, r *v1.NewPeerRequest) (*v1.PeerRes
|
||||||
r.Address,
|
r.Address,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
t.Peers = append(t.Peers, peer)
|
peerCopy := *peer
|
||||||
|
t.Peers = append(t.Peers, &peerCopy)
|
||||||
// TODO: make atomic swaps
|
// TODO: make atomic swaps
|
||||||
if err := s.saveTunnel(t); err != nil {
|
if err := s.saveTunnel(t); err != nil {
|
||||||
log.WithError(err).Error("save tunnel")
|
log.WithError(err).Error("save tunnel")
|
||||||
|
@ -176,43 +179,13 @@ func (s *server) NewPeer(ctx context.Context, r *v1.NewPeerRequest) (*v1.PeerRes
|
||||||
log.WithError(err).Error("restart config")
|
log.WithError(err).Error("restart config")
|
||||||
return nil, errors.Wrap(err, "restart tunnel")
|
return nil, errors.Wrap(err, "restart tunnel")
|
||||||
}
|
}
|
||||||
|
clearTunnel(t)
|
||||||
return &v1.PeerResponse{
|
return &v1.PeerResponse{
|
||||||
Tunnel: t,
|
Tunnel: t,
|
||||||
Peer: peer,
|
Peer: peer,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) AddPeer(ctx context.Context, r *v1.AddPeerRequest) (*v1.TunnelResponse, error) {
|
|
||||||
if r.ID == "" {
|
|
||||||
return nil, errors.New("tunnel id cannot be empty")
|
|
||||||
}
|
|
||||||
log := logrus.WithFields(logrus.Fields{
|
|
||||||
"tunnel": r.ID,
|
|
||||||
"peer": r.Peer.ID,
|
|
||||||
})
|
|
||||||
t, err := s.loadTunnel(r.ID)
|
|
||||||
if err != nil {
|
|
||||||
log.WithError(err).Error("load tunnel")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
t.Peers = append(t.Peers, r.Peer)
|
|
||||||
|
|
||||||
if err := s.saveTunnel(t); err != nil {
|
|
||||||
log.WithError(err).Error("save tunnel")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := s.saveConf(t); err != nil {
|
|
||||||
log.WithError(err).Error("save config")
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := wgquick(ctx, "restart", t.ID); err != nil {
|
|
||||||
return nil, errors.Wrap(err, "restart tunnel")
|
|
||||||
}
|
|
||||||
return &v1.TunnelResponse{
|
|
||||||
Tunnel: t,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *server) DeletePeer(ctx context.Context, r *v1.DeletePeerRequest) (*v1.TunnelResponse, error) {
|
func (s *server) DeletePeer(ctx context.Context, r *v1.DeletePeerRequest) (*v1.TunnelResponse, error) {
|
||||||
if r.ID == "" {
|
if r.ID == "" {
|
||||||
return nil, errors.New("tunnel id cannot be empty")
|
return nil, errors.New("tunnel id cannot be empty")
|
||||||
|
@ -247,6 +220,7 @@ func (s *server) DeletePeer(ctx context.Context, r *v1.DeletePeerRequest) (*v1.T
|
||||||
return nil, errors.Wrap(err, "restart tunnel")
|
return nil, errors.Wrap(err, "restart tunnel")
|
||||||
}
|
}
|
||||||
log.Info("delete peer")
|
log.Info("delete peer")
|
||||||
|
clearTunnel(t)
|
||||||
return &v1.TunnelResponse{
|
return &v1.TunnelResponse{
|
||||||
Tunnel: t,
|
Tunnel: t,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -293,6 +267,7 @@ func (s *server) List(ctx context.Context, _ *types.Empty) (*v1.ListResponse, er
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
clearTunnel(t)
|
||||||
r.Tunnels = append(r.Tunnels, t)
|
r.Tunnels = append(r.Tunnels, t)
|
||||||
}
|
}
|
||||||
return &r, nil
|
return &r, nil
|
||||||
|
@ -353,6 +328,13 @@ func publicKey(ctx context.Context, privateKey string) (string, error) {
|
||||||
return strings.TrimSuffix(string(data), "\n"), nil
|
return strings.TrimSuffix(string(data), "\n"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clearTunnel(t *v1.Tunnel) {
|
||||||
|
t.PrivateKey = ""
|
||||||
|
for _, p := range t.Peers {
|
||||||
|
p.PrivateKey = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func wireguard(ctx context.Context, args ...string) ([]byte, error) {
|
func wireguard(ctx context.Context, args ...string) ([]byte, error) {
|
||||||
cmd := exec.CommandContext(ctx, "wg", args...)
|
cmd := exec.CommandContext(ctx, "wg", args...)
|
||||||
return cmd.CombinedOutput()
|
return cmd.CombinedOutput()
|
||||||
|
|
Loading…
Add table
Reference in a new issue