From 4b0c766c5acac32e3ed71cfa9b341eb95c8a7996 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Sat, 13 Apr 2013 21:28:26 +0300 Subject: [PATCH] Initial version of murmur module --- murmur/Makefile | 18 ++++ murmur/files/murmur.init | 56 ++++++++++++ murmur/manifests/init.pp | 113 ++++++++++++++++++++++++ murmur/templates/murmur.ini.erb | 150 ++++++++++++++++++++++++++++++++ 4 files changed, 337 insertions(+) create mode 100644 murmur/Makefile create mode 100644 murmur/files/murmur.init create mode 100644 murmur/manifests/init.pp create mode 100644 murmur/templates/murmur.ini.erb diff --git a/murmur/Makefile b/murmur/Makefile new file mode 100644 index 0000000..952bf9c --- /dev/null +++ b/murmur/Makefile @@ -0,0 +1,18 @@ +include $(CURDIR)/../Makefile.inc + +VERSION = 1.2.3 + +TARGET = murmur-static_x86-$(VERSION).tar.bz2 +SOURCE = http://downloads.sourceforge.net/project/mumble/Mumble/$(VERSION)/murmur-static_x86-$(VERSION).tar.bz2 + +all: download manifest +download: $(PACKAGES)/$(TARGET) +manifest: $(MANIFESTS)/murmur.pp + +$(PACKAGES)/$(TARGET): + @umask 022; echo $@; \ + test -f $@ || curl -o $@ $(SOURCE) + +$(MANIFESTS)/murmur.pp: $(PACKAGES)/$(TARGET) + @umask 022; echo $@; \ + echo '$$murmur_package_latest = "$(TARGET)"' > $@ diff --git a/murmur/files/murmur.init b/murmur/files/murmur.init new file mode 100644 index 0000000..2b6622e --- /dev/null +++ b/murmur/files/murmur.init @@ -0,0 +1,56 @@ +#!/bin/bash + +# chkconfig: 35 90 12 +# description: Murmur Service +# processname: murmur + +[ -f /etc/rc.d/init.d/functions ] || exit 0 +. /etc/rc.d/init.d/functions + +RETVAL=0 +PROG="/usr/local/murmur/murmur.x86" +ARGS="-ini /srv/murmur/murmur.ini" + +start() { + echo -n "Starting Murmur server: " + daemon --user murmur $PROG $ARGS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/murmur + return $RETVAL +} + +stop() { + echo -n "Stopping Murmur server: " + killproc $PROG + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/murmur + return $RETVAL +} + +case "$1" in + start) + start + ;; + + stop) + stop + ;; + + status) + status $PROG + ;; + + restart|reload|condrestart) + stop + sleep 2 + start + ;; + + *) + echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" + exit 1 +esac + +exit $RETVAL diff --git a/murmur/manifests/init.pp b/murmur/manifests/init.pp new file mode 100644 index 0000000..a4919db --- /dev/null +++ b/murmur/manifests/init.pp @@ -0,0 +1,113 @@ +# Install murmur (Mumble server). +# +# === Global variables +# +# $murmur_ssl_key: +# Path to SSL private key. +# +# $murmur_ssl_cert: +# Path to SSL certificate. +# +# $murmur_password: +# Server passwords. Defaults to none. +# +# $murmur_welcome: +# Server welcome message. +# +class murmur { + + if !$murmur_package { + if $murmur_package_latest { + $murmur_package = $murmur_package_latest + } else { + fail("Must define \$murmur_package or \$murmur_package_latest") + } + } + + if !$murmur_password { + $murmur_password = "" + } + if !$murmur_welcome { + $murmur_welcome = "
Welcome to this server running Murmur.
" + } + + file { "/usr/local/src/murmur-static_x86.tar.bz2": + ensure => present, + mode => "0644", + owner => "root", + group => "root", + source => "puppet:///files/packages/${murmur_package}", + } + util::extract::tar { "/usr/local/murmur": + strip => 1, + source => "/usr/local/src/murmur-static_x86.tar.bz2", + require => File["/usr/local/src/murmur-static_x86.tar.bz2"], + notify => Service["murmur"], + } + + include user::system + realize(User["murmur"], Group["murmur"]) + + if !$murmur_ssl_key { + $murmur_ssl_key = "${puppet_ssldir}/private_keys/${homename}.pem" + } + if !$murmur_ssl_cert { + $murmur_ssl_cert = "${puppet_ssldir}/certs/${homename}.pem" + } + + include ssl + file { "${ssl::certs}/murmur.crt": + ensure => present, + mode => "0644", + owner => "root", + group => "root", + source => $murmur_ssl_cert, + notify => Service["murmur"], + } + file { "${ssl::private}/murmur.key": + ensure => present, + mode => "0640", + owner => "root", + group => "murmur", + source => $murmur_ssl_key, + require => Group["murmur"], + notify => Service["murmur"], + } + + file { "/srv/murmur": + ensure => directory, + mode => "0700", + owner => "murmur", + group => "murmur", + require => User["murmur"], + } + file { "/srv/murmur/murmur.ini": + ensure => present, + mode => "0600", + owner => "murmur", + group => "murmur", + content => template("murmur/murmur.ini.erb"), + require => File["/srv/murmur"], + notify => Service["murmur"], + } + + file { "/etc/init.d/murmur": + ensure => present, + mode => "0755", + owner => "root", + group => "root", + source => "puppet:///modules/murmur/murmur.init", + notify => Exec["add-service-murmur"], + } + exec { "add-service-murmur": + path => "/bin:/usr/bin:/sbin:/usr/sbin", + command => "chkconfig --add murmur", + refreshonly => true, + before => Service["murmur"], + } + service { "murmur": + ensure => running, + enable => true, + } + +} diff --git a/murmur/templates/murmur.ini.erb b/murmur/templates/murmur.ini.erb new file mode 100644 index 0000000..738939f --- /dev/null +++ b/murmur/templates/murmur.ini.erb @@ -0,0 +1,150 @@ +# Path to database. If blank, will search for +# murmur.sqlite in default locations or create it if not found. +database=/srv/murmur/murmur.sqlite + +# If you wish to use something other than SQLite, you'll need to set the name +# of the database above, and also uncomment the below. +# Sticking with SQLite is strongly recommended, as it's the most well tested +# and by far the fastest solution. +# +#dbDriver=QMYSQL +#dbUsername= +#dbPassword= +#dbHost= +#dbPort= +#dbPrefix=murmur_ +#dbOpts= + +# Murmur defaults to not using D-Bus. If you wish to use dbus, which is one of the +# RPC methods available in murmur, please specify so here. +# +#dbus=session + +# Alternate service name. Only use if you are running distinct +# murmurd processes connected to the same D-Bus daemon. +#dbusservice=net.sourceforge.mumble.murmur + +# If you want to use ZeroC Ice to communicate with Murmur, you need +# to specify the endpoint to use. Since there is no authentication +# with ICE, you should only use it if you trust all the users who have +# shell access to your machine. +# Please see the ICE documentation on how to specify endpoints. +#ice="tcp -h 127.0.0.1 -p 6502" + +# Ice primarily uses local sockets. This means anyone who has a +# user account on your machine can connect to the Ice services. +# You can set a plaintext "secret" on the Ice connection, and +# any script attempting to access must then have this secret +# (as context with name "secret"). +# Access is split in read (look only) and write (modify) +# operations. Write access always includes read access, +# unless read is explicitly denied (see note below). +# +# Note that if this is uncommented and with empty content, +# access will be denied. + +icesecretread= +icesecretwrite= + +# How many login attempts do we tolerate from one IP +# inside a given timeframe before we ban the connection? +# Note that this is global (shared between all virtual servers), and that +# it counts both successfull and unsuccessfull connection attempts. +# Set either Attempts or Timeframe to 0 to disable. +#autobanAttempts = 10 +#autobanTimeframe = 120 +#autobanTime = 300 + +# Murmur default to logging to murmur.log. If you leave this blank, +# murmur will log to the console (linux) or through message boxes (win32). +logfile=/srv/murmur/murmur.log + +# If set, murmur will write its process ID to this file. +pidfile=/srv/murmur/murmur.pid + +# The below will be used as defaults for new configured servers. +# If you're just running one server (the default), it's easier to +# configure it here than through D-Bus or Ice. +# +# Welcome message sent to clients when they connect +welcometext="<%= murmur_welcome %>" + +# Port to bind TCP and UDP sockets to +port=64738 + +# Specific IP or hostname to bind to. +# If this is left blank (default), murmur will bind to all available addresses. +#host= + +# Password to join server +serverpassword=<%= murmur_password %> + +# Maximum bandwidth (in bits per second) clients are allowed +# to send speech at. +bandwidth=72000 + +# Maximum number of concurrent clients allowed. +users=100 + +# Regular expression used to validate channel names +# (note that you have to escape backslashes with \ ) +#channelname=[ \\-=\\w\\#\\[\\]\\{\\}\\(\\)\\@\\|]+ + +# Regular expression used to validate user names +# (note that you have to escape backslashes with \ ) +#username=[-=\\w\\[\\]\\{\\}\\(\\)\\@\\|\\.]+ + +# Maximum length of text messages in characters. 0 for no limit. +#textmessagelength=5000 + +# Maximum length of text messages in characters, with image data. 0 for no limit. +#imagemessagelength=131072 + +# Allow clients to use HTML in messages, user comments and channel descriptions? +#allowhtml=true + +# Murmur retains the per-server log entries in an internal database which +# allows it to be accessed over D-Bus/ICE. +# How many days should such entries be kept? +# Set to 0 to keep forever, or -1 to disable logging to the DB +#logdays=31 + +# To enable public server registration, the serverpassword must be blank, and +# this must all be filled out. +# The password here is used to create a registry for the server name; subsequent +# updates will need the same password. Don't lose your password. +# The URL is your own website, and only set the registerHostname for static IP +# addresses. +# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name. +# +#registerName=Mumble Server +#registerPassword=secret +#registerUrl=http://mumble.sourceforge.net/ +#registerHostname= + +# To enable bonjour service discovery uncomment the following line. +# To change the name announced by bonjour adjust the registerName variable. +# See http://developer.apple.com/networking/bonjour/index.html for more information +# about bonjour. +bonjour=False + +# If you have a proper SSL certificate, you can provide the filenames here. +# Otherwise, Murmur will create it's own certificate automatically. +sslCert=<%= scope.lookupvar('ssl::certs') %>/murmur.crt +sslKey=<%= scope.lookupvar('ssl::private') %>/murmur.key + +# If murmur is started as root, which user should it switch to? +# This option is ignored if murmur isn't started with root privileges. +#uname= + +# If this options is enabled, only clients which have a certificate are allowed +# to connect. +#certrequired=False + +# You can configure any of the configuration options for Ice here. We recommend +# leave the defaults as they are. +# Please note that this section has to be last in the configuration file. +# +[Ice] +Ice.Warn.UnknownProperties=1 +Ice.MessageSizeMax=65536