示例#1
0
def setup_vhost():
    '''Set up apache vhost'''
    with fs.mkstemp() as fp:
        dest = join('/etc/apache2/conf.d', 'zarafa-zsm.conf')

        content = get_vhost()
        open(fp, 'wt').write(content)

        fs.sh_copyfile(fp, dest, sudo=True)
        fs.sh_chmod(dest, 644, sudo=True)
示例#2
0
def setup_vhost():
    '''Set up apache vhost'''
    with fs.mkstemp() as fp:
        dest = join('/etc/apache2/conf.d', 'zarafa-zsm.conf')

        content = get_vhost()
        open(fp, 'wt').write(content)

        fs.sh_copyfile(fp, dest, sudo=True)
        fs.sh_chmod(dest, 644, sudo=True)
示例#3
0
    def compile_ldif_templates(self, destdir):
        content = []
        content.append(ldif.get_zarafa_schema())
        content.append(ldif.get_database())
        content.append(ldif.get_mod_memberof())
        content.append(ldif.get_overlay_memberof())
        content.append(ldif.get_mod_refint())
        content.append(ldif.get_overlay_refint())
        content = '\n\n'.join(content) + '\n'

        fp = join(destdir, 'ldap-config.ldif')
        open(fp, 'wt').write(content)

        content = []
        content.append(ldif.get_base_structure())
        content = '\n\n'.join(content) + '\n'

        fp = join(destdir, 'ldap-base-structure.ldif')
        open(fp, 'wt').write(content)

        conf_dir = join(self.repo_basedir, 'etc', 'ldap')
        fs.sh_copyfile(join(conf_dir, 'bootstrap-ldap.sh'),
                       join(destdir, 'bootstrap-ldap.sh'))
示例#4
0
    def compile_cfg_files(self, destdir):
        conf_dir = join(self.repo_basedir, 'etc', 'zarafa')

        name = 'zsm-remotesync.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'), join(destdir, name))

        name = 'remotesync_ad.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'), join(destdir, name))

        name = 'remotesync_ldap.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'), join(destdir, name))
示例#5
0
    def compile_cfg_files(self, etc_destdir, usr_share_destdir):
        conf_dir = join(self.repo_basedir, 'etc', 'zarafa')

        name = 'zsm-server.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'), join(etc_destdir, name))

        name = 'ldap.zsm.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'),
                       join(usr_share_destdir, name))

        name = 'ldapms.zsm.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'),
                       join(usr_share_destdir, name))
示例#6
0
    def compile_cfg_files(self, destdir):
        conf_dir = join(self.repo_basedir, 'etc', 'zarafa')

        name = 'zsm-client.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'),
                       join(destdir, name))
示例#7
0
    def compile_cfg_files(self, destdir):
        conf_dir = join(self.repo_basedir, 'etc', 'zarafa')

        name = 'zsm-client.cfg'
        fs.sh_copyfile(join(conf_dir, name + '.in'), join(destdir, name))
