Example #1
0
def step_impl(context, release):
    utils.shell_command('git -C {0} tag -f {1}'.format(context.mock_github_dir,
                                                       release))
    out, err, rc = utils.shell_command(
        'git -C {0} ls-remote --exit-code --tags origin {1}'.format(
            context.mock_developer_dir, release))
    assert_that(rc, equal_to(0))
Example #2
0
def openssh_generate_new_keypair(name, path, keytype=None, passphrase="", bits=None, comment="", tws=None):
    """
    Generates a new private and public key pair--stored in the user's directory
    using the given *name* and other optional parameters (using OpenSSH).

    If *keytype* is given, it must be one of "ecdsa", "rsa" or "dsa" (case
    insensitive).  If *keytype* is "rsa" or "ecdsa", *bits* may be specified to
    specify the size of the key.

    .. note:: Defaults to generating a 521-byte ecdsa key if OpenSSH is version 5.7+. Otherwise a 2048-bit rsa key will be used.
    """
    logging.debug("openssh_generate_new_keypair()")
    openssh_version = shell_command("ssh -V")[1]
    ssh_major_version = int(openssh_version.split()[0].split("_")[1].split(".")[0])
    key_path = os.path.join(path, name)
    ssh_minor_version = int(openssh_version.split()[0].split("_")[1].split(".")[1][0])
    ssh_version = "%s.%s" % (ssh_major_version, ssh_minor_version)
    ssh_version = float(ssh_version)
    if not keytype:
        if ssh_version >= 5.7:
            keytype = "ecdsa"
        else:
            keytype = "rsa"
    else:
        keytype = keytype.lower()
    if not bits and keytype == "ecdsa":
        bits = 521  # Not a typo: five-hundred-twenty-one bits
    elif not bits and keytype == "rsa":
        bits = 2048
    if not passphrase:  # This just makes sure False and None end up as ''
        passphrase = ""
    hostname = os.uname()[1]
    if not comment:
        now = datetime.now().isoformat()
        comment = "Generated by Gate One on %s %s" % (hostname, now)
    ssh_keygen_path = which("ssh-keygen")
    command = (
        "%s "  # Path to ssh-keygen
        "-b %s "  # bits
        "-t %s "  # keytype
        "-C '%s' "  # comment
        "-f %s" % (ssh_keygen_path, bits, keytype, comment, key_path)  # Key path
    )
    m = tws.new_multiplex(command, "gen_ssh_keypair")
    call_errorback = partial(errorback, tws)
    m.expect("^Overwrite.*", overwrite, optional=True, timeout=10)
    passphrase_handler = partial(enter_passphrase, passphrase)
    m.expect("^Enter passphrase", passphrase_handler, errorback=call_errorback, timeout=10)
    m.expect("^Enter same passphrase again", passphrase_handler, errorback=call_errorback, timeout=10)
    finalize = partial(finished, tws)
    # The regex below captures the md5 fingerprint which tells us the
    # operation was successful.
    m.expect(
        "(([0-9a-f][0-9a-f]\:){15}[0-9a-f][0-9a-f])",
        finalize,
        errorback=call_errorback,
        timeout=15,  # Key generation can take a little while
    )
    m.spawn()
Example #3
0
def step_impl(context):
    branch, err, rc = utils.run_with_project_in_path(
        'git -C {0} symbolic-ref --short HEAD'.format(
            context.mock_developer_dir), context)
    utils.run_with_project_in_path(
        'git -C {0} checkout -q devel'.format(context.mock_developer_dir),
        context)
    utils.shell_command(
        'cp -a {0}/features/test_file.txt {1}/test_file.txt'.format(
            os.getcwd(), context.mock_developer_dir))
    utils.run_with_project_in_path(
        'git -C {0} add test_file.txt'.format(context.mock_developer_dir),
        context)
    utils.run_with_project_in_path(
        'git -C {0} commit -m "creating a merge conflict in devel"'.format(
            context.mock_developer_dir), context)
    utils.run_with_project_in_path(
        'git -C {0} push origin devel'.format(context.mock_developer_dir),
        context)
    utils.run_with_project_in_path(
        'git -C {0} checkout feature'.format(context.mock_developer_dir),
        context)
    utils.shell_command(
        'cp -a {0}/features/test_file2.txt {1}/test_file.txt'.format(
            os.getcwd(), context.mock_developer_dir))
    utils.run_with_project_in_path(
        'git -C {0} add test_file.txt'.format(context.mock_developer_dir),
        context)
    utils.run_with_project_in_path(
        'git -C {0} commit -m "a merge conflict from feature"'.format(
            context.mock_developer_dir), context)
    utils.run_with_project_in_path(
        'git -C {0} push origin feature'.format(context.mock_developer_dir),
        context)
    utils.run_with_project_in_path(
        'git -C {0} checkout -q {1}'.format(context.mock_developer_dir,
                                            branch), context)
