示例#1
0
    def __init__(self, instance_name, project, zone):
        assert project, 'Need to specify a project via --project argument.'
        assert zone, 'Need to specify a zone via --zone argument.'

        # FIXME: Make these configurable.
        self.username = '******'
        self.domain = 'GOOGLE'
        self.clusterfuzz_parent_path = r'c:'

        self.staging_source_filename = 'clusterfuzz-source-stage.zip'

        (hostname, _,
         _) = utils.get_host_user_and_ssh_key_path(instance_name, project,
                                                   zone)

        api.env.password = utils.get_password()
        api.env.user = self.username
        api.env.hosts = [hostname]
        api.env.host_string = '{username}@{hostname}'.format(
            username=self.username, hostname=hostname)
        api.env.key_filename = None
        api.env.gss_auth = None
        api.env.gss_deleg_creds = None
        api.env.gss_kex = None
        api.env.no_keys = True
        api.env.key_filename = None
        api.env.no_agent = True
        api.env.use_shell = False
示例#2
0
    def __init__(self, instance_name, *_):
        super(Handler, self).__init__(instance_name=instance_name,
                                      platform='linux',
                                      project=None,
                                      zone=None)

        # FIXME: Make these configurable.
        tokens = self.instance_name.split('-')
        api.env.host_string = '%s-%s.labs' % (tokens[1], tokens[2])
        self.bot_name = tokens[3]
        self.username = '******'
        self.clusterfuzz_parent_path = ('/home/{user}/bots/{bot_name}'.format(
            user=self.username, bot_name=self.bot_name))

        api.env.user = self.username
        api.env.gateway = None
        api.env.use_ssh_config = True
        api.env.ssh_config_path = '~/.ssh/config'
        api.env.key_filename = None
        api.env.use_shell = True
        api.env.password = api.env.sudo_password = utils.get_password()

        # Disable passwordless authentication, so we don't have to touch
        # a security key multiple times because it tries to access keys that
        # we don't need.
        os.environ['SSH_AUTH_SOCK'] = ''

        print
        print(
            'SSHing into chrome lab only works if you performs the below in'
            ' order:')
        print(
            '(1) Your `~/.ssh/config` is up-to-date. You can get it from'
            ' go/chrome-lab-ssh-config')
        print(
            '(2) You are a member of clusterfuzz-build-access (see'
            ' go/clusterfuzz-build-access)')
        print(
            '(3) ControlMaster is enabled. Put the below'
            ' lines in your `~/.ssh/config`:')
        print
        print 'Match host *'
        print '  ControlMaster auto'
        print '  ControlPath ~/.ssh/ctrl-%C'
        print '  ControlPersist 6h'
        print
        print '(4) You ran `prodaccess --chromegolo_ssh` recently.'
        print(
            "(5) You sshed into *one* of the chrome lab's machines in the last"
            ' 6 hours.')
        print
        print 'Now you can enjoy sshing into any android bot in the chrome lab.'
        print
示例#3
0
    def rdp(self, share_path=None):
        """Launch remmina with correct configuration for the target instance."""
        password = utils.get_password()
        template = utils.get_file_content(TEMPLATE_REMMINA_PATH)

        with open(GENERATED_REMMINA_PATH, 'w') as config:
            config.write(
                template.format(domain=self.domain,
                                username=self.username,
                                password=password,
                                share_path=share_path or '',
                                hostname=api.env.hosts[0]))

        api.local('remmina -c ' + os.path.abspath(GENERATED_REMMINA_PATH))
示例#4
0
文件: mac.py 项目: ze0r/clusterfuzz
    def __init__(self, instance_name, *_):
        super(Handler, self).__init__(instance_name=instance_name,
                                      platform='macos',
                                      project=None,
                                      zone=None)

        # FIXME: Make these configurable.
        self.username = '******'
        self.clusterfuzz_parent_path = '/b'

        api.env.host_string = self.instance_name
        api.env.user = self.username
        api.env.gateway = None
        api.env.use_ssh_config = True
        api.env.ssh_config_path = '~/.ssh/config'
        api.env.key_filename = None
        api.env.use_shell = True
        api.env.password = api.env.sudo_password = utils.get_password()

        # Disable passwordless authentication, so we don't have to touch
        # a security key multiple times because it tries to access keys that
        # we don't need.
        os.environ['SSH_AUTH_SOCK'] = ''

        print()
        print(
            'SSHing into a mac machine only works if you performs the below in'
            ' order:')
        print('(1) Your `~/.ssh/config` is up-to-date. You can get it from'
              ' go/chrome-lab-ssh-config')
        print('(2) You are a member of clusterfuzz-build-access (see'
              ' go/clusterfuzz-build-access)')
        print('(3) ControlMaster is enabled. Put the below'
              ' lines in your `~/.ssh/config`:')
        print()
        print('Match host *')
        print('  ControlMaster auto')
        print('  ControlPath ~/.ssh/ctrl-%C')
        print('  ControlPersist 6h')
        print()
        print('(4) You ran `prodaccess --chromegolo_ssh` recently.')
        print('(5) You sshed into *one* of the mac machines in the last'
              ' 6 hours.')
        print()
        print('Now you can enjoy sshing into any mac machine.')
        print()