HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //var/cache/puppet/lib/puppet/type/grub_user.rb
# Manages GRUB2 Users - Does not apply to GRUB Legacy
#
# Author Trevor Vaughan <tvaughan@onyxpoint.com>
# Copyright (c) 2015 Onyx Point, Inc.

Puppet::Type.newtype(:grub_user) do
  @doc = <<-EOM
    Manages GRUB2 Users - Does not apply to GRUB Legacy

    Note: This type compares against the *active* GRUB configuration. The
    contents of the management file will not be updated unless the active
    configuration is out of sync with the expected configuration.
  EOM

  feature :grub2, 'Management of GRUB2 resources'

  ensurable do
    defaultvalues
    defaultto :present
  end

  newparam(:name) do
    desc <<-EOM
      The username of the GRUB2 user to be managed.
    EOM

    isnamevar

    validate do |value|
      # These are items that can separate users in the superusers string and,
      # therefore, should not be valid as a username.
      if value =~ /\s|,|;|&|\|/
        raise(Puppet::ParseError, "Usernames may not contain spaces, commas, semicolons, ampersands, or pipes")
      end
    end
  end

  newparam(:superuser, :boolean => true) do
    desc <<-EOM
      If set, add this user to the 'superusers' list, if no superusers are set,
      but grub_user resources have been declared, a compile error will be
      raised.
    EOM

    newvalues(:true, :false)
    defaultto(:false)
  end

  newparam(:target, :parent => Puppet::Parameter::Path) do
    desc <<-EOM
      The file to which to write the user information.

      Must be an absolute path.
    EOM

    defaultto('/etc/grub.d/02_puppet_managed_users')
  end

  newparam(:report_unmanaged, :boolean => true) do
    desc <<-EOM
      Report any unmanaged users as a warning during the Puppet run.
    EOM

    newvalues(:true, :false)
    defaultto(:false)
  end

  newparam(:rounds) do
    desc <<-EOM
      The rounds to use when hashing the password.
    EOM

    newvalues(/^\d+$/)
    defaultto(10000)

    munge do |value|
      value.to_i
    end
  end

  newproperty(:purge, :boolean => true) do
    desc <<-EOM
      Purge all unmanaged users.

      This does not affect any users that are not defined by Puppet! There is
      no way to reliably eliminate the items from all other scripts without
      potentially severely damaging the GRUB2 build scripts.
    EOM

    newvalues(:true, :false)
    defaultto(:false)
  end

  newproperty(:password) do
    desc <<-EOM
      The user's password. If the password is not already in a GRUB2 compatible
      form, it will be automatically converted.
    EOM

    validate do |value|
      raise(Puppet::ParseError, "Passwords must be Strings") unless value.is_a?(String)
    end

    def insync?(is)
      provider.password?(is,should)
    end
  end
end