Giter Site home page Giter Site logo

ulhpc / puppet-sysadmins Goto Github PK

View Code? Open in Web Editor NEW
2.0 8.0 3.0 147 KB

Puppet module to configure a single system administrator account (localadmin by default) attached to (potentially) several users

License: Other

Ruby 17.73% Puppet 54.46% HTML 2.21% Shell 25.60%
puppet sysadmin-account sudoers ssh

puppet-sysadmins's Introduction

-- mode: markdown; mode: visual-line; --

Sysadmins Puppet Module

Puppet Forge License Supported Platforms Documentation Status

Configuration of a single system administrator account (localadmin by default) attached to (potentially) several users

  Copyright (c) 2019 UL HPC Team <[email protected]>

| Project Page | Sources | Documentation | Issues |

Synopsis

Configuration of a single system administrator account (localadmin by default) attached to (potentially) several users.

This module implements the following elements:

  • Puppet classes:

    • sysadmins
    • sysadmins::common
    • sysadmins::common::debian
    • sysadmins::common::redhat
    • sysadmins::params
  • Puppet definitions:

All these components are configured through a set of variables you will find in manifests/params.pp.

Note: the various operations that can be conducted from this repository are piloted from a Rakefile and assumes you have a running Ruby installation. See docs/contributing.md for more details on the steps you shall follow to have this Rakefile working properly.

Dependencies

See metadata.json. In particular, this module depends on

Overview and Usage

Class sysadmins

This is the main class defined in this module. It accepts the following parameters:

  • $ensure: default to 'present', can be 'absent'

  • $login: the actual login used for the local sysadmin account

    • Default: localadmin
  • $email: redirect all mails sent to the sysadmin account to this email address

  • $purge_ssh_keys: whether to purge the authorized_keys files or not

  • $filter_access: whether or not to prevent access to the sysadmin account for non-registered users (via ~<login>/.sysadminrc)

    • Default: true
  • $users: hash of the users authorized to connect to the local sysadmin account i.e. the real users (system administrators). The format of each entry is as follows:

       <login>:
         firstname: <firstname>
         lastname: <lastname>
         email: <email>
         office: <address>
    
  • $groups: Additonnal groups the sysadmin user is member of

  • $ssh_keys: Hash of the SSH keys -- each entry should be prefixed by the appropriate login defined in sysadmins::users as follows:

        <login>[@<comment>]:
           type: <key_type>
           public: <public_key>
    

Use it as follows:

  class { 'sysadmins':
      ensure         => 'present',
      groups         => [ 'vagrant' ],   # can be a string
      users          => hiera_hash('sysadmins::users', {}),
      ssh_keys       => hiera_hash('sysadmins::ssh_keys', {}),
      purge_ssh_keys => true,
  }

Example hiera YAML file (see also tests/hiera/common.yaml):

#
# Example of Users definitions
#
sysadmins::users:
  svarrette:
    firstname: Sébastien
    lastname: Varrette
    email: [email protected]
    office: Campus Kirchberg, E-007
  hcartiaux:
    firstname: Hyacinthe
    lastname: Cartiaux
    email: [email protected]
    office: Campus Kirchberg, E-008
#
# SSH keys -- should be prefixed by the appropriate login defined in sysadmins::users
#   Format: <login>[@<comment>]:
#               type:
#               public:
#
sysadmins::ssh_keys:
  svarrette:
    type: ssh-dss
    public: AAAAB3NzaC1kc3MA...
  svarrette@workstation:
    type: ssh-rsa
    public: 5reQfxIMsEU/4336qUHY0wAAAIBFs...
  hcartiaux:
    type: ssh-dss
    public: MAAACBAKQMf834bHh4TFMecBKK...
  sdiehl:
    type: ssh-dss
    public: QMf834bHh4T...
  vplugaru:
    type: ssh-rsa
    public: HY0wAAAIBF...

See also tests/init.pp

This will create the localadmin account. In the example above, the ~localadmin/.ssh/authorized_keys holds the SSH keys of only svarrette and hcartiaux users as they are the ones listed in sysadmins::users. Example:

   $> cat ~localadmin/.ssh/authorized_keys
   # HEADER: This file was autogenerated at 2015-06-02 20:40:46 +0000
   # HEADER: by puppet.  While it can still be managed manually, it
   # HEADER: is definitely not recommended.
   environment="SYSADMIN_USER=svarrette" ssh-rsa 5reQfxIMsEU/4336qUHY0wAAAIBFs... svarrette@debugkey-on-localadmin
   environment="SYSADMIN_USER=hcartiaux" ssh-dss MAAACBAKQMf834bHh4TFMecBKK... hcartiaux-on-localadmin
   environment="SYSADMIN_USER=svarrette" ssh-dss AAAAB3NzaC1kc3MA... [email protected]

As you can notice, the special environment variable SYSADMIN_USER is set. It is used to eventually restrict the access to the localadmin account (see ~localadmin/.sysadminrc).

Librarian-Puppet / R10K Setup

You can of course configure the sysadmins module in your Puppetfile to make it available with Librarian puppet or r10k by adding the following entry:

 # Modules from the Puppet Forge
 mod "ULHPC/sysadmins"

or, if you prefer to work on the git version:

 mod "ULHPC/sysadmins", 
     :git => 'https://github.com/ULHPC/puppet-sysadmins',
     :ref => 'production' 

Issues / Feature request

You can submit bug / issues / feature request using the ULHPC/sysadmins Puppet Module Tracker.

Developments / Contributing to the code

If you want to contribute to the code, you shall be aware of the way this module is organized. These elements are detailed on docs/contributing.md.

You are more than welcome to contribute to its development by sending a pull request.

Puppet modules tests within a Vagrant box

The best way to test this module in a non-intrusive way is to rely on Vagrant. The Vagrantfile at the root of the repository pilot the provisioning various vagrant boxes available on Vagrant cloud you can use to test this module.

See docs/vagrant.md for more details.

Online Documentation

Read the Docs aka RTFD hosts documentation for the open source community and the ULHPC/sysadmins puppet module has its documentation (see the docs/ directly) hosted on readthedocs.

See docs/rtfd.md for more details.

Licence

This project and the sources proposed within this repository are released under the terms of the GPL-3.0 licence.

Licence

puppet-sysadmins's People

Contributors

bmjen avatar dependabot[bot] avatar hcartiaux avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-sysadmins's Issues

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.