Example #4
0
def openssh_generate_public_key(path):
    """
    Generates a public key from the given private key at *path*.
    """
    ssh_keygen_path = which('ssh-keygen')
    pubkey_path = "%s.pub" % path
    command = (
        "%s "  # Path to ssh-keygen
        "-f %s "  # Key path
        "-y "  # Output public key to stdout
        "> %s"  # Redirect stdout to the public key path
        % (ssh_keygen_path, path, pubkey_path))
    exitstatus, output = shell_command(command)
    if exitstatus != 0:
        raise SSHKeygenException(
            _("Error generating public key from private key at %s" % path))
Example #5
0
def openssh_generate_public_key(path):
    """
    Generates a public key from the given private key at *path*.
    """
    ssh_keygen_path = which('ssh-keygen')
    pubkey_path = "%s.pub" % path
    command = (
        "%s "       # Path to ssh-keygen
        "-f %s "    # Key path
        "-y "       # Output public key to stdout
        "> %s"      # Redirect stdout to the public key path
        % (ssh_keygen_path, path, pubkey_path)
    )
    exitstatus, output = shell_command(command)
    if exitstatus != 0:
        raise SSHKeygenException(_(
            "Error generating public key from private key at %s" % path))
Example #6
0
def get_identities(anything, tws):
    """
    Sends a message to the client with a list of the identities stored on the
    server for the current user.

    *anything* is just there because the client needs to send *something* along
    with the 'action'.
    """
    logging.debug('get_identities()')
    out_dict = {'result': 'Success'}
    users_ssh_dir = get_ssh_dir(tws)
    out_dict['identities'] = []
    ssh_keygen_path = which('ssh-keygen')
    keytype_re = re.compile('.*\(([A-Z]+)\)$', re.MULTILINE)
    # TODO:  Switch this from using ssh-keygen to determine the keytype to using the string inside the public key.
    try:
        if os.path.exists(users_ssh_dir):
            ssh_files = os.listdir(users_ssh_dir)
            for f in ssh_files:
                if f.endswith('.pub'):
                    # Double-check there's also a private key...
                    identity = f[:-4]  # Will be the same name minus '.pub'
                    if identity in ssh_files:
                        id_path = os.path.join(users_ssh_dir, identity)
                        pub_key_path = os.path.join(users_ssh_dir, f)
                        public_key_contents = open(pub_key_path).read()
                        comment = ' '.join(public_key_contents.split(' ')[2:])
                        if public_key_contents.startswith('ecdsa'):
                            keytype = 'ECDSA'
                        elif public_key_contents.startswith('ssh-dss'):
                            keytype = 'DSA'
                        elif public_key_contents.startswith('ssh-rsa'):
                            keytype = 'RSA'
                        else:
                            keytype = 'Unknown'
                        keygen_cmd = "%s -vlf %s" % (ssh_keygen_path, id_path)
                        retcode, key_info = shell_command(keygen_cmd)
                        # This will just wind up as an empty string if the
                        # version of ssh doesn't support randomart:
                        randomart = '\n'.join(key_info.splitlines()[1:])
                        bits = key_info.split()[0]
                        fingerprint = key_info.split()[1]
                        retcode, bubblebabble = shell_command(
                            "%s -Bf %s" % (ssh_keygen_path, id_path))
                        bubblebabble = bubblebabble.split()[1]
                        certinfo = ''
                        cert_path = "%s-cert.pub" % id_path
                        if os.path.exists(cert_path):
                            retcode, certinfo = shell_command(
                                "%s -Lf %s" % (ssh_keygen_path, cert_path))
                        certinfo = ' '.join(certinfo.split(' ')[1:])
                        fixed_certinfo = ''
                        for i, line in enumerate(certinfo.splitlines()):
                            if i == 0:
                                line = line.lstrip()
                            fixed_certinfo += line.replace('    ', ' ')
                            fixed_certinfo += '\n'
                        id_obj = {
                            'name': identity,
                            'public': public_key_contents,
                            'keytype': keytype,
                            'bubblebabble': bubblebabble,
                            'fingerprint': fingerprint,
                            'randomart': randomart,
                            'certinfo': fixed_certinfo,
                            'bits': bits,
                            'comment': comment.rstrip(),
                        }
                        out_dict['identities'].append(id_obj)
        # Figure out which identities are defaults
        default_ids = []
        default_ids_exists = False
        users_ssh_dir = get_ssh_dir(tws)
        default_ids_path = os.path.join(users_ssh_dir, '.default_ids')
        if os.path.exists(default_ids_path):
            default_ids_exists = True
            with open(default_ids_path) as f:
                default_ids = f.read().splitlines()  # Why not readlines()? \n
        # Convert any absolute paths inside default_ids to just the short names
        default_ids = [os.path.split(a)[1] for a in default_ids]
        if default_ids_exists:
            for i, id_obj in enumerate(out_dict['identities']):
                if id_obj['name'] in default_ids:
                    out_dict['identities'][i]['default'] = True
                else:
                    out_dict['identities'][i]['default'] = False
    except Exception as e:
        error_msg = _("Error getting identities: %s" % e)
        logging.error(error_msg)
        out_dict['result'] = error_msg
    message = {'sshjs_identities_list': out_dict}
    tws.write_message(message)
