[augeas-devel] Re: [Sudoers] Sudoers lens: first demo from scratch

Raphaël Pinson raphink at gmail.com
Wed Aug 13 08:07:32 UTC 2008


A bit of a nicer example:



   1. $ rm fakeroot/etc/sudoers
   2.
   3.  $ augtool -I . -r fakeroot/
   4. augtool> set /files/etc/sudoers/Host_Alias/alias/name "LOCALNET"
   5. augtool> set /files/etc/sudoers/Host_Alias/alias/host "127.0.0.1"
   6. augtool> set /files/etc/sudoers/Host_Alias/alias/host[2] "localhost"
   7. augtool> set /files/etc/sudoers/Host_Alias/alias[2]/name "MONREZO"
   8. augtool> set /files/etc/sudoers/Host_Alias/alias[2]/host "10.1.2.3"
   9. augtool> set /files/etc/sudoers/Cmnd_Alias/alias/name "PBUILDER"
   10. augtool> set /files/etc/sudoers/Cmnd_Alias/alias/command
   "/usr/sbin/pbuilder"
   11. augtool> set
/files/etc/sudoers/Cmnd_Alias/alias/command[2]"/usr/local/bin/build-repository"
   12. augtool> set /files/etc/sudoers/Defaults/type ":buildd"
   13. augtool> set /files/etc/sudoers/Defaults/parameter
   'env_keep+="APT_CONFIG DEBIAN_FRONTEND SHELL"'
   14. augtool> set /files/etc/sudoers/spec/user "root"
   15. augtool> set /files/etc/sudoers/spec/host_group/host "ALL"
   16. augtool> set /files/etc/sudoers/spec/host_group/command "ALL"
   17. augtool> set /files/etc/sudoers/spec/host_group/command/runas_user
   "ALL"
   18. augtool> set /files/etc/sudoers/spec[2]/user "%pbuilder"
   19. augtool> set /files/etc/sudoers/spec[2]/host_group/host "ALL"
   20. augtool> set /files/etc/sudoers/spec[2]/host_group/command "PBUILDER"
   21. augtool> set /files/etc/sudoers/spec[2]/host_group/command/tag
   "NOPASSWD"
   22. augtool> ins spec after /files/etc/sudoers/spec[last()]
   23. augtool> set /files/etc/sudoers/spec[last()]/user "bb"
   24. augtool> set /files/etc/sudoers/spec[last()]/host_group/host "ALL"
   25. augtool> set /files/etc/sudoers/spec[last()]/host_group/command
   "/usr/local/bb/ext/bb-mail.sh"
   26. augtool> set /files/etc/sudoers/spec[last()]/host_group/command/tag
   "NOPASSWD"
   27. augtool> set
/files/etc/sudoers/spec[last()]/host_group/command/runas_user
   "postfix"
   28. augtool> ins comment before /files/etc/sudoers/Host_Alias
   29. augtool> set /files/etc/sudoers/comment "This is a sudoers file"
   30. augtool> ins comment before /files/etc/sudoers/spec[1]
   31. augtool> set /files/etc/sudoers/comment[2] "User specs"
   32. augtool> save
   33. augtool> quit
   34.
   35.  $ cat fakeroot/etc/sudoers
   36. #  This is a sudoers file
   37. Host_Alias LOCALNET = 127.0.0.1 , localhost : MONREZO = 10.1.2.3
   38. Cmnd_Alias PBUILDER = /usr/sbin/pbuilder ,
   /usr/local/bin/build-repository
   39. Defaults:buildd env_keep+="APT_CONFIG DEBIAN_FRONTEND SHELL"
   40. #  User specs
   41. root ALL = (ALL) ALL
   42. %pbuilder ALL = NOPASSWD : PBUILDER
   43. bb ALL = NOPASSWD : /usr/local/bb/ext/bb-mail.sh





On Tue, Aug 12, 2008 at 12:35 PM, Raphaël Pinson <raphink at gmail.com> wrote:

