/usr/share/augeas/lenses/dist/tests/test_sudoers.aug is in augeas-lenses 1.4.0-0ubuntu1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | (* Module: Test_sudoers *)
module Test_sudoers =
let test_user = [ label "user" . Sudoers.sto_to_com_user . Util.eol ]*
(* Test: test_user *)
test test_user get "root
@pbuilder
+secre-taries
@my\ admin\ group
EXAMPLE\\\\cslack
MY\ EX-AMPLE\ 9\\\\cslack\ group
" =
{ "user" = "root" }
{ "user" = "@pbuilder" }
{ "user" = "+secre-taries" }
{ "user" = "@my\\ admin\\ group" }
{ "user" = "EXAMPLE\\\\cslack" }
{ "user" = "MY\\ EX-AMPLE\\ 9\\\\cslack\\ group" }
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 !visiblepw
Defaults:buildd env_keep+=\"APT_CONFIG DEBIAN_FRONTEND SHELL\"
Defaults!PBUILDER env_keep+=\"HOME ARCH DIST DISTRIBUTION PDEBUILD_PBUILDER\"
# 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"
{ "visiblepw" { "negate" } } }
{}
{ "Defaults"
{ "type" = ":buildd" }
{ "env_keep"
{ "append" }
{ "var" = "APT_CONFIG" }
{ "var" = "DEBIAN_FRONTEND" }
{ "var" = "SHELL" } } }
{ "Defaults"
{ "type" = "!PBUILDER" }
{ "env_keep"
{ "append" }
{ "var" = "HOME" }
{ "var" = "ARCH" }
{ "var" = "DIST" }
{ "var" = "DISTRIBUTION" }
{ "var" = "PDEBUILD_PBUILDER" } } }
{}
{ "#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" } }
(* Allow = in commands *)
test Sudoers.spec get "root ALL= /usr/bin/mylvmbackup --configfile=/etc/mylvbackup_amanda.conf\n" =
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "/usr/bin/mylvmbackup --configfile=/etc/mylvbackup_amanda.conf" } } }
(* Allow commands without full path
-- if they begin with a lowcase letter *)
test Sudoers.spec get "root ALL= sudoedit /etc/passwd\n" =
{ "spec"
{ "user" = "root" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "sudoedit /etc/passwd" } } }
(* Ticket #263, quoted values in defaults line *)
let defaults_spaces = "Defaults passprompt=\"Your SecurID Passcode: \"\n"
test Sudoers.lns get defaults_spaces =
{ "Defaults"
{ "passprompt" = "\"Your SecurID Passcode: \"" }
}
(* Ticket #263, quoted values in defaults line (string/bool parameters) *)
let defaults_spaces_strbool = "Defaults mailfrom=\"root@example.com\"\n"
test Sudoers.lns get defaults_spaces_strbool =
{ "Defaults"
{ "mailfrom" = "\"root@example.com\"" }
}
(* Test: Sudoers.spec
Spec users can be aliases *)
test Sudoers.spec get "APACHE_ADMIN ALL= ALL\n" =
{ "spec"
{ "user" = "APACHE_ADMIN" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL" } } }
(* Test: Sudoers.spec
Ticket #337: allow period in user names *)
test Sudoers.spec get "user.one somehost = ALL\n" =
{ "spec"
{ "user" = "user.one" }
{ "host_group"
{ "host" = "somehost" }
{ "command" = "ALL" }
}
}
(* Test: Sudoers.spec
Ticket #370: allow underscore in group names *)
test Sudoers.spec get "%sudo_users ALL=(ALL) ALL\n" =
{ "spec"
{ "user" = "%sudo_users" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" } }
}
}
(* Test: Sudoers.spec
Ticket #376: allow uppercase characters in user names *)
test Sudoers.spec get "%GrOup ALL = (ALL) ALL\n" =
{ "spec"
{ "user" = "%GrOup" }
{ "host_group"
{ "host" = "ALL" }
{ "command" = "ALL"
{ "runas_user" = "ALL" } }
}
}
(* Test: Sudoers.spec
allow + in user-/groupnames *)
test Sudoers.spec get "group+user somehost = ALL\n" =
{ "spec"
{ "user" = "group+user" }
{ "host_group"
{ "host" = "somehost" }
{ "command" = "ALL" }
}
}
|