Ejemplo n.º 1
0
def sign_app(src, dest):
    if settings.SIGNED_APPS_SERVER_ACTIVE:
        # At some point this will be implemented, but not now.
        raise NotImplementedError

    if not os.path.exists(settings.SIGNED_APPS_KEY):
        # TODO: blocked on bug 793876
        # This is a temporary copy that will be unsigned and ignores storage
        # etc.
        # raise ValueError('The signed apps key cannot be found.')
        dest_dir = os.path.dirname(dest)
        if not os.path.exists(dest_dir):
            os.makedirs(dest_dir)
        shutil.copy(src, dest)
        return

    # TODO: stop doing this and use the signing server.
    try:
        # Not sure this will work too well on S3.
        xpisign(storage.open(src, 'r'), settings.SIGNED_APPS_KEY,
                storage.open(dest, 'w'))
    except:
        # TODO: figure out some likely errors that can occur.
        log.error('Signing failed', exc_info=True)
        raise
Ejemplo n.º 2
0
def sign_app(src, dest):
    if settings.SIGNED_APPS_SERVER_ACTIVE:
        # At some point this will be implemented, but not now.
        raise NotImplementedError

    if not os.path.exists(settings.SIGNED_APPS_KEY):
        # TODO: blocked on bug 793876
        # This is a temporary copy that will be unsigned and ignores storage
        # etc.
        # raise ValueError('The signed apps key cannot be found.')
        dest_dir = os.path.dirname(dest)
        if not os.path.exists(dest_dir):
            os.makedirs(dest_dir)
        shutil.copy(src, dest)
        return

    # TODO: stop doing this and use the signing server.
    try:
        # Not sure this will work too well on S3.
        xpisign(storage.open(src, 'r'), settings.SIGNED_APPS_KEY,
                storage.open(dest, 'w'), optimize_signatures=True,
                omit_sf_entry_sections=True, omit_created_by=True)
    except:
        # TODO: figure out some likely errors that can occur.
        log.error('Signing failed', exc_info=True)
        raise
Ejemplo n.º 3
0
    if not os.path.exists(settings.SIGNED_APPS_KEY):
        # TODO: blocked on bug 793876
        # This is a temporary copy that will be unsigned and ignores storage
        # etc.
        # raise ValueError('The signed apps key cannot be found.')
        dest_dir = os.path.dirname(dest)
        if not os.path.exists(dest_dir):
            os.makedirs(dest_dir)
        shutil.copy(src, dest)
        return

    # TODO: stop doing this and use the signing server.
    try:
        # Not sure this will work too well on S3.
        xpisign(storage.open(src, 'r'), settings.SIGNED_APPS_KEY,
                storage.open(dest, 'w'), optimize_signatures=True,
                omit_sf_entry_sections=True, omit_created_by=True)
    except:
        # TODO: figure out some likely errors that can occur.
        log.error('Signing failed', exc_info=True)
        raise SigningError('Signing failed')


@task
def sign(version_id, reviewer=False):
    version = Version.objects.get(pk=version_id)
    app = version.addon
    log.info('Signing version: %s of app: %s' % (version_id, app))

    if not app.type == amo.ADDON_WEBAPP:
        log.error('Attempt to sign something other than an app.')