示例#8
0
def patch_config():
    zcpenv = ZcpEnv.get()

    ## Create fakeroot dir structure

    fs.sh_makedirs(join(zcpenv.fakeroot, 'etc', 'zarafa', 'license'))
    fs.sh_makedirs(join(zcpenv.fakeroot, 'etc', 'zarafa', 'ssl'))
    fs.sh_makedirs(join(zcpenv.fakeroot, 'etc', 'zarafa', 'sslkeys'))
    fs.sh_makedirs(join(zcpenv.fakeroot, 'var', 'run'))
    fs.sh_makedirs(join(zcpenv.fakeroot, 'var', 'log', 'zarafa'))

    ## Patch server.cfg

    filepath = join(zcpenv.conf_templates, 'server.cfg')
    fp = join(zcpenv.fakeroot, 'etc', 'zarafa', 'server.cfg')

    # 1) regex rewrites
    context = {
        '/etc/': join(zcpenv.fakeroot, 'etc/'),
        '/var/': join(zcpenv.fakeroot, 'var/'),
    }
    text.patch_file(context, filepath, dest=fp, literal=True)

    # 2) config patching
    context = env.zcp_server_cfg
    context.update({
        'local_admin_users': zcpenv.local_admin_users,
        'mysql_user': zcpenv.mysql_user,
        'mysql_password': zcpenv.mysql_password,
        'plugin_path': zcpenv.plugin_path,
        'user_plugin_config': zcpenv.user_plugin_config,

        # ssl settings
        'server_ssl_ca_file': zcpenv.server_ssl_ca_file,
        'server_ssl_key_file': zcpenv.server_ssl_key_file,
        'sslkeys_path': zcpenv.sslkeys_path,
    })
    text.patch_config_file(env.zcp_server_cfg, fp, dest=fp)

    ## Patch ldap.cfg

    filepath = join(zcpenv.conf_templates, 'ldapms.openldap.cfg')
    fp = join(zcpenv.fakeroot, 'etc', 'zarafa', 'ldap.cfg')

    # 1) regex rewrites
    context = {
        '/etc/': join(zcpenv.fakeroot, 'etc/'),
    }
    text.patch_file(context, filepath, dest=fp, literal=True)

    # 2) config patching
    text.patch_config_file(env.zcp_ldap_cfg, fp, dest=fp)

    ## Deploy ldap.propmap.cfg

    src = join(zcpenv.conf_templates, 'ldap.propmap.cfg')
    dest = join(zcpenv.fakeroot, 'etc', 'zarafa', 'ldap.propmap.cfg')
    fs.sh_copyfile(src, dest)

    ## Patch licensed.cfg

    filepath = join(zcpenv.conf_templates, 'licensed.cfg')
    fp = join(zcpenv.fakeroot, 'etc', 'zarafa', 'licensed.cfg')

    # regex rewrites
    context = {
        '/etc/': join(zcpenv.fakeroot, 'etc/'),
        '/var/': join(zcpenv.fakeroot, 'var/'),
    }
    text.patch_file(context, filepath, dest=fp, literal=True)

    ## Deploy license file

    src = join('etc', 'zarafa', 'license', 'base')
    dest = join(zcpenv.fakeroot, 'etc', 'zarafa', 'license', 'base')
    fs.sh_copyfile(src, dest)

    ## Deploy ssl config

    src = join('etc', 'zarafa', 'ssl')
    dest = join(zcpenv.fakeroot, 'etc', 'zarafa')
    fs.sh_rmtree(join(dest, 'ssl'))
    fs.sh_copytree(src, dest)

    src = join('etc', 'zarafa', 'sslkeys')
    dest = join(zcpenv.fakeroot, 'etc', 'zarafa')
    fs.sh_rmtree(join(dest, 'sslkeys'))
    fs.sh_copytree(src, dest)
示例#9
0
def setup_local_zcp():
    zcpenv = ZcpEnv.get()

    puts('Setting up MAPI_CONFIG_PATH')
    sys_mapi_config_path = '/etc/mapi'
    if fs.sh_dir_exists(sys_mapi_config_path):
        warn('{0} directory exists, cannot set up symlink'.format(
            sys_mapi_config_path))

    else:
        local_mapi_config_path = join(zcpenv.repo_basedir, 'provider',
                                      'client')
        fs.sh_ln(local_mapi_config_path, sys_mapi_config_path, sudo=True)

    puts('Setting up LD_LIBRARY_PATH')
    ld_conf = '/etc/ld.so.conf.d'
    with fs.mkstemp() as fp:
        dest = join(ld_conf, 'zarafa.conf')

        paths = [
            join(zcpenv.repo_basedir, 'provider', 'client', '.libs'),
        ]
        paths = '\n'.join(paths) + '\n'
        open(fp, 'wt').write(paths)

        fs.sh_copyfile(fp, dest, sudo=True)
        fs.sh_chmod(dest, 644, sudo=True)

        env.sudo('ldconfig')

    puts('Setting up PYTHONPATH')
    pyhome = dirname(os.__file__)
    pkg_dir_dir = join(pyhome, 'dist-packages')
    with fs.mkstemp() as fp:
        dest = join(pkg_dir_dir, 'MAPI.pth')

        paths = [
            join(zcpenv.repo_basedir, 'swig', 'python'),
            join(zcpenv.repo_basedir, 'swig', 'python', '.libs'),
        ]
        paths = '\n'.join(paths) + '\n'
        open(fp, 'wt').write(paths)

        fs.sh_copyfile(fp, dest, sudo=True)
        fs.sh_chmod(dest, 644, sudo=True)

    puts('Setting up ZARAFA_SOCKET')
    src = join(zcpenv.fakeroot, 'var', 'run', 'zarafa')
    if not os.path.exists(src):
        warn('Path does not exist: {0}'.format(src))

    else:
        dest = '/var/run/zarafa'
        if fs.sh_exists(dest):
            fs.sh_rm(dest, sudo=True)
        fs.sh_ln(src, dest, sudo=True)

    puts('Setting up ssl client cert')
    src = join('etc', 'zarafa', 'ssl', 'client.pem')
    destdir = '/etc/zarafa/sslkeys'
    dest = join(destdir, 'client.pem')

    if not fs.sh_exists(dest):
        fs.sh_makedirs(destdir, sudo=True)
        fs.sh_copyfile(src, dest, sudo=True)