forked from esurdam/go-sophos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssl_vpn.go
384 lines (322 loc) · 15.9 KB
/
ssl_vpn.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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
package objects
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// SslVpn is a generated struct representing the Sophos SslVpn Endpoint
// GET /api/nodes/ssl_vpn
type SslVpn struct {
AuthenticationAlgorithm string `json:"authentication_algorithm"`
Certificate string `json:"certificate"`
Compression int64 `json:"compression"`
DatachannelKeyLifetime int64 `json:"datachannel_key_lifetime"`
Debug int64 `json:"debug"`
DhKeySize string `json:"dh_key_size"`
DuplicateCn int64 `json:"duplicate_cn"`
EncryptionAlgorithm string `json:"encryption_algorithm"`
Hostname string `json:"hostname"`
Interface string `json:"interface"`
InterfaceAddress string `json:"interface_address"`
IPAssignmentPool string `json:"ip_assignment_pool"`
Port int64 `json:"port"`
Protocol string `json:"protocol"`
UserAuthOptional int64 `json:"user_auth_optional"`
}
var _ sophos.Endpoint = &SslVpn{}
var defsSslVpn = map[string]sophos.RestObject{
"SslVpnClientConnection": &SslVpnClientConnection{},
"SslVpnGroup": &SslVpnGroup{},
"SslVpnRemoteAccessProfile": &SslVpnRemoteAccessProfile{},
"SslVpnServerConnection": &SslVpnServerConnection{},
}
// RestObjects implements the sophos.Node interface and returns a map of SslVpn's Objects
func (SslVpn) RestObjects() map[string]sophos.RestObject { return defsSslVpn }
// GetPath implements sophos.RestGetter
func (*SslVpn) GetPath() string { return "/api/nodes/ssl_vpn" }
// RefRequired implements sophos.RestGetter
func (*SslVpn) RefRequired() (string, bool) { return "", false }
var defSslVpn = &sophos.Definition{Description: "ssl_vpn", Name: "ssl_vpn", Link: "/api/definitions/ssl_vpn"}
// Definition returns the /api/definitions struct of SslVpn
func (SslVpn) Definition() sophos.Definition { return *defSslVpn }
// ApiRoutes returns all known SslVpn Paths
func (SslVpn) ApiRoutes() []string {
return []string{
"/api/objects/ssl_vpn/client_connection/",
"/api/objects/ssl_vpn/client_connection/{ref}",
"/api/objects/ssl_vpn/client_connection/{ref}/usedby",
"/api/objects/ssl_vpn/group/",
"/api/objects/ssl_vpn/group/{ref}",
"/api/objects/ssl_vpn/group/{ref}/usedby",
"/api/objects/ssl_vpn/remote_access_profile/",
"/api/objects/ssl_vpn/remote_access_profile/{ref}",
"/api/objects/ssl_vpn/remote_access_profile/{ref}/usedby",
"/api/objects/ssl_vpn/server_connection/",
"/api/objects/ssl_vpn/server_connection/{ref}",
"/api/objects/ssl_vpn/server_connection/{ref}/usedby",
}
}
// References returns the SslVpn's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (SslVpn) References() []string {
return []string{
"REF_SslVpnClientConnection",
"REF_SslVpnGroup",
"REF_SslVpnRemoteAccessProfile",
"REF_SslVpnServerConnection",
}
}
// SslVpnClientConnections is an Sophos Endpoint subType and implements sophos.RestObject
type SslVpnClientConnections []SslVpnClientConnection
// SslVpnClientConnection is a generated Sophos object
type SslVpnClientConnection struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AuthenticationAlgorithm string `json:"authentication_algorithm"`
AutoPfIn string `json:"auto_pf_in"`
AutoPfOut string `json:"auto_pf_out"`
AutoPfrule bool `json:"auto_pfrule"`
CaCert string `json:"ca_cert"`
Certificate string `json:"certificate"`
Comment string `json:"comment"`
Compression bool `json:"compression"`
EncryptionAlgorithm string `json:"encryption_algorithm"`
Engine string `json:"engine"`
Interface string `json:"interface"`
Key string `json:"key"`
LocalNetworks []string `json:"local_networks"`
Name string `json:"name"`
Password string `json:"password"`
PlainServerAddress string `json:"plain_server_address"`
Protocol string `json:"protocol"`
ProxyAuthPass string `json:"proxy_auth_pass"`
ProxyAuthStatus bool `json:"proxy_auth_status"`
ProxyAuthUser string `json:"proxy_auth_user"`
ProxyHost string `json:"proxy_host"`
ProxyPort int64 `json:"proxy_port"`
ProxyStatus bool `json:"proxy_status"`
RemoteNetworks []string `json:"remote_networks"`
ServerAddress string `json:"server_address"`
ServerDn string `json:"server_dn"`
ServerOverrideHostname string `json:"server_override_hostname"`
ServerOverrideStatus bool `json:"server_override_status"`
ServerPort int64 `json:"server_port"`
Status bool `json:"status"`
Username string `json:"username"`
}
var _ sophos.RestGetter = &SslVpnClientConnection{}
// GetPath implements sophos.RestObject and returns the SslVpnClientConnections GET path
// Returns all available ssl_vpn/client_connection objects
func (*SslVpnClientConnections) GetPath() string { return "/api/objects/ssl_vpn/client_connection/" }
// RefRequired implements sophos.RestObject
func (*SslVpnClientConnections) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the SslVpnClientConnections GET path
// Returns all available client_connection types
func (s *SslVpnClientConnection) GetPath() string {
return fmt.Sprintf("/api/objects/ssl_vpn/client_connection/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *SslVpnClientConnection) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the SslVpnClientConnection DELETE path
// Creates or updates the complete object client_connection
func (*SslVpnClientConnection) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/client_connection/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the SslVpnClientConnection PATCH path
// Changes to parts of the object client_connection types
func (*SslVpnClientConnection) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/client_connection/%s", ref)
}
// PostPath implements sophos.RestObject and returns the SslVpnClientConnection POST path
// Create a new ssl_vpn/client_connection object
func (*SslVpnClientConnection) PostPath() string {
return "/api/objects/ssl_vpn/client_connection/"
}
// PutPath implements sophos.RestObject and returns the SslVpnClientConnection PUT path
// Creates or updates the complete object client_connection
func (*SslVpnClientConnection) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/client_connection/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*SslVpnClientConnection) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/client_connection/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *SslVpnClientConnection) GetType() string { return s.ObjectType }
// SslVpnGroups is an Sophos Endpoint subType and implements sophos.RestObject
type SslVpnGroups []SslVpnGroup
// SslVpnGroup represents a UTM group
type SslVpnGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &SslVpnGroup{}
// GetPath implements sophos.RestObject and returns the SslVpnGroups GET path
// Returns all available ssl_vpn/group objects
func (*SslVpnGroups) GetPath() string { return "/api/objects/ssl_vpn/group/" }
// RefRequired implements sophos.RestObject
func (*SslVpnGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the SslVpnGroups GET path
// Returns all available group types
func (s *SslVpnGroup) GetPath() string {
return fmt.Sprintf("/api/objects/ssl_vpn/group/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *SslVpnGroup) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the SslVpnGroup DELETE path
// Creates or updates the complete object group
func (*SslVpnGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the SslVpnGroup PATCH path
// Changes to parts of the object group types
func (*SslVpnGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the SslVpnGroup POST path
// Create a new ssl_vpn/group object
func (*SslVpnGroup) PostPath() string {
return "/api/objects/ssl_vpn/group/"
}
// PutPath implements sophos.RestObject and returns the SslVpnGroup PUT path
// Creates or updates the complete object group
func (*SslVpnGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*SslVpnGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/group/%s/usedby", ref)
}
// SslVpnRemoteAccessProfiles is an Sophos Endpoint subType and implements sophos.RestObject
type SslVpnRemoteAccessProfiles []SslVpnRemoteAccessProfile
// SslVpnRemoteAccessProfile is a generated Sophos object
type SslVpnRemoteAccessProfile struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Aaa []string `json:"aaa"`
AutoPfIn string `json:"auto_pf_in"`
AutoPfrule bool `json:"auto_pfrule"`
Comment string `json:"comment"`
Name string `json:"name"`
Networks []string `json:"networks"`
Status bool `json:"status"`
}
var _ sophos.RestGetter = &SslVpnRemoteAccessProfile{}
// GetPath implements sophos.RestObject and returns the SslVpnRemoteAccessProfiles GET path
// Returns all available ssl_vpn/remote_access_profile objects
func (*SslVpnRemoteAccessProfiles) GetPath() string {
return "/api/objects/ssl_vpn/remote_access_profile/"
}
// RefRequired implements sophos.RestObject
func (*SslVpnRemoteAccessProfiles) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the SslVpnRemoteAccessProfiles GET path
// Returns all available remote_access_profile types
func (s *SslVpnRemoteAccessProfile) GetPath() string {
return fmt.Sprintf("/api/objects/ssl_vpn/remote_access_profile/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *SslVpnRemoteAccessProfile) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the SslVpnRemoteAccessProfile DELETE path
// Creates or updates the complete object remote_access_profile
func (*SslVpnRemoteAccessProfile) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/remote_access_profile/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the SslVpnRemoteAccessProfile PATCH path
// Changes to parts of the object remote_access_profile types
func (*SslVpnRemoteAccessProfile) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/remote_access_profile/%s", ref)
}
// PostPath implements sophos.RestObject and returns the SslVpnRemoteAccessProfile POST path
// Create a new ssl_vpn/remote_access_profile object
func (*SslVpnRemoteAccessProfile) PostPath() string {
return "/api/objects/ssl_vpn/remote_access_profile/"
}
// PutPath implements sophos.RestObject and returns the SslVpnRemoteAccessProfile PUT path
// Creates or updates the complete object remote_access_profile
func (*SslVpnRemoteAccessProfile) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/remote_access_profile/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*SslVpnRemoteAccessProfile) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/remote_access_profile/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *SslVpnRemoteAccessProfile) GetType() string { return s.ObjectType }
// SslVpnServerConnections is an Sophos Endpoint subType and implements sophos.RestObject
type SslVpnServerConnections []SslVpnServerConnection
// SslVpnServerConnection represents a UTM SSL VPN site-to-site server connection
type SslVpnServerConnection struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// AutoPfIn description: REF(packetfilter/packetfilter)
// AutoPfIn default value is ""
AutoPfIn string `json:"auto_pf_in"`
// AutoPfOut description: REF(packetfilter/packetfilter)
// AutoPfOut default value is ""
AutoPfOut string `json:"auto_pf_out"`
LocalNetworks []interface{} `json:"local_networks"`
// StaticIp description: (IPADDR)
// StaticIp default value is "0.0.0.0"
StaticIp string `json:"static_ip"`
// StaticIpStatus default value is false
StaticIpStatus bool `json:"static_ip_status"`
// Status default value is false
Status bool `json:"status"`
// AutoPfrule default value is false
AutoPfrule bool `json:"auto_pfrule"`
Comment string `json:"comment"`
Name string `json:"name"`
// Peer description: REF(aaa/user)
// Peer default value is ""
Peer string `json:"peer"`
RemoteNetworks []interface{} `json:"remote_networks"`
// StaticIp6 description: (IP6ADDR)
// StaticIp6 default value is "::"
StaticIp6 string `json:"static_ip6"`
}
var _ sophos.RestGetter = &SslVpnServerConnection{}
// GetPath implements sophos.RestObject and returns the SslVpnServerConnections GET path
// Returns all available ssl_vpn/server_connection objects
func (*SslVpnServerConnections) GetPath() string { return "/api/objects/ssl_vpn/server_connection/" }
// RefRequired implements sophos.RestObject
func (*SslVpnServerConnections) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the SslVpnServerConnections GET path
// Returns all available server_connection types
func (s *SslVpnServerConnection) GetPath() string {
return fmt.Sprintf("/api/objects/ssl_vpn/server_connection/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *SslVpnServerConnection) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the SslVpnServerConnection DELETE path
// Creates or updates the complete object server_connection
func (*SslVpnServerConnection) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/server_connection/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the SslVpnServerConnection PATCH path
// Changes to parts of the object server_connection types
func (*SslVpnServerConnection) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/server_connection/%s", ref)
}
// PostPath implements sophos.RestObject and returns the SslVpnServerConnection POST path
// Create a new ssl_vpn/server_connection object
func (*SslVpnServerConnection) PostPath() string {
return "/api/objects/ssl_vpn/server_connection/"
}
// PutPath implements sophos.RestObject and returns the SslVpnServerConnection PUT path
// Creates or updates the complete object server_connection
func (*SslVpnServerConnection) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/server_connection/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*SslVpnServerConnection) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/ssl_vpn/server_connection/%s/usedby", ref)
}