Пример #1
0
    def test_01_map_user(self):
        if core.missing_rpm('gums-service'):
            return

        host_dn, _ = core.certificate_info(core.config['certs.hostcert'])
        pwd_entry = pwd.getpwnam(core.options.username)
        cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
        user_dn, _ = core.certificate_info(cert_path)
        command = ('gums', 'mapUser', '--service', host_dn, user_dn)
        core.check_system(command, 'Map GUMS user')
Пример #2
0
 def test_06_add_local_admin(self):
     if core.missing_rpm('voms-admin-server', 'voms-mysql-plugin'):
         return
     host_dn, host_issuer = \
         core.certificate_info(core.config['certs.hostcert'])
     command = ('voms-db-deploy.py', 'add-admin', '--vo',
                core.config['voms.vo'], '--dn', host_dn, '--ca',
                host_issuer)
     core.check_system(command, 'Add VO admin')
Пример #3
0
    def test_003_setup_grid_mapfile(self):
        if core.missing_rpm('rsv'):
            return

        # Register the cert in the gridmap file
        cert_subject = core.certificate_info(core.config['rsv.certfile'])[0]
        files.append(core.config['system.mapfile'],
                     '"%s" rsv\n' % (cert_subject),
                     owner='rsv')
Пример #4
0
    def test_01_add_user(self):
        if core.missing_rpm('voms-admin-server', 'voms-admin-client'):
            return

        pwd_entry = pwd.getpwnam(core.options.username)
        cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
        user_cert_dn, user_cert_issuer = core.certificate_info(cert_path)
        hostname = socket.getfqdn()

        command = ('voms-admin', '--vo', core.config['voms.vo'], '--host',
                   hostname, '--nousercert', 'create-user', user_cert_dn,
                   user_cert_issuer, 'OSG Test User', 'root@localhost')
        core.check_system(command, 'Add VO user')
Пример #5
0
    def test_01_check_gridmap(self):
        if not core.rpm_is_installed('glexec'):
            core.skip('not installed')
            return

        pwd_entry = pwd.getpwnam(core.options.username)
        cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
        user_cert_dn, user_cert_issuer = core.certificate_info(cert_path)

        key_dn = '"'+user_cert_dn+'"'+' '+core.options.username

        command = ('/bin/grep', key_dn, self.__grid_mapfile)
        status, stdout, stderr = core.system(command)
        self.assert_(status==0, 'Grid-mapfile entry for user '+core.options.username+' missing')
        TestGlexec.__good_gridmap = True
Пример #6
0
    def test_05_add_mysql_admin(self):
        if core.missing_rpm('gums-service'):
            return
        host_dn, host_issuer = core.certificate_info(
            core.config['certs.hostcert'])
        mysql_template_path = '/usr/lib/gums/sql/addAdmin.mysql'
        self.assert_(os.path.exists(mysql_template_path),
                     'GUMS MySQL template exists')
        mysql_template = files.read(mysql_template_path,
                                    as_single_string=True).strip()
        core.log_message(mysql_template)

        mysql_command = re.sub(r'@ADMINDN@', host_dn, mysql_template)
        core.log_message(mysql_command)

        command = ('mysql', '--user=gums', '-p' + core.config['gums.password'],
                   '--execute=' + mysql_command)
        core.check_system(command, 'Add GUMS MySQL admin')
Пример #7
0
 def test_03_install_mapfile(self):
     core.state['system.wrote_mapfile'] = False
     try:
         pwd_entry = pwd.getpwnam(core.options.username)
     except KeyError:
         core.skip('no user')
         return
     if pwd_entry.pw_dir == '/':
         core.skip('no user home dir')
         return
     cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
     user_dn, user_cert_issuer = core.certificate_info(cert_path)
     existed_prior = os.path.exists(core.config['system.mapfile'])
     files.append(core.config['system.mapfile'],
                  '"%s" %s\n' % (user_dn, pwd_entry.pw_name),
                  owner='user')
     if not existed_prior:
         core.state['system.wrote_mapfile'] = True
     os.chmod(core.config['system.mapfile'], 0644)
Пример #8
0
    def test_02_edg_mkgridmap(self):
        if core.missing_rpm('edg-mkgridmap', 'voms-server'):
            return

        command = ('edg-mkgridmap', '--conf', core.config['edg.conf'])
        os.environ['GRIDMAP'] = '/usr/share/osg-test/grid-mapfile'
        os.environ['USER_VO_MAP'] = '/usr/share/osg-test/user-vo-map'
        os.environ['EDG_MKGRIDMAP_LOG'] = \
            '/usr/share/osg-test/edg-mkgridmap.log'
        os.environ['VO_LIST_FILE'] = '/usr/share/osg-test/vo-list-file'
        os.environ['UNDEFINED_ACCTS_FILE'] = '/usr/share/osg-test/undef-ids'
        core.check_system(command, 'Run edg-mkgridmap')

        pwd_entry = pwd.getpwnam(core.options.username)
        cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem')
        user_cert_dn, user_cert_issuer = core.certificate_info(cert_path)
        expected = '"%s" %s' % (user_cert_dn, core.options.username)

        contents = files.read(os.environ['GRIDMAP'], True)
        self.assert_(expected in contents, 'Expected grid-mapfile contents')
Пример #9
0
    def test_08_advertise(self):
        if core.missing_rpm('voms-admin-server'):
            return

        hostname = socket.getfqdn()
        host_dn, host_issuer = core.certificate_info(
            core.config['certs.hostcert'])
        contents = ('"%s" "%s" "%d" "%s" "%s"\n' %
                    (core.config['voms.vo'], hostname, 15151, host_dn,
                     core.config['voms.vo']))
        files.write('/etc/vomses', contents, owner='voms')

        if not os.path.isdir(core.config['voms.lsc-dir']):
            os.mkdir(core.config['voms.lsc-dir'])
        vo_lsc_path = os.path.join(core.config['voms.lsc-dir'],
                                   hostname + '.lsc')
        files.write(vo_lsc_path, (host_dn + '\n', host_issuer + '\n'),
                    backup=False)
        os.chmod(vo_lsc_path, 0644)

        core.system('ls -ldF /etc/*vom*', shell=True)
        core.system(('find', '/etc/grid-security/vomsdir', '-ls'))