Example #7
0
def openssh_generate_new_keypair(name,
                                 path,
                                 keytype=None,
                                 passphrase="",
                                 bits=None,
                                 comment="",
                                 tws=None):
    """
    Generates a new private and public key pair--stored in the user's directory
    using the given *name* and other optional parameters (using OpenSSH).

    If *keytype* is given, it must be one of "ecdsa", "rsa" or "dsa" (case
    insensitive).  If *keytype* is "rsa" or "ecdsa", *bits* may be specified to
    specify the size of the key.

    .. note:: Defaults to generating a 521-byte ecdsa key if OpenSSH is version 5.7+. Otherwise a 2048-bit rsa key will be used.
    """
    logging.debug('openssh_generate_new_keypair()')
    openssh_version = shell_command('ssh -V')[1]
    ssh_major_version = int(
        openssh_version.split()[0].split('_')[1].split('.')[0])
    key_path = os.path.join(path, name)
    ssh_minor_version = int(
        openssh_version.split()[0].split('_')[1].split('.')[1][0])
    ssh_version = "%s.%s" % (ssh_major_version, ssh_minor_version)
    ssh_version = float(ssh_version)
    if not keytype:
        if ssh_version >= 5.7:
            keytype = "ecdsa"
        else:
            keytype = "rsa"
    else:
        keytype = keytype.lower()
    if not bits and keytype == "ecdsa":
        bits = 521  # Not a typo: five-hundred-twenty-one bits
    elif not bits and keytype == "rsa":
        bits = 2048
    if not passphrase:  # This just makes sure False and None end up as ''
        passphrase = ''
    hostname = os.uname()[1]
    if not comment:
        now = datetime.now().isoformat()
        comment = "Generated by Gate One on %s %s" % (hostname, now)
    ssh_keygen_path = which('ssh-keygen')
    command = (
        "%s "  # Path to ssh-keygen
        "-b %s "  # bits
        "-t %s "  # keytype
        "-C '%s' "  # comment
        "-f %s"  # Key path
        % (ssh_keygen_path, bits, keytype, comment, key_path))
    m = tws.new_multiplex(command, "gen_ssh_keypair")
    call_errorback = partial(errorback, tws)
    m.expect('^Overwrite.*', overwrite, optional=True, timeout=10)
    passphrase_handler = partial(enter_passphrase, passphrase)
    m.expect('^Enter passphrase',
             passphrase_handler,
             errorback=call_errorback,
             timeout=10)
    m.expect('^Enter same passphrase again',
             passphrase_handler,
             errorback=call_errorback,
             timeout=10)
    finalize = partial(finished, tws)
    # The regex below captures the md5 fingerprint which tells us the
    # operation was successful.
    m.expect(
        '(([0-9a-f][0-9a-f]\:){15}[0-9a-f][0-9a-f])',
        finalize,
        errorback=call_errorback,
        timeout=15  # Key generation can take a little while
    )
    m.spawn()
