From 752d776b04ca8835b943efd4aabc2e60f2e1c3cd Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 17 Jun 2013 22:49:32 +0100 Subject: [PATCH] Add cgiirc cookbook --- cookbooks/cgiirc/README.rdoc | 8 ++++ cookbooks/cgiirc/metadata.rb | 7 +++ cookbooks/cgiirc/recipes/default.rb | 43 +++++++++++++++++++ cookbooks/cgiirc/templates/default/apache.erb | 22 ++++++++++ .../templates/default/cgiirc.config.erb | 24 +++++++++++ .../cgiirc/templates/default/ipaccess.erb | 16 +++++++ 6 files changed, 120 insertions(+) create mode 100644 cookbooks/cgiirc/README.rdoc create mode 100644 cookbooks/cgiirc/metadata.rb create mode 100644 cookbooks/cgiirc/recipes/default.rb create mode 100644 cookbooks/cgiirc/templates/default/apache.erb create mode 100644 cookbooks/cgiirc/templates/default/cgiirc.config.erb create mode 100644 cookbooks/cgiirc/templates/default/ipaccess.erb diff --git a/cookbooks/cgiirc/README.rdoc b/cookbooks/cgiirc/README.rdoc new file mode 100644 index 000000000..3de2ec7a3 --- /dev/null +++ b/cookbooks/cgiirc/README.rdoc @@ -0,0 +1,8 @@ += DESCRIPTION: + += REQUIREMENTS: + += ATTRIBUTES: + += USAGE: + diff --git a/cookbooks/cgiirc/metadata.rb b/cookbooks/cgiirc/metadata.rb new file mode 100644 index 000000000..d8a3657c1 --- /dev/null +++ b/cookbooks/cgiirc/metadata.rb @@ -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 index 000000000..9098d5a2b --- /dev/null +++ b/cookbooks/cgiirc/recipes/default.rb @@ -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 index 000000000..ea6ada67b --- /dev/null +++ b/cookbooks/cgiirc/templates/default/apache.erb @@ -0,0 +1,22 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + 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 + + + AddHandler cgi-script .cgi + + + + RemoveOutputFilter DEFLATE + SetEnv no-gzip + + diff --git a/cookbooks/cgiirc/templates/default/cgiirc.config.erb b/cookbooks/cgiirc/templates/default/cgiirc.config.erb new file mode 100644 index 000000000..30708a6dc --- /dev/null +++ b/cookbooks/cgiirc/templates/default/cgiirc.config.erb @@ -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 index 000000000..ba2851cf2 --- /dev/null +++ b/cookbooks/cgiirc/templates/default/ipaccess.erb @@ -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 -- 2.39.5