Ejemplo n.º 1
0
def ManageBinaries(config=None, token=None):
    """Repack templates into installers."""
    print "\nStep 4: Repackaging clients with new configuration."
    redownload_templates = False
    repack_templates = False

    if flags.FLAGS.noprompt:
        redownload_templates = flags.FLAGS.redownload_templates
        repack_templates = not flags.FLAGS.norepack_templates
    else:
        redownload_templates = RetryBoolQuestion(
            "Server debs include client templates. Re-download templates?",
            False)
        repack_templates = RetryBoolQuestion("Repack client templates?", True)

    if redownload_templates:
        InstallTemplatePackage()

    # Build debug binaries, then build release binaries.
    if repack_templates:
        repacking.TemplateRepacker().RepackAllTemplates(upload=True,
                                                        token=token)

        print "\nStep 5: Signing and uploading client components."
        maintenance_utils.SignAllComponents(token=token)

    print "\nInitialization complete, writing configuration."
    config.Write()
    print "Please restart the service for it to take effect.\n\n"
Ejemplo n.º 2
0
                                                 token=token)

        print "Uploaded to %s" % dest_path

    elif flags.FLAGS.subparser_name == "sign_component":
        maintenance_utils.SignComponentContent(flags.FLAGS.component_filename,
                                               flags.FLAGS.output_filename)

    elif flags.FLAGS.subparser_name == "upload_component":
        maintenance_utils.SignComponent(
            flags.FLAGS.component_filename,
            overwrite=flags.FLAGS.overwrite_component,
            token=token)

    elif flags.FLAGS.subparser_name == "upload_components":
        maintenance_utils.SignAllComponents(
            overwrite=flags.FLAGS.overwrite_component, token=token)

    elif flags.FLAGS.subparser_name == "list_components":
        maintenance_utils.ListComponents(token=token)

    elif flags.FLAGS.subparser_name == "set_var":
        config = grr_config.CONFIG
        print "Setting %s to %s" % (flags.FLAGS.var, flags.FLAGS.val)
        if flags.FLAGS.val.startswith("["):  # Allow setting of basic lists.
            flags.FLAGS.val = flags.FLAGS.val[1:-1].split(",")
        config.Set(flags.FLAGS.var, flags.FLAGS.val)
        config.Write()

    elif flags.FLAGS.subparser_name == "upload_raw":
        if not flags.FLAGS.dest_path:
            flags.FLAGS.dest_path = aff4.ROOT_URN.Add("config").Add("raw")