Example #1
0
    def configure(self):
        self += User('peerjs')

        self += Download(
            self.url.format(version=self.version), checksum=self.checksum)
        self += Extract(
            self._.target, target='/srv/peerjs', strip=1,
            owner='peerjs', group='peerjs')

        self += Patch(
            '/srv/peerjs/lib/server.js',
            file='ws-3.0.patch', target='wosc patched')

        self += File('/srv/peerjs/package.json', is_template=False)
        self += File('/srv/peerjs/package-lock.json', is_template=False)
        self.packages = self._

        self += File('/srv/peerjs/serve.js', is_template=False,
                     owner='peerjs', group='peerjs')
        self += PHP(
            'peerjs',
            command='node serve.js',
            user='******',
            directory='/srv/peerjs',
            dependencies=[self])

        self += File('/srv/peerjs/nginx.conf', is_template=False)
        self += VHost(self._)
Example #2
0
    def configure(self):
        for name in self.packages:
            self += Package(name)

        self += ServiceDatabase('wallabag', password=self.db_password)
        self += Schema()
        self += AdminUser(password=self.ui_password)

        self += User('wallabag')

        self += Download(self.url.format(version=self.version),
                         checksum=self.checksum)
        self += Extract(self._.target,
                        target='/srv/wallabag',
                        strip=1,
                        owner='wallabag',
                        group='wallabag')

        self += Patch('/srv/wallabag/app/config/routing.yml',
                      file='backup-api.patch',
                      target='backup')

        self += File('/srv/wallabag/app/config/parameters.yml',
                     owner='wallabag',
                     group='wallabag',
                     mode=0o640)

        self += PHP('wallabag', user='******', environ='SYMFONY_ENV=prod')

        self += File('/srv/wallabag/nginx.conf', is_template=False)
        self += VHost(self._)
Example #3
0
 def configure(self):
     self += Package('php%s' % self.version)
     self += Package('php%s-cgi' % self.version)
     # Send php errors to nginx log.
     self += Patch('/etc/php/%s/cgi/php.ini' % self.version,
                   source=';error_log = php_errors.log',
                   target='error_log = /dev/stderr')
Example #4
0
    def configure(self):
        self += Package('imapproxy')
        self += Patch('/etc/imapproxy.conf',
                      source='#listen_address 127.0.0.1',
                      target='listen_address 127.0.0.1',
                      check_source_removed=True)
        self += Service('imapproxy', action='restart', deps=self._)

        self += User('roundcube')

        self += Download(self.url.format(version=self.version),
                         checksum=self.checksum)
        self += Extract(self._.target,
                        target='/srv/roundcube',
                        strip=1,
                        owner='roundcube',
                        group='roundcube')
        self += Delete('/srv/roundcube/installer')

        self += File('/srv/roundcube/config/config.inc.php',
                     source='config.php',
                     owner='roundcube',
                     group='roundcube',
                     mode=0o640)

        self += Download(
            'https://github.com/marneu/login_info/archive/'
            'b4e8a299a3f10b5e81a753a84cc9fe51015b0035.zip',
            checksum=
            'sha256:3e90853e991dfb7e8ec1814f716ebf031633859a6c522e9281a1381b310b45e6'
        )
        self += Extract(self._.target, owner='roundcube', group='roundcube')
        # Poor man's strip for zip, idea taken from
        # <https://github.com/chef-cookbooks/ark/blob/e8c03f6/
        #   libraries/unzip_command_builder.rb#L34>
        self += SyncDirectory('/srv/roundcube/plugins/login_info',
                              source=self._.target + '/*',
                              sync_opts='-a')

        self += ServiceDatabase('roundcube',
                                password=self.db_password,
                                schema='/srv/roundcube/SQL/mysql.initial.sql')

        self += PHP('roundcube',
                    params={
                        'upload_max_filesize': '30M',
                        'post_max_size': '30M'
                    },
                    user='******')

        self += File('/etc/nginx/sites-available/mail.wosc.de',
                     source='nginx.conf',
                     is_template=False)
        self += VHost(self._, site_enable=True)
Example #5
0
    def configure(self):
        self += User('letsencrypt')
        for user in self.daemons:
            self += GroupMember('letsencrypt', user=user)

        self += File('/srv/letsencrypt/public', ensure='directory',
                     owner='letsencrypt', group='letsencrypt')
        self += File('/srv/letsencrypt/data', ensure='directory',
                     owner='letsencrypt', group='letsencrypt', mode=0o770)

        self += VirtualEnv(path='/srv/letsencrypt/deployment')
        self._ += Requirements()

        self += Patch(
            '/srv/letsencrypt/deployment/lib/python%s/site-packages'
            '/simp_le.py' % VirtualEnv.version, target='wosc patched',
            file='logging.patch')

        self += File(
            '/etc/nginx/snippets/letsencrypt.conf',
            source='nginx.conf', is_template=False)

        self += File(
            '/etc/sudoers.d/letsencrypt',
            content='letsencrypt ALL=(root) NOPASSWD: /etc/init.d/nginx, /etc/init.d/exim4, /etc/init.d/courier-imap-ssl\n')

        self += File(
            '/srv/letsencrypt/update-letsencrypt', source='update.sh',
            is_template=False, mode=0o755)

        self += CronJob(
            '/srv/letsencrypt/update-letsencrypt',
            user='******',
            timing='15 2 * * *')

        for domain in self.domains:
            self += File(
                '/srv/letsencrypt/public/%s' % domain, ensure='directory',
                owner='letsencrypt', group='letsencrypt')
            self += File(
                '/srv/letsencrypt/data/%s' % domain, ensure='directory',
                owner='letsencrypt', group='letsencrypt')

            for item in self.files:
                if not os.path.exists('%s/data/%s.%s' % (
                        self.defdir, domain, item['source'])):
                    continue
                self += File(
                    '/srv/letsencrypt/data/%s/%s' % (domain, item['target']),
                    source='%s.%s' % (domain, item['source']),
                    is_template=False, mode=item['mode'],
                    owner='letsencrypt', group='letsencrypt')
Example #6
0
    def configure(self):
        self += Package('libssl-dev')
        self += Package('libcurl4-gnutls-dev')

        self += Download(
            self.url.format(version=self.version), checksum=self.checksum)
        src = self._.target.replace('.zip', '')
        self += Extract(self._.target, create_target_dir=False)

        self += Patch(
            src + '/esniper.c',
            source='#define MIN_BIDTIME 5',
            target='#define MIN_BIDTIME 2')
        self += Configure(src, prefix='/usr/local')
        self += Make(src)
Example #7
0
    def configure(self):
        self += User('radicale')
        self += File('/srv/radicale/data',
                     ensure='directory',
                     owner='radicale',
                     group='radicale')

        deps = []
        self += VirtualEnv(path='/srv/radicale/deployment')
        self._ += Requirements()
        deps.append(self._)

        courier_py = ('/srv/radicale/deployment/lib/python%s/site-packages'
                      '/radicale/auth/courier.py' % VirtualEnv.version)
        self += Patch(courier_py, source='"GID"', target='b"GID"')
        self += Patch(courier_py,
                      source='sock.send(line)',
                      target='sock.send(line.encode("utf-8")')

        # Allow access to authdaemon
        self += GroupMember('courier', user='******')

        for name in ['radicale.conf', 'logging.conf', 'serve.py']:
            self += File('/srv/radicale/%s' % name, is_template=False)
            deps.append(self._)

        self += Program(
            'radicale',
            command=
            '/srv/radicale/deployment/bin/python /srv/radicale/serve.py',
            environ='RADICALE_CONFIG=/srv/radicale/radicale.conf',
            user='******',
            dependencies=deps)

        self += File('/srv/radicale/nginx.conf', is_template=False)
        self += VHost(self._)
Example #8
0
    def configure(self):
        for name in self.packages:
            self += Package(name)

        self += SASchema(
            'sa_pref', db_name=self.db_name,
            command="sed -e 's/userpref/sa_pref/' "
            "-e 's/TYPE=MyISAM/ENGINE=InnoDB/' "
            "/usr/share/doc/spamassassin/sql/userpref_mysql.sql")
        self += SASchema(
            'bayes_vars', db_name=self.db_name,
            command='cat /usr/share/doc/spamassassin/sql/bayes_mysql.sql')
        # self += SASchema(
        #     'sa_txrep', db_name=self.db_name,
        #     command="sed -e 's/txrep/sa_txrep/' "
        #     "/usr/share/doc/spamassassin/sql/txrep_mysql.sql")

        deps = []
        self += File('/etc/spamassassin/local.cf', source='spam/local.conf')
        deps.append(self._)
        self += File('/etc/default/spamassassin', source='spam/default',
                     is_template=False)
        deps.append(self._)
        self += Patch(
            '/etc/spamassassin/v310.pre',
            source='#loadplugin Mail::SpamAssassin::Plugin::DCC',
            target='loadplugin Mail::SpamAssassin::Plugin::DCC',
            check_source_removed=True)
        deps.append(self._)
        self += Service('spamassassin', action='restart', deps=deps)

        self += File('/etc/spamassassin/pyzor', ensure='directory')
        self += File('/etc/spamassassin/pyzor/servers',
                     content='public.pyzor.org:24441')

        self += File(
            '/usr/lib/tmpfiles.d/spamassassin.conf',
            content='# Generated by batou\nd /run/spamassassin 0755 nobody nogroup')

        for name in ['clean', 'learn']:  # unused: awl
            self += File(
                '/etc/cron.daily/spam-%s' % name, mode=0o755,
                source='spam/%s.sh' % name, is_template=False)
Example #9
0
    def configure(self):
        self += Package('dailystrips')
        self += Patch(
            '/usr/bin/dailystrips',
            target='altpattern',
            file=self.defdir + '/dailystrips-altpattern.patch', strip=0)

        self += File(
            '/home/wosc/bin/dailycomics.sh', is_template=False, mode=0o755)
        self += CronJob(
            self._.path,
            user='******',
            timing='15 5 * * * ')

        self += File('/home/wosc/public_html/dailystrips', ensure='directory',
                     owner='wosc', group='wosc')
        self += BinaryFile(
            '/home/wosc/public_html/dailystrips/favicon.png',
            source='kevinandkell.png', owner='wosc', group='wosc')
        self += File(
            '/home/wosc/public_html/dailystrips/.htpasswd',
            content='wosc:' + crypt(self.ui_password, 'hX'),
            sensitive_data=True)