Forge Home

saferm

This module install and configure safe-rm, a tool to prevent accidental deletion of important files.

7,424 downloads

6,811 latest version

4.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.1.3 (latest)
  • 0.1.2
  • 0.1.1
  • 0.1.0 (deleted)
released Jun 22nd 2016
This version is compatible with:
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gohoyer-saferm', '0.1.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gohoyer-saferm
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gohoyer-saferm --version 0.1.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

gohoyer/saferm — version 0.1.3 Jun 22nd 2016

saferm

Table of Contents

  1. Description
  2. Setup - The basics of getting started with saferm
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

This puppet module installs and configure safe-rm, a tool to prevent accidental deletion of important files and directories.

If you want to know more about the safe-rm tool, take a look at the official page here.

Setup

What saferm affects

  • /etc/safe-rm.conf
  • /usr/bin/safe-rm

Optionally:

  • /etc/profile.d/safe-rm.sh
  • ~/.safe-rm

Setup requirements

This module needs tar and wget to work properly.

Beginning with saferm

To install safe-rm on your system, include the saferm class: include saferm.

Usage

The saferm module install and configure safe-rm on your system. By default, the module install version 0.12 and shields the following directories:

  • /
  • /bin
  • /boot
  • /dev
  • /etc
  • /home
  • /initrd
  • /lib
  • /proc
  • /root
  • /sbin
  • /sys
  • /usr
  • /usr/bin
  • /usr/include
  • /usr/lib
  • /usr/local
  • /usr/local/bin
  • /usr/local/include
  • /usr/local/sbin
  • /usr/local/share
  • /usr/sbin
  • /usr/share
  • /usr/src
  • /var

To install a different version of safe-rm:

class {'saferm':
  version => '0.11'
}

To set a different list of directories to be protected:

class {'saferm':
  blacklist => ["/home","/home/user","/my_custom_dir"]'
}

The directories passed on the blacklist variable of the saferm class are system wide and will affect all users.

The defined type saferm::user_blacklist allow you to specify a custom list of directories to be protected for each user.

saferm::user_blacklist {'/home/bob/':
  blacklist => [
    '/home/bob/documents',
    '/home/bob/photos',
    '/bob_protected_dir',
  ]
}

The class saferm::alias creates an alias to the rm command pointing to safe-rm.

include saferm::alias

This will create a permanent the alias rm="/usr/bin/safe-rm" at /etc/profile.d/safe-rm.sh.

Reference

Classes

Public classes

  • saferm: Install and configure safe-rm.
  • saferm::alias: creates an alias to the rm command.

Private classes

  • saferm::params: Determines the installation method, the binary path and the package name for safe-rm.
  • saferm::install: install safe-rm according the installation method.
  • saferm::config: configures safe-rm.

Defined types

  • saferm::user_blacklist: Creates a safe-rm configuration file at the home of the user containing a custom set of directories to be protected for this user. The $title of this define must be the user home.

Parameters

The following parameters are avaliable in saferm:

version

Specifies the safe-rm version to be installed.
Valid options: '0.12', '0.11', '0.10'.
Default: '0.12'

blacklist

Specifies an array of directories to be protected system wide.
Default:

  • /
  • /bin
  • /boot
  • /dev
  • /etc
  • /home
  • /initrd
  • /lib
  • /proc
  • /root
  • /sbin
  • /sys
  • /usr
  • /usr/bin
  • /usr/include
  • /usr/lib
  • /usr/local
  • /usr/local/bin
  • /usr/local/include
  • /usr/local/sbin
  • /usr/local/share
  • /usr/sbin
  • /usr/share
  • /usr/src
  • /var

The following parameters are avaliable in saferm::user_blacklist:

blacklist

Requird parameter that specifies an array of directories to be protected on the user environment. Default: there's no default value for this parameter.

Limitations

This module cannot guarantee installation of safe-rm versions that aren't avaliable on platform repositories for Debian like systems.

This module is tested on the following OS:

  • CentOS 5.x
  • CentOS 6.x
  • Centos 7.x
  • Debian 6.x
  • Debian 7.x
  • Debian 8.x

Development

Feel free to contribute for this module at the module's github repo.