Puppet Class: cis_security_hardening::rules::tmp_nodev

Defined in:
manifests/rules/tmp_nodev.pp

Summary

Ensure nodev option set on /tmp partition

Overview

The nodev mount option specifies that the filesystem cannot contain special devices.

Rationale: Since the /tmp filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create block or character special devices in /tmp .

Examples:

class { 'cis_security_hardening::rules::tmp_nodev':
    enforce => true,
}

Parameters:

  • enforce (Boolean) (defaults to: false)

    Enforce the rule



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'manifests/rules/tmp_nodev.pp', line 19

class cis_security_hardening::rules::tmp_nodev (
  Boolean $enforce = false,
) {
  if ($enforce) {
    $mps = fact('mountpoints') ? {
      undef   => {},
      default => fact('mountpoints')
    }
    if cis_security_hardening::hash_key($mps, '/tmp') and
    cis_security_hardening::hash_key($mps['/tmp'], 'device') and
    $mps['/tmp']['device'] != 'tmpfs' {
      cis_security_hardening::set_mount_options { '/tmp-nodev':
        mountpoint   => '/tmp',
        mountoptions => 'nodev',
      }
    }
  }
}