>
>
> On Tue, Aug 12, 2008 at 12:27 PM, Raphaël Pinson <raphink at gmail.com>wrote:
>
>> From an inexistent file
>>
>>  $ augtool -I . -r fakeroot/
>> augtool> set /files/etc/sudoers/Host_Alias/alias/name "LOCALNET"
>> augtool> set /files/etc/sudoers/Host_Alias/alias/host "127.0.0.1"
>> augtool> set /files/etc/sudoers/Host_Alias/alias/host[2] "localhost"
>> augtool> set /files/etc/sudoers/Host_Alias/alias[2]/name "MONREZO"
>> augtool> set /files/etc/sudoers/Host_Alias/alias[2]/host "10.1.2.3"
>> augtool> set /files/etc/sudoers/Cmnd_Alias/alias/name "PBUILDER"
>> augtool> set /files/etc/sudoers/Cmnd_Alias/alias/command
>> "/usr/sbin/pbuilder"
>> augtool> set /files/etc/sudoers/Cmnd_Alias/alias/command[2]
>> "/usr/local/bin/build-repository"
>> augtool> set /files/etc/sudoers/Defaults/type ":buildd"
>> augtool> set /files/etc/sudoers/Defaults/parameter "env_keep+=\"APT_CONFIG
>> DEBIAN_FRONTEND SHELL\""
>> Too many arguments: 'DEBIAN_FRONTEND SHELL\""' not used
>> Too many arguments for set
>> augtool> set /files/etc/sudoers/Defaults/parameter
>> "env_keep+=\\"APT_CONFIG DEBIAN_FRONTEND SHELL\\""
>> Too many arguments: 'DEBIAN_FRONTEND SHELL\\""' not used
>> Too many arguments for set
>> augtool> set /files/etc/sudoers/Defaults/parameter
>> "env_keep+=\\\"APT_CONFIG DEBIAN_FRONTEND SHELL\\\""
>> Too many arguments: 'DEBIAN_FRONTEND SHELL\\\""' not used
>> Too many arguments for set
>> augtool> set /files/etc/sudoers/Defaults/parameter
>> "env_keep+=\\\\"APT_CONFIG DEBIAN_FRONTEND SHELL\\\\""
>> Too many arguments: 'DEBIAN_FRONTEND SHELL\\\\""' not used
>> Too many arguments for set
>> augtool> set /files/etc/sudoers/Defaults/parameter "env_keep+='APT_CONFIG
>> DEBIAN_FRONTEND SHELL'"
>> augtool> set /files/etc/sudoers/spec/user "root"
>> augtool> set /files/etc/sudoers/spec/host_group/host "ALL"
>> augtool> set /files/etc/sudoers/spec/host_group/command "ALL"
>> augtool> set /files/etc/sudoers/spec/host_group/command/runas_user "ALL"
>> augtool> set /files/etc/sudoers/spec[2]/user "%pbuilder"
>> augtool> set /files/etc/sudoers/spec[2]/host_group/host "ALL"
>> augtool> set /files/etc/sudoers/spec[2]/host_group/command "PBUILDER"
>> augtool> set /files/etc/sudoers/spec[2]/host_group/command/tag "NOPASSWD"
>> augtool> save
>>
>>  $ cat fakeroot/etc/sudoers
>> Host_Alias LOCALNET = 127.0.0.1 , localhost : MONREZO = 10.1.2.3
>> Cmnd_Alias PBUILDER = /usr/sbin/pbuilder , /usr/local/bin/build-repository
>> Defaults:buildd env_keep+='APT_CONFIG DEBIAN_FRONTEND SHELL'
>> root ALL = (ALL) ALL
>> %pbuilder ALL = NOPASSWD : PBUILDER
>>
>>
>
> Note: env_keep+='APT_CONFIG DEBIAN_FRONTEND SHELL' is a syntax error
> (visudo doesn't like it) but I couldn't find how to set the " with
> augtool...
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080813/5b007295/attachment.htm>


More information about the augeas-devel mailing list