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
|
module Test_sudoers =
let conf = "
Host_Alias LOCALNET = 192.168.0.0/24, localhost
# User alias specification
User_Alias EXAMPLE_ADMINS = cslack, EXAMPLE\\\\cslack,\
EXAMPLE\\\\jmalstrom
# Cmnd alias specification
Cmnd_Alias \
DEBIAN_TOOLS \
= \
/usr/bin/apt-get,\
/usr/bin/auto-get, \
/usr/bin/dpkg, /usr/bin/dselect, /usr/sbin/dpkg-reconfigure \
: PBUILDER = /usr/sbin/pbuilder
Cmnd_Alias ICAL = /bin/cat /home/rpinson/.kde/share/apps/korganizer/std.ics
Defaults@LOCALNET !lecture, \
\t\t tty_tickets,!fqdn, !!env_reset
Defaults:buildd env_keep+=\"APT_CONFIG DEBIAN_FRONTEND SHELL\"
# User privilege specification
root ALL=(ALL) ALL
root ALL=(: ALL) ALL
root ALL=(ALL :ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL, NOPASSWD : NOSETENV: \
DEBIAN_TOOLS
%pbuilder LOCALNET = NOPASSWD: PBUILDER
www-data +biglab=(rpinson)NOEXEC: ICAL \
: \
localhost = NOPASSWD: /usr/bin/test
+secretaries ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
@my\ admin\ group ALL=(root) NOPASSWD: /usr/bin/python /usr/local/sbin/filterlog -iu\\=www /var/log/something.log
#includedir /etc/sudoers.d
#include /etc/sudoers.d
"
test Sudoers.lns get conf =
{}
{ "Host_Alias"
{ "alias"
{ "name" = "LOCALNET" }
{ "host" = "192.168.0.0/24" }
{ "host" = "localhost" } } }
{}
{ "#comment" = "User alias specification" }
{}
{ "User_Alias"
{ "alias"
{ "name" = "EXAMPLE_ADMINS" }
{ "user" = "cslack" }
{ "user" = "EXAMPLE\\\\cslack" }
{ "user" = "EXAMPLE\\\\jmalstrom" } } }
{}
{ "#comment" = "Cmnd alias specification" }
{}
{ "Cmnd_Alias"
{ "alias"
{ "name" = "DEBIAN_TOOLS" }
{ "command" = "/usr/bin/apt-get" }
{ "command" = "/usr/bin/auto-get" }
{ "command" = "/usr/bin/dpkg" }
{ "command" = "/usr/bin/dselect" }
{ "command" = "/usr/sbin/dpkg-reconfigure" } }
{ "alias"
{ "name" = "PBUILDER" }
{ "command" = "/usr/sbin/pbuilder" } } }
{}
{ "Cmnd_Alias"
{ "alias"
{ "name" = "ICAL" }
{ "command" = "/bin/cat /home/rpinson/.kde/share/apps/korganizer/std.ics" } } }
{}
{ "Defaults"
{ "type" = "@LOCALNET" }
{ "lecture" { "negate" } }
{ "tty_tickets" }
{ "fqdn" { "negate" } }
{ "env_reset" } }
{}
{ "Defaults"
{ "type" = ":buildd" }
{ "env_keep"
{ "append" }
{ "var" = "APT_CONFIG" }
{ "var" = "DEBIAN_FRONTEND" }
{ "var" = "SHELL" } } }
{}
{ "#comment" = "User privilege specification" }
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" } } } }
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_group" = "ALL" } } } }
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" }
{ "runas_group" = "ALL" } } } }
{}
{ "#comment" = "Members of the admin group may gain root privileges" }
{ "spec"
{ "user" = "%admin" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" } }
{ "command" = "DEBIAN_TOOLS"
{ "tag" = "NOPASSWD" }
{ "tag" = "NOSETENV" } } } }
{ "spec"
{ "user" = "%pbuilder" }
{ "host_group"
{ "host" = "LOCALNET" }
{ "command" = "PBUILDER"
{ "tag" = "NOPASSWD" } } } }
{ "spec"
{ "user" = "www-data" }
{ "host_group"
{ "host" = "+biglab" }
{ "command" = "ICAL"
{ "runas_user" = "rpinson" }
{ "tag" = "NOEXEC" } } }
{ "host_group"
{ "host" = "localhost" }
{ "command" = "/usr/bin/test"
{ "tag" = "NOPASSWD" } } } }
{}
{ "spec"
{ "user" = "+secretaries" }
{ "host_group"
{ "host" = "ALPHA" }
{ "command" = "/usr/bin/su [!-]*" }
{ "command" = "!/usr/bin/su *root*" } } }
{}
{ "spec"
{ "user" = "@my\ admin\ group" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "/usr/bin/python /usr/local/sbin/filterlog -iu\\=www /var/log/something.log"
{ "runas_user" = "root" }
{ "tag" = "NOPASSWD" }
}
}
}
{ "#includedir" = "/etc/sudoers.d" }
{ "#include" = "/etc/sudoers.d" }
test Sudoers.parameter_integer_bool
put "umask = 022"
after set "/umask/negate" "" = "!umask"
test Sudoers.parameter_integer_bool
put "!!!!!umask"
after rm "/umask/negate"; set "/umask" "022" = "!!!!umask = 022"
test Sudoers.parameter_integer_bool put "!!!!umask = 022" after
set "/umask/negate" "" = "!!!!!umask"
test Sudoers.parameter_integer_bool get "!!!umask = 022" = *
(* BZ 566134 *)
let s = "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin\n"
test Sudoers.lns get s =
{ "Defaults"
{ "secure_path" = "/sbin:/bin:/usr/sbin:/usr/bin" } }
(* Ticket #206, comments at end of lines *)
let commenteol = "#
Defaults targetpw # ask for
Host_Alias LOCALNET = 192.168.0.0/24 # foo eol
root ALL=(ALL) ALL # all root\n"
test Sudoers.lns get commenteol =
{}
{ "Defaults"
{ "targetpw" }
{ "#comment" = "ask for" } }
{ "Host_Alias"
{ "alias"
{ "name" = "LOCALNET" }
{ "host" = "192.168.0.0/24" } }
{ "#comment" = "foo eol" } }
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" } } }
{ "#comment" = "all root" } }
|