Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
Created May 1, 2013 08:05
Show Gist options
  • Save netmarkjp/5494263 to your computer and use it in GitHub Desktop.
Save netmarkjp/5494263 to your computer and use it in GitHub Desktop.
kernel parameter check for generic web server by using serverspec
require 'spec_helper'
describe 'Linux kernel parameters' do
context 'fs.file-max' do
its(:value) { should >= 2097152 }
end
context 'kernel.core_uses_pid' do
its(:value) { should eq 1 }
end
context 'kernel.msgmax' do
its(:value) { should >= 65536 }
end
context 'kernel.msgmnb' do
its(:value) { should >= 65536 }
end
context 'kernel.panic' do
its(:value) { should <= 30 }
end
context 'kernel.shmall' do
its(:value) { should >= 4294967296 }
end
context 'kernel.shmmax' do
its(:value) { should >= 68719476736 }
end
context 'kernel.sysrq' do
its(:value) { should eq 0 }
end
context 'net.ipv4.conf.default.accept_redirects' do
its(:value) { should eq 0 }
end
context 'net.ipv4.conf.default.accept_source_route' do
its(:value) { should eq 0 }
end
context 'net.ipv4.conf.default.arp_announce' do
its(:value) { should eq 2 }
end
context 'net.ipv4.conf.default.arp_filter' do
its(:value) { should eq 1 }
end
context 'net.ipv4.conf.default.arp_ignore' do
its(:value) { should eq 2 }
end
context 'net.ipv4.conf.default.rp_filter' do
its(:value) { should eq 1 }
end
context 'net.ipv4.conf.default.secure_redirects' do
its(:value) { should eq 1 }
end
context 'net.ipv4.icmp_echo_ignore_broadcasts' do
its(:value) { should eq 1 }
end
context 'net.ipv4.icmp_errors_use_inbound_ifaddr' do
its(:value) { should eq 1 }
end
context 'net.ipv4.icmp_ignore_bogus_error_responses' do
its(:value) { should eq 1 }
end
context 'net.ipv4.ip_forward' do
its(:value) { should eq 0 }
end
context 'net.ipv4.ip_local_port_range' do
its(:value) { should match /1024\t65535/ }
end
context 'net.ipv4.netfilter.ip_conntrack_max' do
its(:value) { should >= 1053616 }
end
context 'net.ipv4.tcp_fin_timeout' do
its(:value) { should <= 5 }
end
context 'net.ipv4.tcp_max_syn_backlog' do
its(:value) { should >= 4096 }
end
context 'net.ipv4.tcp_max_tw_buckets' do
its(:value) { should >= 1800000 }
end
context 'net.ipv4.tcp_mem' do
its(:value) { should match /256000\t400000\t524288/ }
end
context 'net.ipv4.tcp_orphan_retries' do
its(:value) { should eq 2 }
end
context 'net.ipv4.tcp_rmem' do
its(:value) { should match /256000\t400000\t524288/ }
end
context 'net.ipv4.tcp_syncookies' do
its(:value) { should eq 1 }
end
context 'net.ipv4.tcp_tw_recycle' do
its(:value) { should eq 0 }
end
context 'net.ipv4.tcp_tw_reuse' do
its(:value) { should eq 1 }
end
context 'net.ipv4.tcp_wmem' do
its(:value) { should match /256000\t400000\t524288/ }
end
context 'net.ipv6.conf.default.accept_ra' do
its(:value) { should eq 0 }
end
context 'net.ipv6.conf.default.accept_redirects' do
its(:value) { should eq 0 }
end
context 'net.ipv6.conf.default.autoconf' do
its(:value) { should eq 0 }
end
context 'net.ipv6.conf.default.forwarding' do
its(:value) { should eq 0 }
end
context 'vm.swappiness' do
its(:value) { should eq 0 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment