diff --git a/install/apps/metronome-init b/install/apps/metronome-init new file mode 100644 index 0000000000000000000000000000000000000000..78ba7ea14accccbc866cf1294c88f68f0821e8fc --- /dev/null +++ b/install/apps/metronome-init @@ -0,0 +1,75 @@ +#! /bin/sh +# +# metronome Start/stop metronome server +# + +### BEGIN INIT INFO +# Provides: metronome +# Required-Start: $remote_fs $network $named $time +# Required-Stop: $remote_fs $network $named $time +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts metronome server +# Description: Starts metronome server, an XMPP server written in Lua. +### END INIT INFO + +METRONOME=/usr/bin/metronomectl +PIDDIR=/var/run/metronome +NAME=metronome + +test -e $METRONOME || exit 0 + +start() +{ + mkdir $PIDDIR -p + chown metronome:metronome $PIDDIR + chmod 750 $PIDDIR + + $METRONOME start >> /dev/null +} + +stop() +{ + $METRONOME stop >> /dev/null +} + +reload() +{ + &METRONOME reload >> /dev/null +} + +restart() +{ + &METRONOME restart >> /dev/null +} + +case "$1" in + start) + echo -n "Starting Metronome..." + start & + ;; + stop) + echo -n "Stopping Metronome..." + stop & + ;; + reload) + echo -n "Reloading Metronome config..." + reload & + ;; + restart) + echo -n "Restarting Metronome..." + restart & + ;; + *) + echo "Usage: $0 {start|stop|reload|restart}" >&2 + exit 1 + ;; +esac + +if [ $? -eq 0 ]; then + echo . +else + echo " failed!" +fi + +exit 0 diff --git a/install/apps/metronome_libs/mod_auth_external/authenticate_isp.sh b/install/apps/metronome_libs/mod_auth_external/authenticate_isp.sh new file mode 100644 index 0000000000000000000000000000000000000000..c5a0c8e6846b85087bcc6f3f1ba3ae764f1a7a3c --- /dev/null +++ b/install/apps/metronome_libs/mod_auth_external/authenticate_isp.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +IFS=":" +AUTH_OK=1 +AUTH_FAILED=0 +LOGFILE="/var/log/metronome/auth.log" +USELOG=true + +while read ACTION USER HOST PASS ; do + + [ $USELOG == true ] && { echo "Date: $(date) Action: $ACTION User: $USER Host: $HOST" >> $LOGFILE; } + + case $ACTION in + "auth") + if [ `/usr/bin/php /usr/lib/metronome/isp-modules/mod_auth_external/db_auth.php $USER $HOST $PASS 2>/dev/null` == 1 ] ; then + echo $AUTH_OK + [ $USELOG == true ] && { echo "AUTH OK" >> $LOGFILE; } + else + echo $AUTH_FAILED + [ $USELOG == true ] && { echo "AUTH FAILED" >> $LOGFILE; } + fi + ;; + "isuser") + if [ `/usr/bin/php /usr/lib/metronome/isp-modules/mod_auth_external/db_isuser.php $USER $HOST 2>/dev/null` == 1 ] ; then + echo $AUTH_OK + [ $USELOG == true ] && { echo "ISUSER OK" >> $LOGFILE; } + else + echo $AUTH_FAILED + [ $USELOG == true ] && { echo "ISUSER FAILED" >> $LOGFILE; } + fi + ;; + *) + echo $AUTH_FAILED + [ $USELOG == true ] && { echo "UNKNOWN ACTION GIVEN: $ACTION" >> $LOGFILE; } + ;; + esac + +done diff --git a/install/apps/metronome_libs/mod_auth_external/db_auth.php b/install/apps/metronome_libs/mod_auth_external/db_auth.php new file mode 100644 index 0000000000000000000000000000000000000000..086dcf6a0143efbb8562f3817d0fc7c58c03d949 --- /dev/null +++ b/install/apps/metronome_libs/mod_auth_external/db_auth.php @@ -0,0 +1,58 @@ +real_escape_string($arg_email); + $result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE '".$dbmail."' AND active='y' AND server_id='".$isp_server_id."'"); + result_false($result->num_rows != 1); + + $user = $result->fetch_object(); + + // check for domain autologin api key + $domain_key = 'f47kmm5Yh5hJzSws2KTS'; + + checkAuth($argv[1], $argv[2], $arg_password, $user->password, $domain_key); +}catch(Exception $ex){ + echo 0; + exit(); +} + +function result_false($cond = true){ + if(!$cond) return; + echo 0; + exit(); +} +function result_true(){ + echo 1; + exit(); +} +function checkAuth($user, $domain, $pw_arg, $pw_db, $domain_key){ + if(crypt($pw_arg, $pw_db) == $pw_db) + result_true(); + + if($domain_key){ + $datetime = new DateTime(); + $datetime->setTimezone(new DateTimeZone("UTC")); + for($t = $datetime->getTimestamp(); $t >= $datetime->getTimestamp()-30; $t--){ + $pw_api = md5($domain.'@'.$domain_key.'@'.$user.'@'.$t); + if($pw_api == $pw_arg) + result_true(); + } + } + result_false(); +} +?> \ No newline at end of file diff --git a/install/apps/metronome_libs/mod_auth_external/db_conf.inc.php b/install/apps/metronome_libs/mod_auth_external/db_conf.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..1aba63d6ea051ff4826312757b10af2a1c590525 --- /dev/null +++ b/install/apps/metronome_libs/mod_auth_external/db_conf.inc.php @@ -0,0 +1,6 @@ +real_escape_string($arg_email); + $result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE '".$dbmail."' AND active='y' AND server_id='".$isp_server_id."'"); + result_false($result->num_rows != 1); + result_true(); + +}catch(Exception $ex){ + echo 0; + exit(); +} + +function result_false($cond = true){ + if(!$cond) return; + echo 0; + exit(); +} +function result_true(){ + echo 1; + exit(); +} + +?> \ No newline at end of file diff --git a/install/apps/metronome_libs/mod_auth_external/mod_auth_external.lua b/install/apps/metronome_libs/mod_auth_external/mod_auth_external.lua new file mode 100644 index 0000000000000000000000000000000000000000..c86400610e2389b61b502b52b6b277fdad9419e7 --- /dev/null +++ b/install/apps/metronome_libs/mod_auth_external/mod_auth_external.lua @@ -0,0 +1,118 @@ +local nodeprep = require "util.encodings".stringprep.nodeprep; +local lpc = require "lpc"; + +local config = require "core.configmanager"; +local log = module._log; +local host = module.host; +local script_type = config.get(host, "external_auth_protocol") or "generic"; +assert(script_type == "ejabberd" or script_type == "generic"); +local command = config.get(host, "external_auth_command") or ""; +assert(type(command) == "string"); +assert(not host:find(":")); +local usermanager = require "core.usermanager"; +local jid_bare = require "util.jid".bare; +local new_sasl = require "util.sasl".new; + +local pid; +local readfile; +local writefile; + +local function send_query(text) + if pid and lpc.wait(pid,1) ~= nil then + log("debug","error, process died, force reopen"); + pid=nil; + end + if not pid then + log("debug", "Opening process " .. command); + pid, writefile, readfile = lpc.run(command); + end + if not pid then + log("debug", "Process failed to open"); + return nil; + end + + writefile:write(text); + writefile:flush(); + if script_type == "ejabberd" then + return readfile:read(4); + elseif script_type == "generic" then + return readfile:read(); + end +end + +function do_query(kind, username, password) + if not username then return nil, "not-acceptable"; end + username = nodeprep(username); + if not username then return nil, "jid-malformed"; end + + local query = (password and "%s:%s:%s:%s" or "%s:%s:%s"):format(kind, username, host, password); + local len = #query + if len > 1000 then return nil, "policy-violation"; end + + if script_type == "ejabberd" then + local lo = len % 256; + local hi = (len - lo) / 256; + query = string.char(hi, lo)..query; + end + if script_type == "generic" then + query = query..'\n'; + end + + local response = send_query(query); + if (script_type == "ejabberd" and response == "\0\2\0\0") or + (script_type == "generic" and response == "0") then + return nil, "not-authorized"; + elseif (script_type == "ejabberd" and response == "\0\2\0\1") or + (script_type == "generic" and response == "1") then + return true; + else + log("debug", "Nonsense back"); + return nil, "internal-server-error"; + end +end + +function new_external_provider(host) + local provider = { name = "external" }; + + function provider.test_password(username, password) + return do_query("auth", username, password); + end + + function provider.set_password(username, password) + return do_query("setpass", username, password); + end + + function provider.user_exists(username) + return do_query("isuser", username); + end + + function provider.create_user(username, password) return nil, "Account creation/modification not available."; end + + function provider.get_sasl_handler() + local testpass_authentication_profile = { + plain_test = function(sasl, username, password, realm) + return usermanager.test_password(username, realm, password), true; + end, + }; + return new_sasl(module.host, testpass_authentication_profile); + end + + function provider.is_admin(jid) + local admins = config.get(host, "admins"); + if admins ~= config.get("*", "admins") then + if type(admins) == "table" then + jid = jid_bare(jid); + for _,admin in ipairs(admins) do + if admin == jid then return true; end + end + elseif admins then + log("error", "Option 'admins' for host '%s' is not a table", host); + end + end + return usermanager.is_admin(jid); + end + + return provider; +end + +module:add_item("auth-provider", new_external_provider(host)); \ No newline at end of file diff --git a/install/apps/metronome_libs/mod_discoitems.lua b/install/apps/metronome_libs/mod_discoitems.lua new file mode 100644 index 0000000000000000000000000000000000000000..f05b9049073f540cef8686f4ed80579e9fa9ed28 --- /dev/null +++ b/install/apps/metronome_libs/mod_discoitems.lua @@ -0,0 +1,24 @@ +-- * Metronome IM * +-- +-- This file is part of the Metronome XMPP server and is released under the +-- ISC License, please see the LICENSE file in this source package for more +-- information about copyright and licensing. +-- +-- As per the sublicensing clause, this file is also MIT/X11 Licensed. +-- ** Copyright (c) 2009, Waqas Hussain + +local st = require "util.stanza"; + +local result_query = st.stanza("query", {xmlns = "http://jabber.org/protocol/disco#items"}); +for _, item in ipairs(module:get_option("disco_items") or {}) do + result_query:tag("item", {jid = item[1], name = item[2]}):up(); +end + +module:hook("iq/host/http://jabber.org/protocol/disco#items:query", function(event) + local stanza = event.stanza; + local query = stanza.tags[1]; + if stanza.attr.type == "get" and not query.attr.node then + event.origin.send(st.reply(stanza):add_child(result_query)); + return true; + end +end, 100); diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_away.png b/install/apps/metronome_libs/mod_webpresence/icons/status_away.png new file mode 100644 index 0000000000000000000000000000000000000000..0de5c6ab3d35e958b2c2c9fa9ee6e5876312b54b Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_away.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_chat.png b/install/apps/metronome_libs/mod_webpresence/icons/status_chat.png new file mode 100644 index 0000000000000000000000000000000000000000..324f40baf379ec677e4b7b9791f94298481d7e86 Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_chat.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_dnd.png b/install/apps/metronome_libs/mod_webpresence/icons/status_dnd.png new file mode 100644 index 0000000000000000000000000000000000000000..015f3da95dfe2a6c9dcdf414951c277104ae6b2e Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_dnd.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_offline.png b/install/apps/metronome_libs/mod_webpresence/icons/status_offline.png new file mode 100644 index 0000000000000000000000000000000000000000..12db2af7dd86308f5abed00e3930d7f961e1ecc3 Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_offline.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_online.png b/install/apps/metronome_libs/mod_webpresence/icons/status_online.png new file mode 100644 index 0000000000000000000000000000000000000000..fb257c3144736fd691d81ac82242f7d51f909679 Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_online.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/icons/status_xa.png b/install/apps/metronome_libs/mod_webpresence/icons/status_xa.png new file mode 100644 index 0000000000000000000000000000000000000000..321d35b5a3f1c832669154c1bc8f4f000c42e761 Binary files /dev/null and b/install/apps/metronome_libs/mod_webpresence/icons/status_xa.png differ diff --git a/install/apps/metronome_libs/mod_webpresence/mod_webpresence.lua b/install/apps/metronome_libs/mod_webpresence/mod_webpresence.lua new file mode 100644 index 0000000000000000000000000000000000000000..c1de0e0d37eaecba6afb4244a12d6d4a5245912d --- /dev/null +++ b/install/apps/metronome_libs/mod_webpresence/mod_webpresence.lua @@ -0,0 +1,118 @@ +module:depends("http"); + +local jid_split = require "util.jid".prepped_split; +local b64 = require "util.encodings".base64.encode; +local sha1 = require "util.hashes".sha1; +local stanza = require "util.stanza".stanza; +local json = require "util.json".encode_ordered; + +local function require_resource(name) + local icon_path = module:get_option_string("presence_icons", "icons"); + local f, err = module:load_resource(icon_path.."/"..name); + if f then + return f:read("*a"); + end + module:log("warn", "Failed to open image file %s", icon_path..name); + return ""; +end + +local statuses = { online = {}, away = {}, xa = {}, dnd = {}, chat = {}, offline = {} }; + +local function handle_request(event, path) + local status, message; + local jid, type = path:match("([^/]+)/?(.*)$"); + if jid then + local user, host = jid_split(jid); + if host and not user then + user, host = host, event.request.headers.host; + if host then host = host:gsub(":%d+$", ""); end + end + if user and host then + local user_sessions = hosts[host] and hosts[host].sessions[user]; + if user_sessions then + status = user_sessions.top_resources[1]; + if status and status.presence then + message = status.presence:child_with_name("status"); + status = status.presence:child_with_name("show"); + if not status then + status = "online"; + else + status = status:get_text(); + end + if message then + message = message:get_text(); + end + end + end + end + end + status = status or "offline"; + + statuses[status].image = function() + return { status_code = 200, headers = { content_type = "image/png" }, + body = require_resource("status_"..status..".png") + }; + end; + statuses[status].html = function() + local jid_hash = sha1(jid, true); + return { status_code = 200, headers = { content_type = "text/html" }, + body = [[]].. + tostring( + stanza("html") + :tag("head") + :tag("title"):text("XMPP Status Page for "..jid):up():up() + :tag("body") + :tag("div", { id = jid_hash.."_status", class = "xmpp_status" }) + :tag("img", { id = jid_hash.."_img", class = "xmpp_status_image xmpp_status_"..status, + src = "data:image/png;base64,"..b64(require_resource("status_"..status..".png")) }):up() + :tag("span", { id = jid_hash.."_status_name", class = "xmpp_status_name" }) + :text("\194\160"..status):up() + :tag("span", { id = jid_hash.."_status_message", class = "xmpp_status_message" }) + :text(message and "\194\160"..message.."" or "") + ) + }; + end; + statuses[status].text = function() + return { status_code = 200, headers = { content_type = "text/plain" }, + body = status + }; + end; + statuses[status].message = function() + return { status_code = 200, headers = { content_type = "text/plain" }, + body = (message and message or "") + }; + end; + statuses[status].json = function() + return { status_code = 200, headers = { content_type = "application/json" }, + body = json({ + jid = jid, + show = status, + status = (message and message or "null") + }) + }; + end; + statuses[status].xml = function() + return { status_code = 200, headers = { content_type = "application/xml" }, + body = [[]].. + tostring( + stanza("result") + :tag("jid"):text(jid):up() + :tag("show"):text(status):up() + :tag("status"):text(message) + ) + }; + end + + if ((type == "") or (not statuses[status][type])) then + type = "image" + end; + + return statuses[status][type](); +end + +module:provides("http", { + default_path = "/status"; + route = { + ["GET /*"] = handle_request; + }; +}); diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php index a3819966b9dc640d42723450d3869f5905c64639..e18faa4967e4c4f963c2faa329efbc6100bbc416 100644 --- a/install/dist/conf/debian60.conf.php +++ b/install/dist/conf/debian60.conf.php @@ -222,5 +222,9 @@ $conf['cron']['init_script'] = 'cron'; $conf['cron']['crontab_dir'] = '/etc/cron.d'; $conf['cron']['wget'] = '/usr/bin/wget'; +//* Metronome XMPP +$conf['xmpp']['installed'] = false; +$conf['xmpp']['init_script'] = 'metronome'; + ?> diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index 584e6aa91c19753b89210ec25df19253acc96bd1..fab5628a77cfe9b1e7da045adfebcf06f832b4a2 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -154,6 +154,10 @@ class installer extends installer_base { */ } + public function configure_xmpp() { + parent::configure_xmpp(); + } + } ?> diff --git a/install/install.php b/install/install.php index 91759f22844f4859c8ef9e83700f9ad225d51022..3aedfefa856c1c0ea05ae325f312130d2c3be834 100644 --- a/install/install.php +++ b/install/install.php @@ -347,6 +347,13 @@ if($install_mode == 'standard') { } */ + //* Configure XMPP + if($conf['xmpp']['installed'] == true){ + $conf['services']['xmpp'] = true; + swriteln('Configuring Metronome XMPP Server'); + $inst->configure_xmpp(); + } + //* Configure ISPConfig swriteln('Installing ISPConfig'); @@ -398,6 +405,7 @@ if($install_mode == 'standard') { //if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null'); + if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null'); } else { @@ -408,6 +416,7 @@ if($install_mode == 'standard') { $conf['services']['db'] = true; $conf['services']['firewall'] = false; $conf['services']['proxy'] = false; + $conf['services']['xmpp'] = false; //** Get Server ID @@ -639,6 +648,16 @@ if($install_mode == 'standard') { $inst->configure_firewall(); }*/ + //** Configure XMPP + if($conf['xmpp']['installed'] == true){ + if(strtolower($inst->simple_query('Configure Metronome XMPP Server', array('y', 'n'), 'y', 'configure_xmpp')) == 'y'){ + $conf['services']['xmpp'] = true; + swriteln('Configuring Metronome XMPP Server'); + $inst->configure_xmpp(); + if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null'); + } + } + //** Configure ISPConfig :-) $install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y'; if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') { diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index ae64463c1722e648e8101ae6392574fc3be66941..62ff8606a47458f05e291f62e06a0d0dd1b4af2e 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -155,6 +155,7 @@ class installer_base { if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true; if(is_installed('vzctl')) $conf['openvz']['installed'] = true; if(is_dir("/etc/Bastille")) $conf['bastille']['installed'] = true; + if(is_installed('metronome') && is_installed('metronomectl')) $conf['xmpp']['installed'] = true; if ($conf['services']['web'] && (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")))) $this->ispconfig_interface_installed = true; } @@ -1308,6 +1309,125 @@ class installer_base { } + public function configure_xmpp($options = '') { + global $conf; + + if($conf['xmpp']['installed'] == false) return; + //* Create the logging directory for xmpp server + if(!@is_dir('/var/log/metronome')) mkdir('/var/log/metronome', 0755, true); + chown('/var/log/metronome', 'metronome'); + if(!@is_dir('/var/run/metronome')) mkdir('/var/run/metronome', 0755, true); + chown('/var/run/metronome', 'metronome'); + if(!@is_dir('/var/lib/metronome')) mkdir('/var/lib/metronome', 0755, true); + chown('/var/lib/metronome', 'metronome'); + if(!@is_dir('/etc/metronome/hosts')) mkdir('/etc/metronome/hosts', 0755, true); + if(!@is_dir('/etc/metronome/status')) mkdir('/etc/metronome/status', 0755, true); + unlink('/etc/metronome/metronome.cfg.lua'); + + $row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$conf["server_id"].""); + $server_name = $row["server_name"]; + + $tpl = new tpl('metronome_conf_main.master'); + wf('/etc/metronome/metronome.cfg.lua', $tpl->grab()); + unset($tpl); + + $tpl = new tpl('metronome_conf_global.master'); + $tpl->setVar('xmpp_admins',''); + wf('/etc/metronome/global.cfg.lua', $tpl->grab()); + unset($tpl); + + // Copy isp libs + if(!@is_dir('/usr/lib/metronome/isp-modules')) mkdir('/usr/lib/metronome/isp-modules', 0755, true); + caselog('cp -rf apps/metronome_libs/* /usr/lib/metronome/isp-modules/', __FILE__, __LINE__); + // Process db config + $full_file_name = '/usr/lib/metronome/isp-modules/mod_auth_external/db_conf.inc.php'; + $content = rf($full_file_name); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($full_file_name, $content); + + if(!stristr($options, 'dont-create-certs')){ + // Create SSL Certificate for localhost + echo "writing new private key to 'localhost.key'\n-----\n"; + $ssl_country = $this->free_query('Country Name (2 letter code)', 'AU'); + $ssl_locality = $this->free_query('Locality Name (eg, city)', ''); + $ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd'); + $ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', ''); + $ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname']); + $ssl_email = $this->free_query('Email Address', ''); + + $tpl = new tpl('metronome_conf_ssl.master'); + $tpl->setVar('ssl_country',$ssl_country); + $tpl->setVar('ssl_locality',$ssl_locality); + $tpl->setVar('ssl_organisation',$ssl_organisation); + $tpl->setVar('ssl_organisation_unit',$ssl_organisation_unit); + $tpl->setVar('domain',$ssl_domain); + $tpl->setVar('ssl_email',$ssl_email); + wf('/etc/metronome/certs/localhost.cnf', $tpl->grab()); + unset($tpl); + // Generate new key, csr and cert + exec("(cd /etc/metronome/certs && make localhost.key)"); + exec("(cd /etc/metronome/certs && make localhost.csr)"); + exec("(cd /etc/metronome/certs && make localhost.cert)"); + exec('chmod 0400 /etc/metronome/certs/localhost.key'); + exec('chown metronome /etc/metronome/certs/localhost.key'); + }else{ + echo "-----\n"; + echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n"; + echo "# (cd /etc/metronome/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown metronome localhost.key)\n"; + echo "-----\n"; + } + + // Copy init script + caselog('cp -f apps/metronome-init /etc/init.d/metronome', __FILE__, __LINE__); + caselog('chmod u+x /etc/init.d/metronome', __FILE__, __LINE__); + caselog('update-rc.d metronome defaults', __FILE__, __LINE__); + + exec($this->getinitcommand('xmpp', 'restart')); + +/* +writing new private key to 'smtpd.key' +----- +You are about to be asked to enter information that will be incorporated +into your certificate request. +What you are about to enter is what is called a Distinguished Name or a DN. +There are quite a few fields but you can leave some blank +For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [AU]: +State or Province Name (full name) [Some-State]: +Locality Name (eg, city) []: +Organization Name (eg, company) [Internet Widgits Pty Ltd]: +Organizational Unit Name (eg, section) []: +Common Name (e.g. server FQDN or YOUR name) []: +Email Address []: + * */ + + /*// Dont just copy over the virtualhost template but add some custom settings + $tpl = new tpl('apache_apps.vhost.master'); + + $tpl->setVar('apps_vhost_port',$conf['web']['apps_vhost_port']); + $tpl->setVar('apps_vhost_dir',$conf['web']['website_basedir'].'/apps'); + $tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']); + $tpl->setVar('apps_vhost_servername',$apps_vhost_servername); + $tpl->setVar('apache_version',getapacheversion()); + + + // comment out the listen directive if port is 80 or 443 + if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) { + $tpl->setVar('vhost_port_listen','#'); + } else { + $tpl->setVar('vhost_port_listen',''); + } + + wf($vhost_conf_dir.'/apps.vhost', $tpl->grab()); + unset($tpl);*/ + } + public function configure_apache() { global $conf; @@ -1969,8 +2089,9 @@ class installer_base { $vserver_server_enabled = ($conf['openvz']['installed'])?1:0; $proxy_server_enabled = ($conf['services']['proxy'])?1:0; $firewall_server_enabled = ($conf['services']['firewall'])?1:0; + $xmpp_server_enabled = ($conf['services']['xmpp'])?1:0; - $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled' WHERE server_id = ".intval($conf['server_id']); + $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled', xmpp_server = '.$xmpp_server_enabled.' WHERE server_id = ".intval($conf['server_id']); if($conf['mysql']['master_slave_setup'] == 'y') { $this->dbmaster->query($sql); diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index a05084ee4a7ee9852d628dcfa17edf79aa958ac1..6eea12b71af63f848737554fd43b8626140b8c48 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -40,3 +40,97 @@ ALTER TABLE `mail_user` ADD `greylisting` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' ALTER TABLE `mail_forwarding` ADD `greylisting` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' AFTER `active`; ALTER TABLE `openvz_ip` CHANGE `ip_address` `ip_address` VARCHAR(39) DEFAULT NULL; + +-- XMPP Support + +ALTER TABLE `server` ADD COLUMN `xmpp_server` tinyint(1) NOT NULL default '0' AFTER `firewall_server`; + +ALTER TABLE `client` + ADD COLUMN `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + ADD COLUMN `xmpp_servers` blob, + ADD COLUMN `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', + ADD COLUMN `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', + ADD COLUMN `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_auth_options` varchar(255) NOT NULL DEFAULT 'plain,hashed,isp', + ADD COLUMN `limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n', + ADD COLUMN `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n'; + + +CREATE TABLE `xmpp_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + + `management_method` ENUM( 'normal', 'maildomain' ) NOT NULL default 'normal', + `public_registration` ENUM( 'n', 'y' ) NOT NULL default 'n', + `registration_url` varchar(255) NOT NULL DEFAULT '', + `registration_message` varchar(255) NOT NULL DEFAULT '', + `domain_admins` text, + + `use_pubsub` enum('n','y') NOT NULL DEFAULT 'n', + `use_proxy` enum('n','y') NOT NULL DEFAULT 'n', + `use_anon_host` enum('n','y') NOT NULL DEFAULT 'n', + + `use_vjud` enum('n','y') NOT NULL DEFAULT 'n', + `vjud_opt_mode` enum('in', 'out') NOT NULL DEFAULT 'in', + + `use_muc_host` enum('n','y') NOT NULL DEFAULT 'n', + `muc_name` varchar(30) NOT NULL DEFAULT '' + `muc_restrict_room_creation` enum('n', 'y', 'm') NOT NULL DEFAULT 'm', + `muc_admins` text, + `use_pastebin` enum('n','y') NOT NULL DEFAULT 'n', + `pastebin_expire_after` int(3) NOT NULL DEFAULT 48, + `pastebin_trigger` varchar(10) NOT NULL DEFAULT '!paste', + `use_http_archive` enum('n','y') NOT NULL DEFAULT 'n', + `http_archive_show_join` enum('n', 'y') NOT NULL DEFAULT 'n', + `http_archive_show_status` enum('n', 'y') NOT NULL DEFAULT 'n', + `use_status_host` enum('n','y') NOT NULL DEFAULT 'n', + + `ssl_state` varchar(255) NULL, + `ssl_locality` varchar(255) NULL, + `ssl_organisation` varchar(255) NULL, + `ssl_organisation_unit` varchar(255) NULL, + `ssl_country` varchar(255) NULL, + `ssl_email` varchar(255) NULL, + `ssl_request` mediumtext NULL, + `ssl_cert` mediumtext NULL, + `ssl_bundle` mediumtext NULL, + `ssl_key` mediumtext NULL, + `ssl_action` varchar(16) NULL, + + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`), + KEY `domain_active` (`domain`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Table structure for table `xmpp_user` +-- + +CREATE TABLE `xmpp_user` ( + `xmppuser_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `jid` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL default '', + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`xmppuser_id`), + KEY `server_id` (`server_id`,`jid`), + KEY `jid_active` (`jid`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 9060f36c1483eea20fc6150f6b7f2de91c37fba8..571d59d5fc0f6adeff60f59a3621075bf0cbc637 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -184,6 +184,18 @@ CREATE TABLE `client` ( `limit_spamfilter_wblist` int(11) NOT NULL DEFAULT '0', `limit_spamfilter_user` int(11) NOT NULL DEFAULT '0', `limit_spamfilter_policy` int(11) NOT NULL DEFAULT '0', + `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + `xmpp_servers` blob, + `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_auth_options` varchar(255) NOT NULL DEFAULT 'plain,hashed,isp', + `limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n', `default_webserver` int(11) unsigned NOT NULL DEFAULT '1', `web_servers` blob, `limit_web_ip` text, @@ -1201,6 +1213,7 @@ CREATE TABLE `server` ( `vserver_server` tinyint(1) NOT NULL default '0', `proxy_server` tinyint(1) NOT NULL default '0', `firewall_server` tinyint(1) NOT NULL default '0', + `xmpp_server` tinyint(1) NOT NULL default '0', `config` text, `updated` bigint(20) unsigned NOT NULL default '0', `mirror_server_id` int(11) unsigned NOT NULL default '0', @@ -1950,6 +1963,89 @@ CREATE TABLE `web_traffic` ( PRIMARY KEY (`hostname`,`traffic_date`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; +-- -------------------------------------------------------- + +-- +-- Table structure for table `xmpp_domain` +-- + +CREATE TABLE `xmpp_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + + `management_method` ENUM( 'normal', 'maildomain' ) NOT NULL default 'normal', + `public_registration` ENUM( 'n', 'y' ) NOT NULL default 'n', + `registration_url` varchar(255) NOT NULL DEFAULT '', + `registration_message` varchar(255) NOT NULL DEFAULT '', + `domain_admins` text, + + `use_pubsub` enum('n','y') NOT NULL DEFAULT 'n', + `use_proxy` enum('n','y') NOT NULL DEFAULT 'n', + `use_anon_host` enum('n','y') NOT NULL DEFAULT 'n', + + `use_vjud` enum('n','y') NOT NULL DEFAULT 'n', + `vjud_opt_mode` enum('in', 'out') NOT NULL DEFAULT 'in', + + `use_muc_host` enum('n','y') NOT NULL DEFAULT 'n', + `muc_name` varchar(30) NOT NULL DEFAULT '', + `muc_restrict_room_creation` enum('n', 'y', 'm') NOT NULL DEFAULT 'm', + `muc_admins` text, + `use_pastebin` enum('n','y') NOT NULL DEFAULT 'n', + `pastebin_expire_after` int(3) NOT NULL DEFAULT 48, + `pastebin_trigger` varchar(10) NOT NULL DEFAULT '!paste', + `use_http_archive` enum('n','y') NOT NULL DEFAULT 'n', + `http_archive_show_join` enum('n', 'y') NOT NULL DEFAULT 'n', + `http_archive_show_status` enum('n', 'y') NOT NULL DEFAULT 'n', + `use_status_host` enum('n','y') NOT NULL DEFAULT 'n', + + `ssl_state` varchar(255) NULL, + `ssl_locality` varchar(255) NULL, + `ssl_organisation` varchar(255) NULL, + `ssl_organisation_unit` varchar(255) NULL, + `ssl_country` varchar(255) NULL, + `ssl_email` varchar(255) NULL, + `ssl_request` mediumtext NULL, + `ssl_cert` mediumtext NULL, + `ssl_bundle` mediumtext NULL, + `ssl_key` mediumtext NULL, + `ssl_action` varchar(16) NULL, + + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`), + KEY `domain_active` (`domain`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `xmpp_user` +-- + +CREATE TABLE `xmpp_user` ( + `xmppuser_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `jid` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL default '', + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`xmppuser_id`), + KEY `server_id` (`server_id`,`jid`), + KEY `jid_active` (`jid`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + -- -------------------------------------------------------- -- -------------------------------------------------------- -- DB-DATA diff --git a/install/tpl/metronome_conf_global.master b/install/tpl/metronome_conf_global.master new file mode 100644 index 0000000000000000000000000000000000000000..68f4c59b6b34badb6abb216eccbbbd053ac897f0 --- /dev/null +++ b/install/tpl/metronome_conf_global.master @@ -0,0 +1,65 @@ +pidfile = "/var/run/metronome/metronome.pid"; +metronome_max_files_soft = 200000; +metronome_max_files_hard = 300000; +plugin_paths = { + "/usr/lib/metronome/isp-modules", +}; +use_libevent = true; +log = { + debug = "/var/log/metronome/metronome.dbg", + info = "/var/log/metronome/metronome.log", + error = "/var/log/metronome/metronome.err", +}; +use_ipv6 = true; +http_ports = { + 5290, +}; +https_ports = { + 5291, +}; +pastebin_ports = { + 5292, +}; +bosh_ports = { + 5280, +}; +admins = { + {tmpl_var xmpp_admins} +}; +modules_enabled = { + "saslauth", + "tls", + "dialback", + "disco", + "discoitems", + "version", + "uptime", + "time", + "ping", + "admin_adhoc", + "admin_telnet", + "bosh", + "posix", + "announce", + "offline", + "webpresence", + "mam", + "stream_management", + "message_carbons" +}; +modules_disabled = { +}; +bosh_max_inactivity = 30; +consider_bosh_secure = true; +cross_domain_bosh = true; +allow_registration = false; +ssl = { + key = "/etc/metronome/certs/localhost.key", + certificate = "/etc/metronome/certs/localhost.cert", +}; +c2s_require_encryption = false; +s2s_secure = true; +s2s_insecure_domains = { + "gmail.com", +}; +authentication = "internal_plain"; diff --git a/install/tpl/metronome_conf_main.master b/install/tpl/metronome_conf_main.master new file mode 100644 index 0000000000000000000000000000000000000000..f9c8fbdd655f0771c277df692916f5e1ba78cf5e --- /dev/null +++ b/install/tpl/metronome_conf_main.master @@ -0,0 +1,3 @@ +Include "/etc/metronome/global.cfg.lua" +Include "/etc/metronome/hosts/*.lua" +Include "/etc/metronome/status/*.lua" diff --git a/install/tpl/metronome_conf_ssl.master b/install/tpl/metronome_conf_ssl.master new file mode 100644 index 0000000000000000000000000000000000000000..922dfd22a1ab6c4f726fcc4b0eb84cdd60f73ec4 --- /dev/null +++ b/install/tpl/metronome_conf_ssl.master @@ -0,0 +1,48 @@ +oid_section = new_oids + +[ new_oids ] + +# RFC 3920 section 5.1.1 defines this OID +xmppAddr = 1.3.6.1.5.5.7.8.5 + +# RFC 4985 defines this OID +SRVName = 1.3.6.1.5.5.7.8.7 + +[ req ] + +default_bits = 4096 +default_keyfile = {tmpl_var name='domain'}.key +distinguished_name = distinguished_name +req_extensions = v3_extensions +x509_extensions = v3_extensions + +# ask about the DN? +prompt = no + +[ distinguished_name ] + +commonName = {tmpl_var name='domain'} +countryName = {tmpl_var name='ssl_country'} +localityName = {tmpl_var name='ssl_locality'} +organizationName = {tmpl_var name='ssl_organisation'} +organizationalUnitName = {tmpl_var name='ssl_organisation_unit'} +emailAddress = {tmpl_var name='ssl_email'} + +[ v3_extensions ] + +# for certificate requests (req_extensions) +# and self-signed certificates (x509_extensions) + +basicConstraints = CA:FALSE +keyUsage = digitalSignature,keyEncipherment +extendedKeyUsage = serverAuth,clientAuth +subjectAltName = @subject_alternative_name + +[ subject_alternative_name ] + +# See http://tools.ietf.org/html/draft-ietf-xmpp-3920bis#section-13.7.1.2 for more info. + +DNS.0 = {tmpl_var name='domain'} +otherName.0 = xmppAddr;FORMAT:UTF8,UTF8:{tmpl_var name='domain'} +otherName.1 = SRVName;IA5STRING:_xmpp-client.{tmpl_var name='domain'} +otherName.2 = SRVName;IA5STRING:_xmpp-server.{tmpl_var name='domain'} \ No newline at end of file diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 7805988a71d758a294c246daddbc4a119288b5a2..20dca2d42faaf5342aad8812d8e22333022d0dc5 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -145,3 +145,12 @@ do_not_try_rescue_httpd=n do_not_try_rescue_mysql=n do_not_try_rescue_mail=n +[xmpp] +xmpp_use_ispv6=n +xmpp_bosh_max_inactivity=30 +xmpp_server_admins=admin@service.com, superuser@service.com +xmpp_modules_enabled=saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons +xmpp_port_http=5290 +xmpp_port_https=5291 +xmpp_port_pastebin=5292 +xmpp_port_bosh=5280 diff --git a/install/update.php b/install/update.php index 311c070dfc8d1f7ecafc60564893eb3ce888270c..8e05318ae126f60557aca7830f7b5ae315efac48 100644 --- a/install/update.php +++ b/install/update.php @@ -392,6 +392,11 @@ if($reconfigure_services_answer == 'yes') { $inst->configure_apps_vhost(); } + if($conf['services']['xmpp']) { + //** Configure Metronome XMPP + $inst->configure_xmpp('dont-create-certs'); + } + //* Configure DBServer swriteln('Configuring Database'); @@ -494,6 +499,10 @@ if($reconfigure_services_answer == 'yes') { if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null'); } + if($conf['services']['xmpp']) { + if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null'); + } + if($conf['services']['proxy']) { // if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); diff --git a/interface/lib/classes/validate_client.inc.php b/interface/lib/classes/validate_client.inc.php index 198701bc4cde14f3dcca5a089e2e395f5e610e41..c67601bfb7d7c080bd5d9f15d086ab63e06d38dc 100644 --- a/interface/lib/classes/validate_client.inc.php +++ b/interface/lib/classes/validate_client.inc.php @@ -122,6 +122,10 @@ class validate_client { case 'mail_servers': $used_servers = $app->db->queryAllRecords('SELECT domain_id FROM mail_domain INNER JOIN sys_user ON mail_domain.sys_userid = sys_user.userid WHERE client_id = ' . $client_id . ' AND server_id NOT IN (' . implode(', ', $field_value) . ');'); break; + + case 'xmpp_servers': + $used_servers = $app->db->queryAllRecords('SELECT domain_id FROM xmpp_domain INNER JOIN sys_user ON xmpp_domain.sys_userid = sys_user.userid WHERE client_id = ' . $client_id . ' AND server_id NOT IN (' . implode(', ', $field_value) . ');'); + break; } if ($used_servers === null || count($used_servers)) diff --git a/interface/web/admin/form/server.tform.php b/interface/web/admin/form/server.tform.php index a2eac6c3b758e5e6ffe1c993f167d3104fd2be05..1bf079e1b0bb08791cdddb7f70b9797e5720e504 100644 --- a/interface/web/admin/form/server.tform.php +++ b/interface/web/admin/form/server.tform.php @@ -102,6 +102,12 @@ $form["tabs"]['services'] = array ( 'default' => '0', 'value' => array(0 => 0, 1 => 1) ), + 'xmpp_server' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'CHECKBOX', + 'default' => '0', + 'value' => array(0 => 0, 1 => 1) + ), 'mirror_server_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 6f1c889bb5a510d2a25b6f4b567c6a70e0137ecd..351d4de86c32d00f6055f9c5435fe67f51b10ede 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -1318,6 +1318,86 @@ $form["tabs"]['fastcgi'] = array( ); +$form["tabs"]['xmpp'] = array( + 'title' => "XMPP", + 'width' => 80, + 'template' => "templates/server_config_xmpp_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'xmpp_use_ipv6' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'xmpp_bosh_max_inactivity' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '30', + 'validators' => array(0 => array('type' => 'ISINT', + 'errmsg' => 'ip_address_error_wrong'), + array('type'=>'RANGE', 'range'=>'15:360', 'errmsg' => 'xmpp_bosh_timeout_range_wrong') + ), + 'value' => '', + 'width' => '15' + ), + + 'xmpp_server_admins' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'admin@service.com, superuser@service.com', + 'value' => '', + 'width' => '15' + ), + + 'xmpp_modules_enabled' => array( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'default' => "saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons", + 'value' => '', + 'separator' => "," + ), + + 'xmpp_port_http' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5290', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5290', + 'width' => '15' + ), + 'xmpp_port_https' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5291', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5291', + 'width' => '15' + ), + 'xmpp_port_pastebin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5292', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5292', + 'width' => '15' + ), + 'xmpp_port_bosh' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5280', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5280', + 'width' => '15' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + $form["tabs"]['jailkit'] = array( 'title' => "Jailkit", 'width' => 80, diff --git a/interface/web/admin/lib/lang/en_server.lng b/interface/web/admin/lib/lang/en_server.lng index 4130201b7ce0ce0b45e11a4657dfe8ed3d65b649..1f36bc718ef1402b752c9f0d9326ae68cb35fb60 100644 --- a/interface/web/admin/lib/lang/en_server.lng +++ b/interface/web/admin/lib/lang/en_server.lng @@ -12,4 +12,6 @@ $wb["firewall_server_txt"] = 'Firewall-Server'; $wb["active_txt"] = 'Active'; $wb["mirror_server_id_txt"] = 'Is mirror of Server'; $wb["- None -"] = '- None -'; +// New for XMPP +$wb['xmpp_server_txt'] = 'XMPP Server'; ?> \ No newline at end of file diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index 8affba0c14e111dfefa7123131b3ea413569f1c0..aac73906595b5517d269726f8454d6bd99ad0a83 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -264,4 +264,18 @@ $wb['php_ini_check_minutes_txt'] = 'Check php.ini every X minutes for changes'; $wb['php_ini_check_minutes_error_empty'] = 'Please specify a value how often php.ini should be checked for changes.'; $wb['php_ini_check_minutes_info_txt'] = '0 = no check'; $wb['enable_spdy_txt'] = 'Makes SPDY available'; + +// New for XMPP +$wb['xmpp_server_txt'] = 'XMPP Server'; +$wb['xmpp_use_ipv6_txt'] = 'Use IPv6'; +$wb['xmpp_bosh_max_inactivity_txt'] = 'Max. BOSH inactivity time'; +$wb['xmpp_bosh_timeout_range_wrong'] = 'Please enter a bosh timeout range between 15 - 360'; +$wb['xmpp_module_saslauth'] = 'saslauth'; +$wb['xmpp_server_admins_txt'] = 'Server Admins (JIDs)'; +$wb['xmpp_modules_enabled_txt'] = 'Serverwide enabled plugins (one per line)'; +$wb['xmpp_ports_txt'] = 'Component ports'; +$wb['xmpp_port_http_txt'] = 'HTTP'; +$wb['xmpp_port_https_txt'] = 'HTTPS'; +$wb['xmpp_port_pastebin_txt'] = 'Pastebin'; +$wb['xmpp_port_bosh_txt'] = 'BOSH'; ?> diff --git a/interface/web/admin/lib/lang/en_server_list.lng b/interface/web/admin/lib/lang/en_server_list.lng index 164468e700bb699c24e823da7f3626e58d5257ed..89a81fa43b06af831857246ace6ed47bd1460b06 100644 --- a/interface/web/admin/lib/lang/en_server_list.lng +++ b/interface/web/admin/lib/lang/en_server_list.lng @@ -10,4 +10,6 @@ $wb["vserver_server_txt"] = 'VServer'; $wb["proxy_server_txt"] = 'Proxy'; $wb["firewall_server_txt"] = 'Firewall'; $wb["add_new_record_txt"] = 'Add new Server'; +// New for XMPP +$wb['xmpp_server_txt'] = 'XMPP'; ?> \ No newline at end of file diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php index 0309b7a3c1a60c69ad152ff884a925743ac8bbe9..0290632405d948c77cdcb90eb741fa4617df2458 100644 --- a/interface/web/admin/list/server.list.php +++ b/interface/web/admin/list/server.list.php @@ -110,4 +110,13 @@ $liste['item'][] = array( 'field' => 'vserver_server', 'width' => '', 'value' => array('1' => "