-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathipsec.go
290 lines (241 loc) · 11.4 KB
/
ipsec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Ipsec is a generated struct representing the Sophos Ipsec Endpoint
// GET /api/nodes/ipsec
type Ipsec struct {
Advanced struct {
CrlAutoFetching int64 `json:"crl_auto_fetching"`
CrlStrictPolicy int64 `json:"crl_strict_policy"`
DeadPeerDetection int64 `json:"dead_peer_detection"`
IkeDebug []interface{} `json:"ike_debug"`
IkePort int64 `json:"ike_port"`
Metric int64 `json:"metric"`
NatTraversal int64 `json:"nat_traversal"`
NatTraversalKeepalive int64 `json:"nat_traversal_keepalive"`
ProbePsk int64 `json:"probe_psk"`
PskVpnID string `json:"psk_vpn_id"`
PskVpnIDType string `json:"psk_vpn_id_type"`
} `json:"advanced"`
Connections []interface{} `json:"connections"`
LocalRsa string `json:"local_rsa"`
LocalX509 string `json:"local_x509"`
Status int64 `json:"status"`
}
var _ sophos.Endpoint = &Ipsec{}
var defsIpsec = map[string]sophos.RestObject{
"IpsecGroup": &IpsecGroup{},
"IpsecPolicy": &IpsecPolicy{},
"IpsecRemoteGateway": &IpsecRemoteGateway{},
}
// RestObjects implements the sophos.Node interface and returns a map of Ipsec's Objects
func (Ipsec) RestObjects() map[string]sophos.RestObject { return defsIpsec }
// GetPath implements sophos.RestGetter
func (*Ipsec) GetPath() string { return "/api/nodes/ipsec" }
// RefRequired implements sophos.RestGetter
func (*Ipsec) RefRequired() (string, bool) { return "", false }
var defIpsec = &sophos.Definition{Description: "ipsec", Name: "ipsec", Link: "/api/definitions/ipsec"}
// Definition returns the /api/definitions struct of Ipsec
func (Ipsec) Definition() sophos.Definition { return *defIpsec }
// ApiRoutes returns all known Ipsec Paths
func (Ipsec) ApiRoutes() []string {
return []string{
"/api/objects/ipsec/group/",
"/api/objects/ipsec/group/{ref}",
"/api/objects/ipsec/group/{ref}/usedby",
"/api/objects/ipsec/policy/",
"/api/objects/ipsec/policy/{ref}",
"/api/objects/ipsec/policy/{ref}/usedby",
"/api/objects/ipsec/remote_gateway/",
"/api/objects/ipsec/remote_gateway/{ref}",
"/api/objects/ipsec/remote_gateway/{ref}/usedby",
}
}
// References returns the Ipsec's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Ipsec) References() []string {
return []string{
"REF_IpsecGroup",
"REF_IpsecPolicy",
"REF_IpsecRemoteGateway",
}
}
// IpsecGroups is an Sophos Endpoint subType and implements sophos.RestObject
type IpsecGroups []IpsecGroup
// IpsecGroup represents a UTM group
type IpsecGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &IpsecGroup{}
// GetPath implements sophos.RestObject and returns the IpsecGroups GET path
// Returns all available ipsec/group objects
func (*IpsecGroups) GetPath() string { return "/api/objects/ipsec/group/" }
// RefRequired implements sophos.RestObject
func (*IpsecGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the IpsecGroups GET path
// Returns all available group types
func (i *IpsecGroup) GetPath() string { return fmt.Sprintf("/api/objects/ipsec/group/%s", i.Reference) }
// RefRequired implements sophos.RestObject
func (i *IpsecGroup) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the IpsecGroup DELETE path
// Creates or updates the complete object group
func (*IpsecGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the IpsecGroup PATCH path
// Changes to parts of the object group types
func (*IpsecGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the IpsecGroup POST path
// Create a new ipsec/group object
func (*IpsecGroup) PostPath() string {
return "/api/objects/ipsec/group/"
}
// PutPath implements sophos.RestObject and returns the IpsecGroup PUT path
// Creates or updates the complete object group
func (*IpsecGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*IpsecGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/group/%s/usedby", ref)
}
// IpsecPolicys is an Sophos Endpoint subType and implements sophos.RestObject
type IpsecPolicys []IpsecPolicy
// IpsecPolicy represents a UTM IPsec policy
type IpsecPolicy struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
// IkeAuthAlg can be one of: []string{"md5", "sha1", "sha2_256", "sha2_384", "sha2_512"}
IkeAuthAlg string `json:"ike_auth_alg"`
// IkeDhGroup can be one of: []string{"modp768", "modp1024", "modp1536", "modp2048", "modp3072", "modp4096"}
IkeDhGroup string `json:"ike_dh_group"`
// IkeEncAlg can be one of: []string{"des", "3des", "aes128", "aes192", "aes256", "blowfish128", "twofish128", "serpent128"}
IkeEncAlg string `json:"ike_enc_alg"`
IkeSaLifetime int `json:"ike_sa_lifetime"`
// IpsecAuthAlg can be one of: []string{"md5", "sha1", "sha2_256", "sha2_384", "sha2_512", "sha2_256_96", "sha2_384_96", "sha2_512_96"}
// IpsecAuthAlg default value is "sha1"
IpsecAuthAlg string `json:"ipsec_auth_alg"`
// IpsecCompression default value is false
IpsecCompression bool `json:"ipsec_compression"`
// IpsecEncAlg can be one of: []string{"null", "des", "3des", "blowfish128", "twofish128", "serpent128", "aes128", "aes192", "aes256", "aes128ctr", "aes192ctr", "aes256ctr", "aes128gcm12", "aes192gcm12", "aes256gcm12", "aes128gcm16", "aes192gcm16", "aes256gcm16"}
IpsecEncAlg string `json:"ipsec_enc_alg"`
// IpsecPfsGroup can be one of: []string{"null", "modp768", "modp1024", "modp1536", "modp2048", "modp3072", "modp4096"}
IpsecPfsGroup string `json:"ipsec_pfs_group"`
IpsecSaLifetime int `json:"ipsec_sa_lifetime"`
// IpsecStrictPolicy default value is false
IpsecStrictPolicy bool `json:"ipsec_strict_policy"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &IpsecPolicy{}
// GetPath implements sophos.RestObject and returns the IpsecPolicys GET path
// Returns all available ipsec/policy objects
func (*IpsecPolicys) GetPath() string { return "/api/objects/ipsec/policy/" }
// RefRequired implements sophos.RestObject
func (*IpsecPolicys) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the IpsecPolicys GET path
// Returns all available policy types
func (i *IpsecPolicy) GetPath() string {
return fmt.Sprintf("/api/objects/ipsec/policy/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *IpsecPolicy) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the IpsecPolicy DELETE path
// Creates or updates the complete object policy
func (*IpsecPolicy) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/policy/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the IpsecPolicy PATCH path
// Changes to parts of the object policy types
func (*IpsecPolicy) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/policy/%s", ref)
}
// PostPath implements sophos.RestObject and returns the IpsecPolicy POST path
// Create a new ipsec/policy object
func (*IpsecPolicy) PostPath() string {
return "/api/objects/ipsec/policy/"
}
// PutPath implements sophos.RestObject and returns the IpsecPolicy PUT path
// Creates or updates the complete object policy
func (*IpsecPolicy) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/policy/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*IpsecPolicy) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/policy/%s/usedby", ref)
}
// IpsecRemoteGateways is an Sophos Endpoint subType and implements sophos.RestObject
type IpsecRemoteGateways []IpsecRemoteGateway
// IpsecRemoteGateway represents a UTM IPsec remote gateway
type IpsecRemoteGateway struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// Authentication description: REF(ipsec_remote_auth/*)
Authentication string `json:"authentication"`
Comment string `json:"comment"`
// Ecn default value is false
Ecn bool `json:"ecn"`
// Host description: REF(network/host), REF(network/dns_host), REF(network/network), REF(network/any), REF(network/availability_group)
Host string `json:"host"`
Name string `json:"name"`
Networks []string `json:"networks"`
// PmtuDiscovery default value is false
PmtuDiscovery bool `json:"pmtu_discovery"`
// Xauth default value is false
Xauth bool `json:"xauth"`
// XauthPassword default value is ""
XauthPassword string `json:"xauth_password"`
// XauthUsername default value is ""
XauthUsername string `json:"xauth_username"`
}
var _ sophos.RestGetter = &IpsecRemoteGateway{}
// GetPath implements sophos.RestObject and returns the IpsecRemoteGateways GET path
// Returns all available ipsec/remote_gateway objects
func (*IpsecRemoteGateways) GetPath() string { return "/api/objects/ipsec/remote_gateway/" }
// RefRequired implements sophos.RestObject
func (*IpsecRemoteGateways) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the IpsecRemoteGateways GET path
// Returns all available remote_gateway types
func (i *IpsecRemoteGateway) GetPath() string {
return fmt.Sprintf("/api/objects/ipsec/remote_gateway/%s", i.Reference)
}
// RefRequired implements sophos.RestObject
func (i *IpsecRemoteGateway) RefRequired() (string, bool) { return i.Reference, true }
// DeletePath implements sophos.RestObject and returns the IpsecRemoteGateway DELETE path
// Creates or updates the complete object remote_gateway
func (*IpsecRemoteGateway) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/remote_gateway/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the IpsecRemoteGateway PATCH path
// Changes to parts of the object remote_gateway types
func (*IpsecRemoteGateway) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/remote_gateway/%s", ref)
}
// PostPath implements sophos.RestObject and returns the IpsecRemoteGateway POST path
// Create a new ipsec/remote_gateway object
func (*IpsecRemoteGateway) PostPath() string {
return "/api/objects/ipsec/remote_gateway/"
}
// PutPath implements sophos.RestObject and returns the IpsecRemoteGateway PUT path
// Creates or updates the complete object remote_gateway
func (*IpsecRemoteGateway) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/remote_gateway/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*IpsecRemoteGateway) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ipsec/remote_gateway/%s/usedby", ref)
}