class Ardecy::Harden::Mountpoint::ProcHidepid

Public Class Methods

new(args) click to toggle source
# File lib/ardecy/harden/mountpoint.rb, line 117
def initialize(args)
  super
  @name = 'proc'
  @ensure = [ 'hidepid=2', 'gid=proc' ]
  @group = 'proc'
end

Public Instance Methods

create_content(in_dir) click to toggle source
# File lib/ardecy/harden/mountpoint.rb, line 136
def create_content(in_dir)
  content = [
    '[Service]',
    'SupplementaryGroups=proc',
    ''
  ]
  Dir.mkdir in_dir, 0700 unless Dir.exists? in_dir
  File.write("#{in_dir}/hidepid.conf", content.join("\n"), mode: 'w')
  puts " > Creating file #{in_dir}/hidepid.conf"
end
systemd_case() click to toggle source

man logind.conf check under: > /etc/systemd/logind.conf.d/*.conf > /run/systemd/logind.conf.d/*.conf > /usr/lib/systemd/logind.conf.d/*.conf

# File lib/ardecy/harden/mountpoint.rb, line 128
def systemd_case
  return unless @args[:fix]

  if File.exist? '/etc/systemd/logind.conf'
    create_content '/etc/systemd/logind.conf.d'
  end
end