Class: Serverspec::Commands::Linux
- Inherits:
-
Base
- Object
- Base
- Serverspec::Commands::Linux
show all
- Defined in:
- lib/serverspec/commands/linux.rb
Defined Under Namespace
Classes: NotImplementedError
Instance Method Summary
collapse
Methods inherited from Base
#check_authorized_key, #check_belonging_group, #check_cron_entry, #check_directory, #check_enabled, #check_file, #check_file_contain, #check_file_contain_within, #check_file_md5checksum, #check_gid, #check_group, #check_grouped, #check_home_directory, #check_installed, #check_installed_by_gem, #check_installed_by_npm, #check_ipfilter_rule, #check_ipnat_rule, #check_link, #check_listening, #check_login_shell, #check_mode, #check_mounted, #check_owner, #check_process, #check_reachable, #check_resolvable, #check_routing_table, #check_running, #check_running_under_supervisor, #check_svcprop, #check_svcprops, #check_uid, #check_user, #check_zfs, #escape, #get_mode
Instance Method Details
#check_access_by_user(file, user, access) ⇒ Object
8
9
10
|
# File 'lib/serverspec/commands/linux.rb', line 8
def check_access_by_user file, user, access
"su -s sh -c \"test -#{access} #{file}\" #{user}"
end
|
#check_iptables_rule(rule, table = nil, chain = nil) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/serverspec/commands/linux.rb', line 12
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
|
#check_selinux(mode) ⇒ Object
21
22
23
|
# File 'lib/serverspec/commands/linux.rb', line 21
def check_selinux mode
"getenforce | grep -i -- #{escape(mode)} && grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
end
|