Exemple #1
0
def ManageBinaries(config=None, token=None):
  """Repack templates into installers."""
  print("\nStep 4: Installing template package and repackaging clients with"
        " new configuration.")
  pack_templates = False
  download_templates = False

  if flags.FLAGS.noprompt:
    if not flags.FLAGS.no_templates_download:
      download_templates = pack_templates = True

  else:
    if ((raw_input("Download client templates? You can skip "
                   "this if templates are already installed."
                   "[Yn]: ").upper() or "Y") == "Y"):
      download_templates = True

    if (raw_input("Repack client templates?" "[Yn]: ").upper() or "Y") == "Y":
      pack_templates = True

  if download_templates:
    InstallTemplatePackage()

  # Build debug binaries, then build release binaries.
  if pack_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"
Exemple #2
0
def ManageBinaries(config=None, token=None):
  """Repack templates into installers."""
  print ("\nStep 4: Installing template package and repackaging clients with"
         " new configuration.")

  if flags.FLAGS.noprompt or ((raw_input(
      "Download and upgrade client templates? You can skip this if "
      "templates are already installed. [Yn]: ").upper() or "Y") == "Y"):
    InstallTemplatePackage()

  # Build debug binaries, then build release binaries.
  maintenance_utils.RepackAllBinaries(upload=True, debug_build=True,
                                      token=token)
  maintenance_utils.RepackAllBinaries(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"
Exemple #3
0
def ManageBinaries(config=None, token=None):
    """Load memory drivers and repack templates into installers."""

    print "\nStep 4: Uploading Memory Drivers to the Database"
    LoadMemoryDrivers(flags.FLAGS.share_dir, token=token)

    print "\nStep 5: Repackaging clients with new configuration."
    # We need to update the config to point to the installed templates now.
    config.Set("ClientBuilder.executables_dir",
               os.path.join(flags.FLAGS.share_dir, "executables"))

    # Build debug binaries, then build release binaries.
    maintenance_utils.RepackAllBinaries(upload=True,
                                        debug_build=True,
                                        token=token)
    maintenance_utils.RepackAllBinaries(upload=True, token=token)

    print "\nStep 6: 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"
Exemple #4
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 = config_lib.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")