diff --git a/roles/collab/defaults/main.yml b/roles/collab/defaults/main.yml new file mode 100644 index 0000000..7def486 --- /dev/null +++ b/roles/collab/defaults/main.yml @@ -0,0 +1,3 @@ +--- +moin_version: 1.9.8 +tmpfs_context: system_u:object_r:httpd_sys_rw_content_t:s0 diff --git a/roles/collab/files/collab-htaccess b/roles/collab/files/collab-htaccess new file mode 100644 index 0000000..59d7105 --- /dev/null +++ b/roles/collab/files/collab-htaccess @@ -0,0 +1,15 @@ +htaccess < +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ wsgi/$1 [QSA,PT,L] + + + SetHandler wsgi-script + + +AuthType Basic +AuthName "Password Required (cancel for help)" +AuthUserFile /srv/wikis/collab/run/.htpasswd +AuthGroupFile /srv/wikis/collab/run/.htgroup + +Require valid-user diff --git a/roles/collab/files/collab-init.sh b/roles/collab/files/collab-init.sh new file mode 100644 index 0000000..b5282ff --- /dev/null +++ b/roles/collab/files/collab-init.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +if ! test -e /srv/wikis/collab/log/moinmoin.log; then + install -m 0660 -o collab -g collab /dev/null /srv/wikis/collab/log/moinmoin.log +fi + +if ! test -d /srv/wikis/collab/underlay/pages; then + cp -R /usr/share/moin/underlay/pages /srv/wikis/collab/underlay + chmod -R g=u,o-rwx /srv/wikis/collab/underlay/pages + chown -R collab:collab /srv/wikis/collab/underlay/pages +fi + +if ! test -d /srv/wikis/collab/wikis/collab; then + su -s /bin/sh - collab -c "collab-create collab collab && collab-account-create -f -r collab" + su -s /bin/sh - collab -c "env PYTHONPATH=/srv/wikis/collab/wikis/collab/config python -m MoinMoin.packages -u collab i /srv/wikis/collab/underlay/pages/LanguageSetup/attachments/English--all_pages.zip" + su -s /bin/sh - collab -c "env PYTHONPATH=/srv/wikis/collab/wikis/collab/config python -m MoinMoin.packages -u collab i /var/lib/collab/CollabBase.zip" + su -s /bin/sh - collab -c "gwiki-rehash /srv/wikis/collab/wikis/collab" +fi diff --git a/roles/collab/files/collab.ini b/roles/collab/files/collab.ini new file mode 100644 index 0000000..6710f41 --- /dev/null +++ b/roles/collab/files/collab.ini @@ -0,0 +1,19 @@ +[collab] +logconf=/srv/wikis/collab/config/logging.conf +## directory also in per instance configs +farmconf=/srv/wikis/collab/config/collabfarm.py +## also in /.htaccess +htpasswd=/srv/wikis/collab/run/.htpasswd +htgroup=/srv/wikis/collab/run/.htgroup +## also in collabfarm.py +htmldir=/srv/wikis/collab/htdocs +userdir=/srv/wikis/collab/user +cachedir=/srv/wikis/collab/cache +wikidir=/srv/wikis/collab/wikis +## only here +baseinstancedir=/srv/wikis/collab/wikis/collab +archivedir=/srv/wikis/collab/archive +piddir=/srv/wikis/collab/run +helperuser=collab +## for collab-auth-ejabberd +cacherefreshtime=30 diff --git a/roles/collab/files/moin-1.9.8.patch b/roles/collab/files/moin-1.9.8.patch new file mode 100644 index 0000000..c607fdf --- /dev/null +++ b/roles/collab/files/moin-1.9.8.patch @@ -0,0 +1,1165 @@ +--- ./MoinMoin/auth/__init__.py.orig 2014-10-17 22:45:32.000000000 +0300 ++++ ./MoinMoin/auth/__init__.py 2014-10-20 11:53:32.869284981 +0300 +@@ -371,7 +371,7 @@ + auth_username = self.transform_username(auth_username) + logging.debug("auth_username (after decode/transform) = %r" % auth_username) + u = user.User(request, auth_username=auth_username, +- auth_method=self.name, auth_attribs=('name', 'password')) ++ auth_method=self.name, auth_attribs=('name')) + + logging.debug("u: %r" % u) + if u and self.autocreate: +--- ./MoinMoin/config/__init__.py.orig 2014-10-17 22:45:32.000000000 +0300 ++++ ./MoinMoin/config/__init__.py 2015-12-06 11:57:48.923411442 +0200 +@@ -25,7 +25,7 @@ umask = 0770 + # list of acceptable password hashing schemes for cfg.password_scheme, + # here we only give reasonably good schemes, which is passlib (if we + # have passlib) and ssha (if we only have builtin stuff): +-password_schemes_configurable = ['{PASSLIB}', '{SSHA}', ] ++password_schemes_configurable = ['{PASSLIB}', '{SSHA}', '{SHA}' ] + + # ordered list of supported password hashing schemes, best (passlib) should be + # first, best builtin one should be second. this is what we support if we +@@ -58,6 +58,9 @@ page_invalid_chars_regex = re.compile( + ur""" + \u0000 | # NULL + ++ \# | # http://tools.ietf.org/html/rfc3986#section-3.3 ++ \? | ++ + # Bidi control characters + \u202A | # LRE + \u202B | # RLE +--- ./MoinMoin/formatter/__init__.py.orig 2014-11-03 20:24:17.000000000 +0200 ++++ ./MoinMoin/formatter/__init__.py 2014-11-07 17:05:23.360806970 +0200 +@@ -135,7 +135,10 @@ class FormatterBase: + # Try to decode text. It might return junk, but we don't + # have enough information with attachments. + content = wikiutil.decodeUnknownInput(content) +- colorizer = Parser(content, self.request, filename=filename) ++ if '.csv' in getattr(Parser, 'extensions', list()): ++ colorizer = Parser(content, self.request, filename=filename, format_args=kw.get('format_args', '')) ++ else: ++ colorizer = Parser(content, self.request, filename=filename) + colorizer.format(self) + except IOError: + pass + +--- ./MoinMoin/formatter/text_html.py.orig 2014-10-17 22:45:32.000000000 +0300 ++++ ./MoinMoin/formatter/text_html.py 2015-08-20 12:16:01.940528662 +0300 +@@ -6,12 +6,14 @@ + @license: GNU GPL, see COPYING for details. + """ + import os.path, re ++import urllib ++import urlparse + + from MoinMoin import log + logging = log.getLogger(__name__) + + from MoinMoin.formatter import FormatterBase +-from MoinMoin import wikiutil, i18n ++from MoinMoin import wikiutil, i18n, config + from MoinMoin.Page import Page + from MoinMoin.action import AttachFile + from MoinMoin.support.python_compatibility import set +@@ -474,16 +476,17 @@ class Formatter(FormatterBase): + del kw['generated'] + if page is None: + page = Page(self.request, pagename, formatter=self) +- if self.request.user.show_nonexist_qm and on and not page.exists(): +- self.pagelink_preclosed = True +- return (page.link_to(self.request, on=1, **kw) + +- self.text("?") + +- page.link_to(self.request, on=0, **kw)) ++ if on and not page.exists(): ++ kw['css_class'] = 'nonexistent' ++ if self.request.user.show_nonexist_qm: ++ self.pagelink_preclosed = True ++ return (page.link_to(self.request, on=1, **kw) + ++ self.text("?") + ++ page.link_to(self.request, on=0, **kw)) + elif not on and self.pagelink_preclosed: + self.pagelink_preclosed = False + return "" +- else: +- return page.link_to(self.request, on=on, **kw) ++ return page.link_to(self.request, on=on, **kw) + + def interwikilink(self, on, interwiki='', pagename='', **kw): + """ +@@ -534,12 +537,25 @@ class Formatter(FormatterBase): + logging.warning("Deprecation warning: MoinMoin.formatter.text_html.url being called with do_escape=1/True parameter, please review caller.") + else: + logging.warning("Deprecation warning: MoinMoin.formatter.text_html.url being called with do_escape=0/False parameter, please remove it from the caller.") ++ ++ def quote_urlparts(url): ++ """ ++ hrefs should be quoted as per RFC3986. ++ """ ++ urlp = list(urlparse.urlparse(url)) ++ for part in (2, 4): ++ if isinstance(urlp[part], unicode): ++ urlp[part] = urlp[part].encode(config.charset) ++ urlp[2] = urllib.quote(urlp[2]) ++ urlp[4] = urllib.urlencode(urlparse.parse_qs(urlp[4]), doseq=1) ++ return urlparse.urlunparse(urlp) ++ + if on: + attrs = self._langAttr() + + # Handle the URL mapping + if url is None and 'href' in kw: +- url = kw['href'] ++ url = quote_urlparts(kw['href']) + del kw['href'] + if url is not None: + url = wikiutil.mapURL(self.request, url) +--- MoinMoin/macro/Include.py.orig 2014-10-17 22:45:33.000000000 +0300 ++++ MoinMoin/macro/Include.py 2016-01-26 12:46:30.000000000 +0200 +@@ -1,31 +1,37 @@ +-# -*- coding: iso-8859-1 -*- ++# -*- coding: utf-8 -*- + """ +- MoinMoin - Include macro ++ Include macro for MoinMoin/GraphingWiki + +- This macro includes the formatted content of the given page(s). See ++ Partial rewrite of orginal Include macro. + +- http://purl.net/wiki/moinmaster/HelpOnMacros/Include +- +- for detailed docs. ++ New features: ++ * Including nonexisting pages with an editlink ++ * Specifying a template for editing, eg. ++ <> ++ * Specifying a revision for included pages, eg. ++ <> + + @copyright: 2000-2004 Juergen Hermann , +- 2000-2001 Richard Jones ++ 2000-2001 Richard Jones , ++ 2009-2011 Juhani Eronen , ++ 2015-2016 Mika Seppänen + @license: GNU GPL, see COPYING for details. + """ + +-#Dependencies = ["pages"] # included page +-Dependencies = ["time"] # works around MoinMoinBugs/TableOfContentsLacksLinks ++Dependencies = ["time"] # works around MoinMoinBugs/TableOfContentsLacksLinks + + generates_headings = True + +-import re, StringIO ++import re ++import StringIO ++ + from MoinMoin import wikiutil + from MoinMoin.Page import Page + ++from graphingwiki import actionname, id_escape, SEPARATOR ++from graphingwiki.util import render_error, render_warning ++from graphingwiki.util import form_writer as wr + +-_sysmsg = '

%s

' +- +-## keep in sync with TableOfContents macro! + _arg_heading = r'(?P,)\s*(|(?P[\'"])(?P.+?)(?P=hquote))' + _arg_level = r',\s*(?P\d*)' + _arg_from = r'(,\s*from=(?P[\'"])(?P.+?)(?P=fquote))?' +@@ -35,23 +41,27 @@ + _arg_skipitems = r'(,\s*skipitems=(?P\d+))?' + _arg_titlesonly = r'(,\s*(?Ptitlesonly))?' + _arg_editlink = r'(,\s*(?Peditlink))?' +-_args_re_pattern = r'^(?P[^,]+)(%s(%s)?%s%s%s%s%s%s%s)?$' % ( ++_arg_rev = r'(,\s*rev=(?P\d+))?' ++_arg_template = r'(,\s*template=(?P[\'"])(?P