自前でufwのレシピとserverspecのテストを書いた
ufw = Uncomplicated FireWall です。 レシピはこんなのを作りました。opscode のレシピとか使うと、何設定し ているか分からず結局全部読むことになるので自前で書いてます。 execute 'ufw reload' do action :nothing end execute 'ufw default deny' do not_if 'ufw status verbose | fgrep "Default: deny (incoming)"' notifies :run, 'execute[ufw reload]' end execute 'ufw allow http' do not_if 'ufw status | egrep "^80 +ALLOW"' notifies :run, 'execute[ufw reload]' end execute 'ufw allow ssh' do not_if 'ufw status | egrep "^22 +ALLOW"' notifies :run, 'execute[ufw reload]' end execute 'ufw enable' do command 'yes | ufw enable' not_if 'ufw status | fgrep "Status: active"' end serverspec はだいたいこんな感じです。...