Sha256: 09618521c9606cf0a3bc1f9488f886e8a6d57c7e479d60d9f16cc762943a823f

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 Bytes

Contents

require 'shellwords'

module Serverspec
  module Commands
    class Linux < Base
      class NotImplementedError < Exception; end

      def check_access_by_user file, user, access
        "su -s sh -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)}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serverspec-0.5.0 lib/serverspec/commands/linux.rb
serverspec-0.4.14 lib/serverspec/commands/linux.rb
serverspec-0.4.13 lib/serverspec/commands/linux.rb
serverspec-0.4.12 lib/serverspec/commands/linux.rb