server_maint 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.gitmodules +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/cookbooks/nginx/.gitignore +4 -0
- data/lib/cookbooks/nginx/CHANGELOG.md +63 -0
- data/lib/cookbooks/nginx/CONTRIBUTING +29 -0
- data/lib/cookbooks/nginx/Gemfile +3 -0
- data/lib/cookbooks/nginx/LICENSE +201 -0
- data/lib/cookbooks/nginx/README.md +211 -0
- data/lib/cookbooks/nginx/attributes/default.rb +70 -0
- data/lib/cookbooks/nginx/attributes/echo.rb +3 -0
- data/lib/cookbooks/nginx/attributes/geoip.rb +30 -0
- data/lib/cookbooks/nginx/attributes/naxsi.rb +24 -0
- data/lib/cookbooks/nginx/attributes/passenger.rb +7 -0
- data/lib/cookbooks/nginx/attributes/source.rb +37 -0
- data/lib/cookbooks/nginx/attributes/upload_progress.rb +23 -0
- data/lib/cookbooks/nginx/definitions/nginx_site.rb +35 -0
- data/lib/cookbooks/nginx/files/default/mime.types +73 -0
- data/lib/cookbooks/nginx/files/default/naxsi_core.rules +70 -0
- data/lib/cookbooks/nginx/files/default/tests/minitest/default_test.rb +12 -0
- data/lib/cookbooks/nginx/files/default/tests/minitest/helpers.rb +7 -0
- data/lib/cookbooks/nginx/files/default/tests/minitest/source_test.rb +9 -0
- data/lib/cookbooks/nginx/metadata.rb +95 -0
- data/lib/cookbooks/nginx/recipes/authorized_ips.rb +41 -0
- data/lib/cookbooks/nginx/recipes/commons.rb +23 -0
- data/lib/cookbooks/nginx/recipes/commons_conf.rb +39 -0
- data/lib/cookbooks/nginx/recipes/commons_dir.rb +39 -0
- data/lib/cookbooks/nginx/recipes/commons_script.rb +28 -0
- data/lib/cookbooks/nginx/recipes/default.rb +42 -0
- data/lib/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
- data/lib/cookbooks/nginx/recipes/http_geoip_module.rb +117 -0
- data/lib/cookbooks/nginx/recipes/http_gzip_static_module.rb +23 -0
- data/lib/cookbooks/nginx/recipes/http_realip_module.rb +46 -0
- data/lib/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
- data/lib/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
- data/lib/cookbooks/nginx/recipes/naxsi_module.rb +53 -0
- data/lib/cookbooks/nginx/recipes/ohai_plugin.rb +32 -0
- data/lib/cookbooks/nginx/recipes/passenger.rb +51 -0
- data/lib/cookbooks/nginx/recipes/source.rb +182 -0
- data/lib/cookbooks/nginx/recipes/upload_progress_module.rb +47 -0
- data/lib/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
- data/lib/cookbooks/nginx/templates/default/default-site.erb +11 -0
- data/lib/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
- data/lib/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
- data/lib/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +4 -0
- data/lib/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
- data/lib/cookbooks/nginx/templates/default/modules/passenger.conf.erb +3 -0
- data/lib/cookbooks/nginx/templates/default/nginx.conf.erb +48 -0
- data/lib/cookbooks/nginx/templates/default/nginx.init.erb +92 -0
- data/lib/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
- data/lib/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
- data/lib/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
- data/lib/cookbooks/nginx/templates/default/nxensite.erb +38 -0
- data/lib/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
- data/lib/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
- data/lib/cookbooks/nginx/templates/default/sv-nginx-run.erb +3 -0
- data/lib/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
- data/lib/cookbooks/nginx/test/kitchen/Kitchenfile +5 -0
- data/lib/cookbooks/sanitize/.gitignore +1 -0
- data/lib/cookbooks/sanitize/CHANGELOG.md +10 -0
- data/lib/cookbooks/sanitize/README.md +65 -0
- data/lib/cookbooks/sanitize/attributes/default.rb +1 -0
- data/lib/cookbooks/sanitize/libraries/default.rb +8 -0
- data/lib/cookbooks/sanitize/metadata.rb +12 -0
- data/lib/cookbooks/sanitize/recipes/default.rb +113 -0
- data/lib/cookbooks/sanitize/templates/default/port_ssh.erb +2 -0
- data/lib/server_maint/version.rb +3 -0
- data/lib/server_maint.rb +7 -0
- data/server_maint.gemspec +33 -0
- metadata +155 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: default
|
4
|
+
#
|
5
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
6
|
+
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
7
|
+
#
|
8
|
+
# Copyright 2009-2011, Opscode, Inc.
|
9
|
+
#
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
# you may not use this file except in compliance with the License.
|
12
|
+
# You may obtain a copy of the License at
|
13
|
+
#
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
#
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
# See the License for the specific language governing permissions and
|
20
|
+
# limitations under the License.
|
21
|
+
#
|
22
|
+
|
23
|
+
# In order to update the version, the checksum attribute should be
|
24
|
+
# changed too. It is in the source.rb file, though we recommend
|
25
|
+
# overriding attributes by modifying a role, or the node itself.
|
26
|
+
# default['nginx']['source']['checksum']
|
27
|
+
default['nginx']['version'] = "1.2.3"
|
28
|
+
default['nginx']['dir'] = "/etc/nginx"
|
29
|
+
default['nginx']['log_dir'] = "/var/log/nginx"
|
30
|
+
default['nginx']['binary'] = "/usr/sbin/nginx"
|
31
|
+
|
32
|
+
case node['platform']
|
33
|
+
when "debian","ubuntu"
|
34
|
+
default['nginx']['user'] = "www-data"
|
35
|
+
default['nginx']['init_style'] = "runit"
|
36
|
+
when "redhat","centos","scientific","amazon","oracle","fedora"
|
37
|
+
default['nginx']['user'] = "nginx"
|
38
|
+
default['nginx']['init_style'] = "init"
|
39
|
+
else
|
40
|
+
default['nginx']['user'] = "www-data"
|
41
|
+
default['nginx']['init_style'] = "init"
|
42
|
+
end
|
43
|
+
|
44
|
+
default['nginx']['pid'] = "/var/run/nginx.pid"
|
45
|
+
|
46
|
+
default['nginx']['gzip'] = "on"
|
47
|
+
default['nginx']['gzip_http_version'] = "1.0"
|
48
|
+
default['nginx']['gzip_comp_level'] = "2"
|
49
|
+
default['nginx']['gzip_proxied'] = "any"
|
50
|
+
default['nginx']['gzip_types'] = [
|
51
|
+
"text/plain",
|
52
|
+
"text/css",
|
53
|
+
"application/x-javascript",
|
54
|
+
"text/xml",
|
55
|
+
"application/xml",
|
56
|
+
"application/xml+rss",
|
57
|
+
"text/javascript",
|
58
|
+
"application/javascript",
|
59
|
+
"application/json"
|
60
|
+
]
|
61
|
+
|
62
|
+
default['nginx']['keepalive'] = "on"
|
63
|
+
default['nginx']['keepalive_timeout'] = 65
|
64
|
+
default['nginx']['worker_processes'] = cpu['total']
|
65
|
+
default['nginx']['worker_connections'] = 1024
|
66
|
+
default['nginx']['server_names_hash_bucket_size'] = 64
|
67
|
+
|
68
|
+
default['nginx']['disable_access_log'] = false
|
69
|
+
default['nginx']['install_method'] = 'package'
|
70
|
+
default['nginx']['default_site_enabled'] = true
|
@@ -0,0 +1,3 @@
|
|
1
|
+
default['nginx']['echo']['version'] = '0.40'
|
2
|
+
default['nginx']['echo']['url'] = "https://github.com/agentzh/echo-nginx-module/tarball/v#{node['nginx']['echo']['version']}"
|
3
|
+
default['nginx']['echo']['checksum'] = '26ae7f7381d52d6aa5021dfc39a1862fd081d580166343f671d0920ed239ab41'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: geoip
|
4
|
+
#
|
5
|
+
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
6
|
+
#
|
7
|
+
# Copyright 2012, Riot Games
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
21
|
+
|
22
|
+
default['nginx']['geoip']['path'] = "/srv/geoip"
|
23
|
+
default['nginx']['geoip']['enable_city'] = true
|
24
|
+
default['nginx']['geoip']['country_dat_url'] = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"
|
25
|
+
default['nginx']['geoip']['country_dat_checksum'] = "bbd5ea2bf1de800237a56ea0600f3d8ede2e2956937a8e632118f397af75adfa",
|
26
|
+
default['nginx']['geoip']['city_dat_url'] = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
|
27
|
+
default['nginx']['geoip']['city_dat_checksum'] = "097f74d8295f82ca256d522497c3a105aaa6a353260c5d2c084156b29a54d431"
|
28
|
+
default['nginx']['geoip']['lib_version'] = "1.4.8"
|
29
|
+
default['nginx']['geoip']['lib_url'] = "http://geolite.maxmind.com/download/geoip/api/c/GeoIP-#{node['nginx']['geoip']['lib_version']}.tar.gz"
|
30
|
+
default['nginx']['geoip']['lib_checksum'] = "cf0f6b2bac1153e34d6ef55ee3851479b347d2b5c191fda8ff6a51fab5291ff4"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: naxsi
|
4
|
+
#
|
5
|
+
# Author:: Artiom Lunev (<artiom.lunev@gmail.com>)
|
6
|
+
#
|
7
|
+
# Copyright 2012, Artiom Lunev
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
21
|
+
|
22
|
+
default['nginx']['naxsi']['version'] = "0.46-1"
|
23
|
+
default['nginx']['naxsi']['url'] = "http://naxsi.googlecode.com/files/naxsi-#{node['nginx']['naxsi']['version']}.tgz"
|
24
|
+
default['nginx']['naxsi']['checksum'] = "3f0cc75b9dcf79aec8d440f0452c960d"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# instead of using hard-coded path for passenger root, we should be using the following:
|
2
|
+
#%x{passenger-config --root}.chomp
|
3
|
+
#
|
4
|
+
node.default["nginx"]["passenger"]["version"] = "3.0.12"
|
5
|
+
node.default["nginx"]["passenger"]["root"] = "/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12"
|
6
|
+
node.default["nginx"]["passenger"]["ruby"] = %x{which ruby}.chomp
|
7
|
+
node.default["nginx"]["passenger"]["max_pool_size"] = 10
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: source
|
4
|
+
#
|
5
|
+
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
6
|
+
#
|
7
|
+
# Copyright 2012, Riot Games
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
21
|
+
|
22
|
+
include_attribute 'nginx'
|
23
|
+
|
24
|
+
default['nginx']['source']['prefix'] = "/opt/nginx-#{node['nginx']['version']}"
|
25
|
+
default['nginx']['source']['conf_path'] = "#{node['nginx']['dir']}/nginx.conf"
|
26
|
+
default['nginx']['source']['default_configure_flags'] = [
|
27
|
+
"--prefix=#{node['nginx']['source']['prefix']}",
|
28
|
+
"--conf-path=#{node['nginx']['dir']}/nginx.conf"
|
29
|
+
]
|
30
|
+
|
31
|
+
default['nginx']['configure_flags'] = Array.new
|
32
|
+
default['nginx']['source']['url'] = "http://nginx.org/download/nginx-#{node['nginx']['version']}.tar.gz"
|
33
|
+
default['nginx']['source']['checksum'] = "06a1153b32b43f100ee9147fe230917deea648f0155111c749e35da120646bf5"
|
34
|
+
default['nginx']['source']['modules'] = [
|
35
|
+
"http_ssl_module",
|
36
|
+
"http_gzip_static_module"
|
37
|
+
]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: upload_progress
|
4
|
+
#
|
5
|
+
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
6
|
+
#
|
7
|
+
# Copyright 2012, Riot Games
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
21
|
+
|
22
|
+
default['nginx']['upload_progress']['url'] = "https://github.com/masterzen/nginx-upload-progress-module/tarball/v0.8.4"
|
23
|
+
default['nginx']['upload_progress']['checksum'] = "9a6acb984d81f5d7e04214d63ae94273"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Definition:: nginx_site
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2009, Opscode, Inc.
|
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
|
+
define :nginx_site, :enable => true do
|
22
|
+
if params[:enable]
|
23
|
+
execute "nxensite #{params[:name]}" do
|
24
|
+
command "/usr/sbin/nxensite #{params[:name]}"
|
25
|
+
notifies :reload, resources(:service => "nginx")
|
26
|
+
not_if do ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
execute "nxdissite #{params[:name]}" do
|
30
|
+
command "/usr/sbin/nxdissite #{params[:name]}"
|
31
|
+
notifies :reload, resources(:service => "nginx")
|
32
|
+
only_if do ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
types {
|
2
|
+
text/html html htm shtml;
|
3
|
+
text/css css;
|
4
|
+
text/xml xml;
|
5
|
+
image/gif gif;
|
6
|
+
image/jpeg jpeg jpg;
|
7
|
+
application/x-javascript js;
|
8
|
+
application/json json;
|
9
|
+
application/atom+xml atom;
|
10
|
+
application/rss+xml rss;
|
11
|
+
|
12
|
+
text/mathml mml;
|
13
|
+
text/plain txt;
|
14
|
+
text/vnd.sun.j2me.app-descriptor jad;
|
15
|
+
text/vnd.wap.wml wml;
|
16
|
+
text/x-component htc;
|
17
|
+
|
18
|
+
image/png png;
|
19
|
+
image/tiff tif tiff;
|
20
|
+
image/vnd.wap.wbmp wbmp;
|
21
|
+
image/x-icon ico;
|
22
|
+
image/x-jng jng;
|
23
|
+
image/x-ms-bmp bmp;
|
24
|
+
image/svg+xml svg;
|
25
|
+
|
26
|
+
application/java-archive jar war ear;
|
27
|
+
application/mac-binhex40 hqx;
|
28
|
+
application/msword doc;
|
29
|
+
application/pdf pdf;
|
30
|
+
application/postscript ps eps ai;
|
31
|
+
application/rtf rtf;
|
32
|
+
application/vnd.ms-excel xls;
|
33
|
+
application/vnd.ms-powerpoint ppt;
|
34
|
+
application/vnd.wap.wmlc wmlc;
|
35
|
+
application/vnd.wap.xhtml+xml xhtml;
|
36
|
+
application/vnd.google-earth.kml+xml kml;
|
37
|
+
application/vnd.google-earth.kmz kmz;
|
38
|
+
application/x-cocoa cco;
|
39
|
+
application/x-java-archive-diff jardiff;
|
40
|
+
application/x-java-jnlp-file jnlp;
|
41
|
+
application/x-makeself run;
|
42
|
+
application/x-perl pl pm;
|
43
|
+
application/x-pilot prc pdb;
|
44
|
+
application/x-rar-compressed rar;
|
45
|
+
application/x-redhat-package-manager rpm;
|
46
|
+
application/x-sea sea;
|
47
|
+
application/x-shockwave-flash swf;
|
48
|
+
application/x-stuffit sit;
|
49
|
+
application/x-tcl tcl tk;
|
50
|
+
application/x-x509-ca-cert der pem crt;
|
51
|
+
application/x-xpinstall xpi;
|
52
|
+
application/zip zip;
|
53
|
+
|
54
|
+
application/octet-stream bin exe dll;
|
55
|
+
application/octet-stream deb;
|
56
|
+
application/octet-stream dmg;
|
57
|
+
application/octet-stream eot;
|
58
|
+
application/octet-stream iso img;
|
59
|
+
application/octet-stream msi msp msm;
|
60
|
+
|
61
|
+
audio/midi mid midi kar;
|
62
|
+
audio/mpeg mp3;
|
63
|
+
audio/x-realaudio ra;
|
64
|
+
|
65
|
+
video/3gpp 3gpp 3gp;
|
66
|
+
video/mpeg mpeg mpg;
|
67
|
+
video/quicktime mov;
|
68
|
+
video/x-flv flv;
|
69
|
+
video/x-mng mng;
|
70
|
+
video/x-ms-asf asx asf;
|
71
|
+
video/x-ms-wmv wmv;
|
72
|
+
video/x-msvideo avi;
|
73
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
##################################
|
2
|
+
## INTERNAL RULES IDS:1-10 ##
|
3
|
+
##################################
|
4
|
+
#weird_request : 1
|
5
|
+
#big_body : 2
|
6
|
+
#no_content_type : 3
|
7
|
+
|
8
|
+
#MainRule "str:123FREETEXT" "msg:learning test pattern" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:BLOCK" id:0;
|
9
|
+
|
10
|
+
##################################
|
11
|
+
## SQL Injections IDs:1000-1099 ##
|
12
|
+
##################################
|
13
|
+
MainRule "rx:select|union|update|delete|insert|table|from|ascii|hex|unhex" "msg:sql keywords" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1000;
|
14
|
+
MainRule "str:\"" "msg:double quote" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:8,$XSS:8" id:1001;
|
15
|
+
MainRule "str:0x" "msg:0x, possible hex encoding" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:2" id:1002;
|
16
|
+
## Hardcore rules
|
17
|
+
MainRule "str:/*" "msg:mysql comment (/*)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:8" id:1003;
|
18
|
+
MainRule "str:*/" "msg:mysql comment (*/)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:8" id:1004;
|
19
|
+
MainRule "str:|" "msg:mysql keyword (|)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:8" id:1005;
|
20
|
+
MainRule "rx:&&" "msg:mysql keyword (&&)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:8" id:1006;
|
21
|
+
## end of hardcore rules
|
22
|
+
MainRule "str:--" "msg:mysql comment (--)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1007;
|
23
|
+
MainRule "str:;" "msg:; in stuff" "mz:BODY|URL|ARGS" "s:$SQL:4,$XSS:8" id:1008;
|
24
|
+
MainRule "str:=" "msg:equal in var, probable sql/xss" "mz:ARGS|BODY" "s:$SQL:2" id:1009;
|
25
|
+
MainRule "str:(" "msg:parenthesis, probable sql/xss" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$SQL:4,$XSS:8" id:1010;
|
26
|
+
MainRule "str:)" "msg:parenthesis, probable sql/xss" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$SQL:4,$XSS:8" id:1011;
|
27
|
+
MainRule "str:'" "msg:simple quote" "mz:ARGS|BODY|URL|$HEADERS_VAR:Cookie" "s:$SQL:4,$XSS:8" id:1013;
|
28
|
+
MainRule "str:," "msg:, in stuff" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1015;
|
29
|
+
MainRule "str:#" "msg:mysql comment (#)" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1016;
|
30
|
+
|
31
|
+
###############################
|
32
|
+
## OBVIOUS RFI IDs:1100-1199 ##
|
33
|
+
###############################
|
34
|
+
MainRule "str:http://" "msg:http:// scheme" "mz:ARGS|BODY|$HEADERS_VAR:Cookie" "s:$RFI:8" id:1100;
|
35
|
+
MainRule "str:https://" "msg:https:// scheme" "mz:ARGS|BODY|$HEADERS_VAR:Cookie" "s:$RFI:8" id:1101;
|
36
|
+
MainRule "str:ftp://" "msg:ftp:// scheme" "mz:ARGS|BODY|$HEADERS_VAR:Cookie" "s:$RFI:8" id:1102;
|
37
|
+
MainRule "str:php://" "msg:php:// scheme" "mz:ARGS|BODY|$HEADERS_VAR:Cookie" "s:$RFI:8" id:1103;
|
38
|
+
|
39
|
+
#######################################
|
40
|
+
## Directory traversal IDs:1200-1299 ##
|
41
|
+
#######################################
|
42
|
+
MainRule "str:.." "msg:double dot" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:4" id:1200;
|
43
|
+
MainRule "str:/etc/passwd" "msg:obvious probe" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:4" id:1202;
|
44
|
+
MainRule "str:c:\\" "msg:obvious windows path" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:4" id:1203;
|
45
|
+
MainRule "str:cmd.exe" "msg:obvious probe" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:4" id:1204;
|
46
|
+
MainRule "str:\\" "msg:backslash" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:4" id:1205;
|
47
|
+
#MainRule "str:/" "msg:slash in args" "mz:ARGS|BODY|$HEADERS_VAR:Cookie" "s:$TRAVERSAL:2" id:1206;
|
48
|
+
|
49
|
+
########################################
|
50
|
+
## Cross Site Scripting IDs:1300-1399 ##
|
51
|
+
########################################
|
52
|
+
MainRule "str:<" "msg:html open tag" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$XSS:8" id:1302;
|
53
|
+
MainRule "str:>" "msg:html close tag" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$XSS:8" id:1303;
|
54
|
+
MainRule "str:[" "msg:[, possible js" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$XSS:4" id:1310;
|
55
|
+
MainRule "str:]" "msg:], possible js" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$XSS:4" id:1311;
|
56
|
+
MainRule "str:~" "msg:~ character" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$XSS:4" id:1312;
|
57
|
+
MainRule "str:`" "msg:grave accent !" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$XSS:8" id:1314;
|
58
|
+
MainRule "rx:%[2|3]." "msg:double encoding !" "mz:ARGS|URL|BODY|$HEADERS_VAR:Cookie" "s:$XSS:8" id:1315;
|
59
|
+
|
60
|
+
####################################
|
61
|
+
## Evading tricks IDs: 1400-1500 ##
|
62
|
+
####################################
|
63
|
+
MainRule "str:&#" "msg: utf7/8 encoding" "mz:ARGS|BODY|URL|$HEADERS_VAR:Cookie" "s:$EVADE:4" id:1400;
|
64
|
+
MainRule "str:%U" "msg: M$ encoding" "mz:ARGS|BODY|URL|$HEADERS_VAR:Cookie" "s:$EVADE:4" id:1401;
|
65
|
+
MainRule negative "rx:multipart/form-data|application/x-www-form-urlencoded" "msg:Content is neither mulipart/x-www-form.." "mz:$HEADERS_VAR:Content-type" "s:$EVADE:4" id:1402;
|
66
|
+
|
67
|
+
#############################
|
68
|
+
## File uploads: 1500-1600 ##
|
69
|
+
#############################
|
70
|
+
MainRule "rx:.ph*|.asp*" "msg:asp/php file upload!" "mz:FILE_EXT" "s:$UPLOAD:8" id:1500;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../helpers', __FILE__)
|
2
|
+
|
3
|
+
describe 'nginx::default' do
|
4
|
+
include Helpers::Nginx
|
5
|
+
it 'installs nginx' do
|
6
|
+
package("nginx").must_be_installed
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'runs a service named nginx' do
|
10
|
+
service("nginx").must_be_running
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
maintainer "Opscode, Inc."
|
2
|
+
maintainer_email "cookbooks@opscode.com"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Installs and configures nginx"
|
5
|
+
version "1.0.2"
|
6
|
+
|
7
|
+
recipe "nginx", "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available"
|
8
|
+
recipe "nginx::source", "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"
|
9
|
+
|
10
|
+
%w{ ubuntu debian centos redhat amazon scientific oracle fedora }.each do |os|
|
11
|
+
supports os
|
12
|
+
end
|
13
|
+
|
14
|
+
%w{ build-essential runit bluepill yum }.each do |cb|
|
15
|
+
depends cb
|
16
|
+
end
|
17
|
+
|
18
|
+
depends 'ohai', '>= 1.1.0'
|
19
|
+
|
20
|
+
attribute "nginx/dir",
|
21
|
+
:display_name => "Nginx Directory",
|
22
|
+
:description => "Location of nginx configuration files",
|
23
|
+
:default => "/etc/nginx"
|
24
|
+
|
25
|
+
attribute "nginx/log_dir",
|
26
|
+
:display_name => "Nginx Log Directory",
|
27
|
+
:description => "Location for nginx logs",
|
28
|
+
:default => "/var/log/nginx"
|
29
|
+
|
30
|
+
attribute "nginx/user",
|
31
|
+
:display_name => "Nginx User",
|
32
|
+
:description => "User nginx will run as",
|
33
|
+
:default => "www-data"
|
34
|
+
|
35
|
+
attribute "nginx/binary",
|
36
|
+
:display_name => "Nginx Binary",
|
37
|
+
:description => "Location of the nginx server binary",
|
38
|
+
:default => "/usr/sbin/nginx"
|
39
|
+
|
40
|
+
attribute "nginx/gzip",
|
41
|
+
:display_name => "Nginx Gzip",
|
42
|
+
:description => "Whether gzip is enabled",
|
43
|
+
:default => "on"
|
44
|
+
|
45
|
+
attribute "nginx/gzip_http_version",
|
46
|
+
:display_name => "Nginx Gzip HTTP Version",
|
47
|
+
:description => "Version of HTTP Gzip",
|
48
|
+
:default => "1.0"
|
49
|
+
|
50
|
+
attribute "nginx/gzip_comp_level",
|
51
|
+
:display_name => "Nginx Gzip Compression Level",
|
52
|
+
:description => "Amount of compression to use",
|
53
|
+
:default => "2"
|
54
|
+
|
55
|
+
attribute "nginx/gzip_proxied",
|
56
|
+
:display_name => "Nginx Gzip Proxied",
|
57
|
+
:description => "Whether gzip is proxied",
|
58
|
+
:default => "any"
|
59
|
+
|
60
|
+
attribute "nginx/gzip_types",
|
61
|
+
:display_name => "Nginx Gzip Types",
|
62
|
+
:description => "Supported MIME-types for gzip",
|
63
|
+
:type => "array",
|
64
|
+
:default => [ "text/plain", "text/css", "application/x-javascript", "text/xml", "application/xml", "application/xml+rss", "text/javascript", "application/javascript", "application/json" ]
|
65
|
+
|
66
|
+
attribute "nginx/keepalive",
|
67
|
+
:display_name => "Nginx Keepalive",
|
68
|
+
:description => "Whether to enable keepalive",
|
69
|
+
:default => "on"
|
70
|
+
|
71
|
+
attribute "nginx/keepalive_timeout",
|
72
|
+
:display_name => "Nginx Keepalive Timeout",
|
73
|
+
:default => "65"
|
74
|
+
|
75
|
+
attribute "nginx/worker_processes",
|
76
|
+
:display_name => "Nginx Worker Processes",
|
77
|
+
:description => "Number of worker processes",
|
78
|
+
:default => "1"
|
79
|
+
|
80
|
+
attribute "nginx/worker_connections",
|
81
|
+
:display_name => "Nginx Worker Connections",
|
82
|
+
:description => "Number of connections per worker",
|
83
|
+
:default => "1024"
|
84
|
+
|
85
|
+
attribute "nginx/server_names_hash_bucket_size",
|
86
|
+
:display_name => "Nginx Server Names Hash Bucket Size",
|
87
|
+
:default => "64"
|
88
|
+
|
89
|
+
attribute "nginx/disable_access_log",
|
90
|
+
:display_name => "Disable Access Log",
|
91
|
+
:default => "false"
|
92
|
+
|
93
|
+
attribute "nginx/default_site_enabled",
|
94
|
+
:display_name => "Default site enabled",
|
95
|
+
:default => "true"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: http_stub_status_module
|
4
|
+
#
|
5
|
+
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
6
|
+
#
|
7
|
+
# Copyright 2012, Riot Games
|
8
|
+
#
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
# you may not use this file except in compliance with the License.
|
11
|
+
# You may obtain a copy of the License at
|
12
|
+
#
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
#
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
# See the License for the specific language governing permissions and
|
19
|
+
# limitations under the License.
|
20
|
+
#
|
21
|
+
|
22
|
+
node.default['nginx']['remote_ip_var'] = "remote_addr"
|
23
|
+
node.default['nginx']['authorized_ips'] = ["127.0.0.1/32"]
|
24
|
+
|
25
|
+
service "nginx" do
|
26
|
+
supports :status => true, :restart => true, :reload => true
|
27
|
+
end
|
28
|
+
|
29
|
+
template "authorized_ip" do
|
30
|
+
path "#{node['nginx']['dir']}/authorized_ip"
|
31
|
+
source "modules/authorized_ip.erb"
|
32
|
+
owner "root"
|
33
|
+
group "root"
|
34
|
+
mode "0644"
|
35
|
+
variables(
|
36
|
+
:remote_ip_var => node['nginx']['remote_ip_var'],
|
37
|
+
:authorized_ips => node['nginx']['authorized_ips']
|
38
|
+
)
|
39
|
+
|
40
|
+
notifies :reload, resources(:service => "nginx")
|
41
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: commons
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2012, Opscode, Inc.
|
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 "nginx::commons_dir"
|
22
|
+
include_recipe "nginx::commons_script"
|
23
|
+
include_recipe "nginx::commons_conf"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: common/conf
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2012, Opscode, Inc.
|
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
|
+
template "nginx.conf" do
|
22
|
+
path "#{node['nginx']['dir']}/nginx.conf"
|
23
|
+
source "nginx.conf.erb"
|
24
|
+
owner "root"
|
25
|
+
group "root"
|
26
|
+
mode "0644"
|
27
|
+
notifies :reload, 'service[nginx]', :immediately
|
28
|
+
end
|
29
|
+
|
30
|
+
template "#{node['nginx']['dir']}/sites-available/default" do
|
31
|
+
source "default-site.erb"
|
32
|
+
owner "root"
|
33
|
+
group "root"
|
34
|
+
mode 0644
|
35
|
+
end
|
36
|
+
|
37
|
+
nginx_site 'default' do
|
38
|
+
enable node['nginx']['default_site_enabled']
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: common/dir
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2012, Opscode, Inc.
|
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
|
+
directory node['nginx']['dir'] do
|
22
|
+
owner "root"
|
23
|
+
group "root"
|
24
|
+
mode "0755"
|
25
|
+
end
|
26
|
+
|
27
|
+
directory node['nginx']['log_dir'] do
|
28
|
+
mode 0755
|
29
|
+
owner node['nginx']['user']
|
30
|
+
action :create
|
31
|
+
end
|
32
|
+
|
33
|
+
%w(sites-available sites-enabled conf.d).each do |leaf|
|
34
|
+
directory File.join(node['nginx']['dir'], leaf) do
|
35
|
+
owner "root"
|
36
|
+
group "root"
|
37
|
+
mode "0755"
|
38
|
+
end
|
39
|
+
end
|