Add cgiirc cookbook
authorTom Hughes <tom@compton.nu>
Mon, 17 Jun 2013 21:49:32 +0000 (22:49 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 17 Jun 2013 21:49:32 +0000 (22:49 +0100)
cookbooks/cgiirc/README.rdoc [new file with mode: 0644]
cookbooks/cgiirc/metadata.rb [new file with mode: 0644]
cookbooks/cgiirc/recipes/default.rb [new file with mode: 0644]
cookbooks/cgiirc/templates/default/apache.erb [new file with mode: 0644]
cookbooks/cgiirc/templates/default/cgiirc.config.erb [new file with mode: 0644]
cookbooks/cgiirc/templates/default/ipaccess.erb [new file with mode: 0644]

diff --git a/cookbooks/cgiirc/README.rdoc b/cookbooks/cgiirc/README.rdoc
new file mode 100644 (file)
index 0000000..3de2ec7
--- /dev/null
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
diff --git a/cookbooks/cgiirc/metadata.rb b/cookbooks/cgiirc/metadata.rb
new file mode 100644 (file)
index 0000000..d8a3657
--- /dev/null
@@ -0,0 +1,7 @@
+maintainer        "OpenStreetMap Administrators"
+maintainer_email  "admins@openstreetmap.org"
+license           "Apache 2.0"
+description       "Installs and configures cgiirc"
+long_description  IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version           "1.0.0"
+depends           "apache"
diff --git a/cookbooks/cgiirc/recipes/default.rb b/cookbooks/cgiirc/recipes/default.rb
new file mode 100644 (file)
index 0000000..9098d5a
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: cgiirc
+# Recipe:: default
+#
+# Copyright 2011, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "apache"
+
+blocks = data_bag_item("cgiirc", "blocks")
+
+package "cgiirc"
+
+template "/etc/cgiirc/cgiirc.config" do
+  source "cgiirc.config.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
+
+template "/etc/cgiirc/ipaccess" do
+  source "ipaccess.erb"
+  owner "root"
+  group "root"
+  mode 0644
+  variables :blocks => blocks["addresses"]
+end
+
+apache_site "irc.openstreetmap.org" do
+  template "apache.erb"
+end
diff --git a/cookbooks/cgiirc/templates/default/apache.erb b/cookbooks/cgiirc/templates/default/apache.erb
new file mode 100644 (file)
index 0000000..ea6ada6
--- /dev/null
@@ -0,0 +1,22 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:80>
+       ServerName <%= @name %>
+       ServerAdmin webmaster@openstreetmap.org
+
+       CustomLog /var/log/apache2/<%= @name %>-access.log combined
+       ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+       DocumentRoot /usr/lib/cgi-bin/cgiirc
+       DirectoryIndex irc.cgi
+       Alias /images /usr/share/images/cgiirc
+
+       <Directory "/usr/lib/cgi-bin/cgiirc">
+               AddHandler cgi-script .cgi
+       </Directory>
+
+       <IfModule mod_deflate.c>
+               RemoveOutputFilter DEFLATE
+               SetEnv no-gzip
+       </IfModule>
+</VirtualHost>
diff --git a/cookbooks/cgiirc/templates/default/cgiirc.config.erb b/cookbooks/cgiirc/templates/default/cgiirc.config.erb
new file mode 100644 (file)
index 0000000..30708a6
--- /dev/null
@@ -0,0 +1,24 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+# CGI:IRC configuration file.
+#
+# Check /usr/share/doc/cgiirc/examples/cgiirc.config.full.gz
+# for more details.
+
+# Configure defaults
+default_server = irc.oftc.net
+default_port = 6667
+default_channel = #osm,#osm-dev,#osm-ewg,#osm-au,#osm-by,#osm-ca,#osm-ch,#osm-de,#osm-dk,#osm-es,#osm-fi,#osm-fr,#osm-gb,#osm-ie,#osm-it,#osm-local,#osm-lv,#osm-nl,#osm-no,#osm-nominatim,#osm-pl,#osm-pt,#osm-ru,#osm.se,#osm-strategic,#osm-us,#osm-za,#hot
+default_name = CGI:IRC User
+default_nick = CGI???
+
+# Path to images
+image_path = /images
+
+# Paths to CGI scripts
+script_nph = nph-irc.cgi
+script_form = client-perl.cgi
+script_login = irc.cgi
+
+# Access control file
+ip_access_file = ipaccess
diff --git a/cookbooks/cgiirc/templates/default/ipaccess.erb b/cookbooks/cgiirc/templates/default/ipaccess.erb
new file mode 100644 (file)
index 0000000..ba2851c
--- /dev/null
@@ -0,0 +1,16 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+# CGI:IRC ipaccess file. (For CGI:IRC versions from 0.5.3).
+#
+# Check /usr/share/doc/cgiirc/examples/ipaccess.example
+# for more details.
+
+<% @blocks.each do |name,addresses| -%>
+# Block <%= name %>
+<% addresses.each do |address| -%>
+<%= address %> 0
+<% end -%>
+
+<% end -%>
+# Allow everybody.
+0.0.0.0/0