Example #8
0
def get_identities(anything, tws):
    """
    Sends a message to the client with a list of the identities stored on the
    server for the current user.

    *anything* is just there because the client needs to send *something* along
    with the 'action'.
    """
    logging.debug("get_identities()")
    out_dict = {"result": "Success"}
    users_ssh_dir = get_ssh_dir(tws)
    out_dict["identities"] = []
    ssh_keygen_path = which("ssh-keygen")
    keytype_re = re.compile(".*\(([A-Z]+)\)$", re.MULTILINE)
    # TODO:  Switch this from using ssh-keygen to determine the keytype to using the string inside the public key.
    try:
        if os.path.exists(users_ssh_dir):
            ssh_files = os.listdir(users_ssh_dir)
            for f in ssh_files:
                if f.endswith(".pub"):
                    # Double-check there's also a private key...
                    identity = f[:-4]  # Will be the same name minus '.pub'
                    if identity in ssh_files:
                        id_path = os.path.join(users_ssh_dir, identity)
                        pub_key_path = os.path.join(users_ssh_dir, f)
                        public_key_contents = open(pub_key_path).read()
                        comment = " ".join(public_key_contents.split(" ")[2:])
                        if public_key_contents.startswith("ecdsa"):
                            keytype = "ECDSA"
                        elif public_key_contents.startswith("ssh-dss"):
                            keytype = "DSA"
                        elif public_key_contents.startswith("ssh-rsa"):
                            keytype = "RSA"
                        else:
                            keytype = "Unknown"
                        keygen_cmd = "%s -vlf %s" % (ssh_keygen_path, id_path)
                        retcode, key_info = shell_command(keygen_cmd)
                        # This will just wind up as an empty string if the
                        # version of ssh doesn't support randomart:
                        randomart = "\n".join(key_info.splitlines()[1:])
                        bits = key_info.split()[0]
                        fingerprint = key_info.split()[1]
                        retcode, bubblebabble = shell_command("%s -Bf %s" % (ssh_keygen_path, id_path))
                        bubblebabble = bubblebabble.split()[1]
                        certinfo = ""
                        cert_path = "%s-cert.pub" % id_path
                        if os.path.exists(cert_path):
                            retcode, certinfo = shell_command("%s -Lf %s" % (ssh_keygen_path, cert_path))
                        certinfo = " ".join(certinfo.split(" ")[1:])
                        fixed_certinfo = ""
                        for i, line in enumerate(certinfo.splitlines()):
                            if i == 0:
                                line = line.lstrip()
                            fixed_certinfo += line.replace("    ", " ")
                            fixed_certinfo += "\n"
                        id_obj = {
                            "name": identity,
                            "public": public_key_contents,
                            "keytype": keytype,
                            "bubblebabble": bubblebabble,
                            "fingerprint": fingerprint,
                            "randomart": randomart,
                            "certinfo": fixed_certinfo,
                            "bits": bits,
                            "comment": comment.rstrip(),
                        }
                        out_dict["identities"].append(id_obj)
        # Figure out which identities are defaults
        default_ids = []
        default_ids_exists = False
        users_ssh_dir = get_ssh_dir(tws)
        default_ids_path = os.path.join(users_ssh_dir, ".default_ids")
        if os.path.exists(default_ids_path):
            default_ids_exists = True
            with open(default_ids_path) as f:
                default_ids = f.read().splitlines()  # Why not readlines()? \n
        # Convert any absolute paths inside default_ids to just the short names
        default_ids = [os.path.split(a)[1] for a in default_ids]
        if default_ids_exists:
            for i, id_obj in enumerate(out_dict["identities"]):
                if id_obj["name"] in default_ids:
                    out_dict["identities"][i]["default"] = True
                else:
                    out_dict["identities"][i]["default"] = False
    except Exception as e:
        error_msg = _("Error getting identities: %s" % e)
        logging.error(error_msg)
        out_dict["result"] = error_msg
    message = {"sshjs_identities_list": out_dict}
    tws.write_message(message)
