Sha256: c4b34b4d1dd6ca8f459dceea86bdaf536fe407d60db4ef97969ec269c6190a04

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

require 'shellwords'

module Serverspec
  module Commands
    class Linux < Base
      def check_access_by_user(file, user, access)
        "su -c \"test -#{access} #{file}\" #{user}"
      end

      def check_iptables_rule(rule, table=nil, chain=nil)
        cmd = "iptables"
        cmd += " -t #{escape(table)}" if table
        cmd += " -S"
        cmd += " #{escape(chain)}" if chain
        cmd += " | grep -- #{escape(rule)}"
        cmd
      end

      def check_selinux(mode)
        "getenforce | grep -i -- #{escape(mode)} && grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
      end

      def check_kernel_module_loaded(name)
        "lsmod | grep ^#{name}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serverspec-0.6.11 lib/serverspec/commands/linux.rb