-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdescriptor.go
90 lines (79 loc) · 2.54 KB
/
descriptor.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
package securepassctl
// ApplicationDescriptor describes the basic attributes of
// a Securepass application
type ApplicationDescriptor struct {
Label string `json:"label"`
Realm string `json:"realm"`
Group string `json:"group"`
Write bool `json:"write"`
AllowNetworkIPv4 string `json:"allow_network_ipv4"`
AllowNetworkIPv6 string `json:"allow_network_ipv6"`
Privacy bool `json:"privacy"`
}
// UserDescriptor defines the attributes of SecurePass users
type UserDescriptor struct {
Username string `json:"USERNAME"`
Name string `json:"NAME"`
Surname string `json:"SURNAME"`
Email string `json:"EMAIL"`
Mobile string `json:"MOBILE"`
Nin string `json:"NIN"`
Rfid string `json:"RFID"`
Manager string `json:"MANAGER"`
Seclevel string `json:"SECLEVEL"`
Type string
Password bool
Enabled bool
Token string
}
// XattrsDescriptor defines a set of extended attributes
type XattrsDescriptor map[string]interface{}
// RadiusDescriptor defines the attributes of SecurePass RADIUS devices
type RadiusDescriptor struct {
Radius string
Name string
Secret string
Group string
Realm string
Rfid bool
}
// GroupDescriptor defines attributes of Group
type GroupDescriptor struct {
Group string `json:"GROUP"`
Description string `json:"DESCRIPTION"`
Realm string `json:"REALM"`
}
// LogEntry is a SecurePass application's log entry
type LogEntry struct {
// SecurePass response is currently broken, this
// should be a time.Time object.
Timestamp string
UUID string
Message string
Level int
App string
Realm string
}
// LogEntriesByTimestamp sorts log entries by timestamp
type LogEntriesByTimestamp []LogEntry
func (l LogEntriesByTimestamp) Less(i, j int) bool { return l[i].Timestamp < l[j].Timestamp }
func (l LogEntriesByTimestamp) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
func (l LogEntriesByTimestamp) Len() int { return len(l) }
// NSSConfig encapsulates the SecurePass's config section '[nss]'
type NSSConfig struct {
Realm string `ini:"realm"`
DefaultGid int `ini:"default_gid"`
DefaultHome string `ini:"default_home"`
DefaultShell string `ini:"default_shell"`
}
// SSHConfig encapsulates the SecurePass's config section '[ssh]'
type SSHConfig struct {
Root string `ini:"root"`
StripDomain string `ini:"strip_windows_domain"`
}
// GlobalConfig encapsulates the SecurePass's whole configuration
type GlobalConfig struct {
SecurePass `ini:"default"`
NSSConfig `ini:"nss"`
SSHConfig `ini:"ssh"`
}