Example #9
0
def get_identities(self, anything):
    """
    Sends a message to the client with a list of the identities stored on the
    server for the current user.

    *anything* is just there because the client needs to send *something* along
    with the 'action'.
    """
    logging.debug('get_identities()')
    out_dict = {'result': 'Success'}
    users_ssh_dir = get_ssh_dir(self)
    out_dict['identities'] = []
    ssh_keygen_path = which('ssh-keygen')
    # TODO:  Switch this from using ssh-keygen to determine the keytype to using the string inside the public key.
    try:
        if os.path.exists(users_ssh_dir):
            ssh_files = os.listdir(users_ssh_dir)
            for f in ssh_files:
                if f.endswith('.pub'):
                    # Double-check there's also a private key...
                    identity = f[:-4] # Will be the same name minus '.pub'
                    if identity in ssh_files:
                        id_path = os.path.join(users_ssh_dir, identity)
                        pub_key_path = os.path.join(users_ssh_dir, f)
                        public_key_contents = open(pub_key_path).read()
                        comment = ' '.join(public_key_contents.split(' ')[2:])
                        if public_key_contents.startswith('ecdsa'):
                            keytype = 'ECDSA'
                        elif public_key_contents.startswith('ssh-dss'):
                            keytype = 'DSA'
                        elif public_key_contents.startswith('ssh-rsa'):
                            keytype = 'RSA'
                        else:
                            keytype = 'Unknown'
                        keygen_cmd = "'%s' -vlf '%s'" % (
                            ssh_keygen_path, id_path)
                        retcode, key_info = shell_command(keygen_cmd)
                        # This will just wind up as an empty string if the
                        # version of ssh doesn't support randomart:
                        randomart = '\n'.join(key_info.splitlines()[1:])
                        bits = key_info.split()[0]
                        fingerprint = key_info.split()[1]
                        retcode, bubblebabble = shell_command(
                            "'%s' -Bf '%s'" % (ssh_keygen_path, id_path))
                        bubblebabble = bubblebabble.split()[1]
                        certinfo = ''
                        cert_path = "'%s-cert.pub'" % id_path
                        if os.path.exists(cert_path):
                            retcode, certinfo = shell_command(
                            "'%s' -Lf '%s'" % (ssh_keygen_path, cert_path))
                        certinfo = ' '.join(certinfo.split(' ')[1:])
                        fixed_certinfo = ''
                        for i, line in enumerate(certinfo.splitlines()):
                            if i == 0:
                                line = line.lstrip()
                            fixed_certinfo += line.replace('    ', ' ')
                            fixed_certinfo += '\n'
                        id_obj = {
                            'name': identity,
                            'public': public_key_contents,
                            'keytype': keytype,
                            'bubblebabble': bubblebabble,
                            'fingerprint': fingerprint,
                            'randomart': randomart,
                            'certinfo': fixed_certinfo,
                            'bits': bits,
                            'comment': comment.rstrip(),
                        }
                        out_dict['identities'].append(id_obj)
        # Figure out which identities are defaults
        default_ids = []
        default_ids_exists = False
        users_ssh_dir = get_ssh_dir(self)
        default_ids_path = os.path.join(users_ssh_dir, '.default_ids')
        if os.path.exists(default_ids_path):
            default_ids_exists = True
            with open(default_ids_path) as f:
                default_ids = f.read().splitlines() # Why not readlines()? \n
        # Convert any absolute paths inside default_ids to just the short names
        default_ids = [os.path.split(a)[1] for a in default_ids]
        if default_ids_exists:
            for i, id_obj in enumerate(out_dict['identities']):
                if id_obj['name'] in default_ids:
                    out_dict['identities'][i]['default'] = True
                else:
                    out_dict['identities'][i]['default'] = False
    except Exception as e:
        error_msg = _("Error getting identities: %s" % e)
        logging.error(error_msg)
        out_dict['result'] = error_msg
    message = {
        'terminal:sshjs_identities_list': out_dict
    }
    self.write_message(message)
