Skip to content

Commit 0bc641f

Browse files
committedApr 17, 2015
Initial commit
0 parents  commit 0bc641f

File tree

12 files changed

+336
-0
lines changed

12 files changed

+336
-0
lines changed
 

‎Berksfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://supermarket.chef.io"
2+
3+
metadata

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 1.0.0
2+
3+
Initial release of suhosin

‎Gemfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'berkshelf'
4+
5+
# Uncomment these lines if you want to live on the Edge:
6+
#
7+
# group :development do
8+
# gem "berkshelf", github: "berkshelf/berkshelf"
9+
# gem "vagrant", github: "mitchellh/vagrant", tag: "v1.6.3"
10+
# end
11+
#
12+
# group :plugins do
13+
# gem "vagrant-berkshelf", github: "berkshelf/vagrant-berkshelf"
14+
# gem "vagrant-omnibus", github: "schisamo/vagrant-omnibus"
15+
# end
16+

‎LICENSE

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Copyright (C) 2015 YOUR_NAME
2+
3+
All rights reserved - Do Not Redistribute

‎README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# suhosin-cookbook
2+
3+
TODO: Enter the cookbook description here.
4+
5+
## Supported Platforms
6+
7+
TODO: List your supported platforms.
8+
9+
## Attributes
10+
11+
Default attributes value is below.
12+
Please note that [Suhosin site](https://suhosin.org/stories/download.html) is not providing sha256 checksum,
13+
if you want change to different version. You need to get sha256 value with command like `sha256sum` by yourself.
14+
15+
* default['suhosin']['source'] = 'https://download.suhosin.org/suhosin-0.9.37.1.tar.gz'
16+
* default['suhosin']['version'] = '0.9.37.1'
17+
* default['suhosin']['checksum'] = '322ba104a17196bae63d39404da103fd011b09fde0f02484dc44366511c586ba'
18+
19+
## Usage
20+
21+
### suhosin::default
22+
23+
Include `suhosin` in your node's `run_list`:
24+
25+
```json
26+
{
27+
"run_list": [
28+
"recipe[suhosin::default]"
29+
]
30+
}
31+
```

‎Thorfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# encoding: utf-8
2+
3+
require 'bundler'
4+
require 'bundler/setup'
5+
require 'berkshelf/thor'

‎Vagrantfile

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = '2'
6+
7+
Vagrant.require_version '>= 1.5.0'
8+
9+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10+
# All Vagrant configuration is done here. The most common configuration
11+
# options are documented and commented below. For a complete reference,
12+
# please see the online documentation at vagrantup.com.
13+
14+
config.vm.hostname = 'suhosin-berkshelf'
15+
16+
# Set the version of chef to install using the vagrant-omnibus plugin
17+
# NOTE: You will need to install the vagrant-omnibus plugin:
18+
#
19+
# $ vagrant plugin install vagrant-omnibus
20+
#
21+
if Vagrant.has_plugin?("vagrant-omnibus")
22+
config.omnibus.chef_version = 'latest'
23+
end
24+
25+
# Every Vagrant virtual environment requires a box to build off of.
26+
# If this value is a shorthand to a box in Vagrant Cloud then
27+
# config.vm.box_url doesn't need to be specified.
28+
config.vm.box = 'chef/ubuntu-14.04'
29+
30+
31+
# Assign this VM to a host-only network IP, allowing you to access it
32+
# via the IP. Host-only networks can talk to the host machine as well as
33+
# any other machines on the same network, but cannot be accessed (through this
34+
# network interface) by any external networks.
35+
config.vm.network :private_network, type: 'dhcp'
36+
37+
# Create a forwarded port mapping which allows access to a specific port
38+
# within the machine from a port on the host machine. In the example below,
39+
# accessing "localhost:8080" will access port 80 on the guest machine.
40+
41+
# Share an additional folder to the guest VM. The first argument is
42+
# the path on the host to the actual folder. The second argument is
43+
# the path on the guest to mount the folder. And the optional third
44+
# argument is a set of non-required options.
45+
# config.vm.synced_folder "../data", "/vagrant_data"
46+
47+
# Provider-specific configuration so you can fine-tune various
48+
# backing providers for Vagrant. These expose provider-specific options.
49+
# Example for VirtualBox:
50+
#
51+
# config.vm.provider :virtualbox do |vb|
52+
# # Don't boot with headless mode
53+
# vb.gui = true
54+
#
55+
# # Use VBoxManage to customize the VM. For example to change memory:
56+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
57+
# end
58+
#
59+
# View the documentation for the provider you're using for more
60+
# information on available options.
61+
62+
# The path to the Berksfile to use with Vagrant Berkshelf
63+
# config.berkshelf.berksfile_path = "./Berksfile"
64+
65+
# Enabling the Berkshelf plugin. To enable this globally, add this configuration
66+
# option to your ~/.vagrant.d/Vagrantfile file
67+
config.berkshelf.enabled = true
68+
69+
# An array of symbols representing groups of cookbook described in the Vagrantfile
70+
# to exclusively install and copy to Vagrant's shelf.
71+
# config.berkshelf.only = []
72+
73+
# An array of symbols representing groups of cookbook described in the Vagrantfile
74+
# to skip installing and copying to Vagrant's shelf.
75+
# config.berkshelf.except = []
76+
77+
config.vm.provision :chef_solo do |chef|
78+
chef.json = {
79+
mysql: {
80+
server_root_password: 'rootpass',
81+
server_debian_password: 'debpass',
82+
server_repl_password: 'replpass'
83+
}
84+
}
85+
86+
chef.run_list = [
87+
'recipe[suhosin::default]'
88+
]
89+
end
90+
end

‎attributes/default.rb

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Author:: Yosuke Inoue (<inoue@fieldweb.co.jp>)
3+
# Cookbook Name:: suhosin
4+
# Attribute:: default
5+
#
6+
# Copyright 2015, FIELD Co., Ltd.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
default['suhosin']['source'] = 'https://download.suhosin.org/suhosin-0.9.37.1.tar.gz'
22+
default['suhosin']['version'] = '0.9.37.1'
23+
default['suhosin']['checksum'] = '322ba104a17196bae63d39404da103fd011b09fde0f02484dc44366511c586ba'

‎chefignore

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Put files/directories that should be ignored in this file when uploading
2+
# or sharing to the community site.
3+
# Lines that start with '# ' are comments.
4+
5+
# OS generated files #
6+
######################
7+
.DS_Store
8+
Icon?
9+
nohup.out
10+
ehthumbs.db
11+
Thumbs.db
12+
13+
# SASS #
14+
########
15+
.sass-cache
16+
17+
# EDITORS #
18+
###########
19+
\#*
20+
.#*
21+
*~
22+
*.sw[a-z]
23+
*.bak
24+
REVISION
25+
TAGS*
26+
tmtags
27+
*_flymake.*
28+
*_flymake
29+
*.tmproj
30+
.project
31+
.settings
32+
mkmf.log
33+
34+
## COMPILED ##
35+
##############
36+
a.out
37+
*.o
38+
*.pyc
39+
*.so
40+
*.com
41+
*.class
42+
*.dll
43+
*.exe
44+
*/rdoc/
45+
46+
# Testing #
47+
###########
48+
.watchr
49+
.rspec
50+
spec/*
51+
spec/fixtures/*
52+
test/*
53+
features/*
54+
Guardfile
55+
Procfile
56+
57+
# SCM #
58+
#######
59+
.git
60+
*/.git
61+
.gitignore
62+
.gitmodules
63+
.gitconfig
64+
.gitattributes
65+
.svn
66+
*/.bzr/*
67+
*/.hg/*
68+
*/.svn/*
69+
70+
# Berkshelf #
71+
#############
72+
cookbooks/*
73+
tmp
74+
75+
# Cookbooks #
76+
#############
77+
CONTRIBUTING
78+
CHANGELOG*
79+
80+
# Strainer #
81+
############
82+
Colanderfile
83+
Strainerfile
84+
.colander
85+
.strainer
86+
87+
# Vagrant #
88+
###########
89+
.vagrant
90+
Vagrantfile
91+
92+
# Travis #
93+
##########
94+
.travis.yml

‎metadata.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name 'suhosin'
2+
maintainer 'Yosuke INOUE'
3+
maintainer_email 'inoue@fieldweb.co.jp'
4+
license 'Apache 2.0'
5+
description 'Installs/Configures suhosin'
6+
version '1.0.0'
7+
8+
%w{ centos redhat fedora }.each do |os|
9+
supports os
10+
end
11+
12+
depends 'build-essential'
13+
depends 'apache2'
14+
depends 'php'

‎recipes/default.rb

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Author:: Yosuke Inoue (<inoue@fieldweb.co.jp>)
3+
# Cookbook Name:: suhosin
4+
# Recipe:: default
5+
#
6+
# Copyright 2015, FIELD Co., Ltd.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
include_recipe 'build-essential'
22+
23+
remote_file "#{Chef::Config[:file_cache_path]}/suhosin-#{node['suhosin']['version']}.tar.gz" do
24+
source "#{node['suhosin']['source']}"
25+
checksum node['suhosin']['checksum']
26+
mode '0644'
27+
only_if "which php"
28+
end
29+
30+
31+
bash 'build suhosin' do
32+
cwd Chef::Config[:file_cache_path]
33+
code <<-EOF
34+
tar -zxf suhosin-#{node['suhosin']['version']}.tar.gz
35+
cd suhosin-#{node['suhosin']['version']}
36+
phpize
37+
./configure
38+
make
39+
make install
40+
EOF
41+
only_if "which php"
42+
end
43+
44+
template "#{node['php']['ext_conf_dir']}/suhosin.ini" do
45+
source 'suhosin.ini.erb'
46+
cookbook 'suhosin'
47+
unless platform?('windows')
48+
owner 'root'
49+
group 'root'
50+
mode '0644'
51+
end
52+
notifies :reload, "service[apache2]", :immediately
53+
end

‎templates/default/suhosin.ini.erb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=suhosin.so

0 commit comments

Comments
 (0)
Please sign in to comment.