Giter Club home page Giter Club logo

puppet-sudo's Introduction

Sudo Puppet module

The definition sudo::directive provides a simple way to write sudo configurations parts.

Use

`directive`s are blocks of literal text as you would write to sudoers.

If you have a class of users named users::virtual and a virtual Group named admin:

class example {
  include sudo
  include users::virtual

  realize(Group['admin'])

  sudo::directive {'admin_users':
    ensure  => present,
    content => "%admin ALL=(ALL) ALL",
    require => Group['admin'],
  }
}

About

This module is provided to you by Camptocamp.

For more information about sudo see http://www.gratisoft.us/sudo/

puppet-sudo's People

Contributors

alanshields avatar amanda-mitchell avatar bendylan avatar ckaenzig avatar fredj avatar mbornoz avatar mcanevet avatar mremy avatar raphink avatar saimonn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-sudo's Issues

wrong workflow in sudo package requirement

the current code in manifests/directive.pp does :

   if versioncmp($::sudoversion,'1.7.2') >= 0 {
         file {"/etc/sudoers.d/${dname}":
              [...]
                    require => Package['sudo'],
         }
     } else {
    fail 'sudo fragments via #includedir is only available since version 1.7.2!'
  }

I think that :

  • the require is not really needed as is versioncmp succeed, sudo is actually installed
  • the fail should check if sudo package is missing, and issue a different error message.

The best solution would be to force package to be installed before comparison, but it's pretty difficult as facts are collected at early state.
So, I'd say a solution "better than now" would be :

if versioncmp() {
     do the stuff
} else {
     if sudo not installed {
         install it
         fail with "Sudo has just been installed, please restart puppet"
     } else {
        fail with 'sudo fragments via #includedir is only available since version 1.7.2!'
     }
}

Not sure how we can easily do this with puppet, maybe just make Package['sudo'] -> Class['sudo'] so that we ensure sudo package is installed before versioncmp is called ?

Anyway, such a solution will need 2 puppet run, but at least make it converge to a stable/working state, whereas the current code break runs unless you install sudo by hand.

Maxence

"Please qualify the command or specify a path."

I was unable to apply the module as is. It returned the following error:

err: Failed to apply catalog: 'visudo -c -f /etc/sudoers.d/foo || ( rm -f /etc/sudoers.d/foo && exit 1)' is not qualified and no path was specified. Please qualify the command or specify a path.

A simple path qualification corrected this error.

diff --git a/manifests/directive.pp b/manifests/directive.pp
index 3ad5f02..e3db631 100644
--- a/manifests/directive.pp
+++ b/manifests/directive.pp
@@ -46,7 +46,7 @@ define sudo::directive (
   }

   exec {"sudo-syntax-check for file $dname":
-    command     => "visudo -c -f /etc/sudoers.d/${dname} || ( rm -f /etc/sudoers.d/${dname} && exit 1)",
+    command     => "/usr/sbin/visudo -c -f /etc/sudoers.d/${dname} || ( rm -f /etc/sudoers.d/${dname} && exit 1)",
     refreshonly => true,
   }

I am running Debian Squeeze on both puppet-master and agent.

Cheers,
Ignace M

sudo fact alters ENV['PATH']

Hi,

The sudo fact alters ENV['PATH'] and does not restore it, which breaks other facts or providers requiring binaries located in previously defined PATH entries (like /usr/local/bin for example).

I don't know the rationale to change PATH at this place (found a puppetlabs ticket that might require the workaround in place), but should'nt it be at least restored at the end of the function ? Or just check for missing entries and append them to the PATH ?

Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.