Example #10
0
def get_identities(anything, tws):
    """
    Sends a message to the client with a list of the identities stored on the
    server for the current user.

    *anything* is just there because the client needs to send *something* along
    with the 'action'.
    """
    logging.debug('get_identities()')
    out_dict = {'result': 'Success'}
    users_ssh_dir = get_ssh_dir(tws)
    out_dict['identities'] = []
    ssh_keygen_path = which('ssh-keygen')
    keytype_re = re.compile('.*\(([A-Z]+)\)$', re.MULTILINE)
    try:
        if os.path.exists(users_ssh_dir):
            ssh_files = os.listdir(users_ssh_dir)
            for f in ssh_files:
                if f.endswith('.pub'):
                    # Double-check there's also a private key...
                    identity = f[:-4] # Will be the same name minus '.pub'
                    if identity in ssh_files:
                        id_path = os.path.join(users_ssh_dir, identity)
                        pub_key_path = os.path.join(users_ssh_dir, f)
                        public_key_contents = open(pub_key_path).read()
                        comment = ' '.join(public_key_contents.split(' ')[2:])
                        keygen_cmd = "%s -vlf %s" % (ssh_keygen_path, id_path)
                        retcode, key_info = shell_command(keygen_cmd)
                        try:
                            keytype = keytype_re.search(key_info).group(1)
                        except AttributeError:
                            # Couldn't match keytype? Something went wrong
                            out_dict = {
                                'result': _(
                                    "Error: Couldn't determine keytype?")}
                        # This will just wind up as an empty string if the
                        # version of ssh doesn't support randomart:
                        randomart = '\n'.join(key_info.splitlines()[1:])
                        bits = key_info.split()[0]
                        fingerprint = key_info.split()[1]
                        retcode, bubblebabble = shell_command(
                            "%s -Bf %s" % (ssh_keygen_path, id_path))
                        bubblebabble = bubblebabble.split()[1]
                        certinfo = ''
                        cert_path = "%s-cert.pub" % id_path
                        if os.path.exists(cert_path):
                            retcode, certinfo = shell_command(
                            "%s -Lf %s" % (ssh_keygen_path, cert_path))
                        certinfo = ' '.join(certinfo.split(' ')[1:])
                        fixed_certinfo = ''
                        for i, line in enumerate(certinfo.splitlines()):
                            if i == 0:
                                line = line.lstrip()
                            fixed_certinfo += line.replace('    ', ' ')
                            fixed_certinfo += '\n'
                        id_obj = {
                            'name': identity,
                            'public': public_key_contents,
                            'keytype': keytype,
                            'bubblebabble': bubblebabble,
                            'fingerprint': fingerprint,
                            'randomart': randomart,
                            'certinfo': fixed_certinfo,
                            'bits': bits,
                            'comment': comment.rstrip(),
                        }
                        out_dict['identities'].append(id_obj)
        # Figure out which identities are defaults
        default_ids = []
        default_ids_exists = False
        users_ssh_dir = get_ssh_dir(tws)
        default_ids_path = os.path.join(users_ssh_dir, '.default_ids')
        if os.path.exists(default_ids_path):
            default_ids_exists = True
            with open(default_ids_path) as f:
                default_ids = f.read().splitlines() # Why not readlines()? \n
        # Convert any absolute paths inside default_ids to just the short names
        default_ids = [os.path.split(a)[1] for a in default_ids]
        if default_ids_exists:
            for i, id_obj in enumerate(out_dict['identities']):
                if id_obj['name'] in default_ids:
                    out_dict['identities'][i]['default'] = True
                else:
                    out_dict['identities'][i]['default'] = False
    except Exception as e:
        out_dict['result'] = _("Error getting identities: %s" % e)
    message = {
        'sshjs_identities_list': out_dict
    }
    tws.write_message(message)
Example #11
0
def step_impl(context):
    utils.shell_command(
        'cp -a {0}/features/test_file.txt {1}/test_file.txt'.format(
            os.getcwd(), context.mock_developer_dir))
Example #12
0
def step_impl(context, directory):
    out, err, rc = utils.shell_command('ls {0}/{1}'.format(
        context.mock_developer_dir, directory))
    assert_that(context.rc, equal_to(0))
Example #13
0
def step_impl(context, branch):
    context.mock_developer_dir = tempfile.mkdtemp(prefix='kevlar')
    utils.shell_command('git -C {0} clone -q file:///{1} . -b {2}'.format(
        context.mock_developer_dir, context.mock_github_dir, branch))
    utils.shell_command('git -C {0} checkout -q {1}'.format(
        context.mock_developer_dir, branch))
    utils.shell_command(
        'git -C {0} config --local user.signingkey 794267AC'.format(
            context.mock_developer_dir))
    utils.shell_command(
        'git -C {0} config --local user.name "Local Test"'.format(
            context.mock_developer_dir))
    utils.shell_command(
        'git -C {0} config --local user.email "*****@*****.**"'.
        format(context.mock_developer_dir))
    utils.shell_command('git -C {0} config --local gpg.program gpg2'.format(
        context.mock_developer_dir))