Revision 63bcea2a lib/backend.py

b/lib/backend.py
2656 2656
                                                 key_name)
2657 2657
    assert ca is not None
2658 2658

  
2659
  for i in [key_path, cert_path]:
2660
    if os.path.exists(i):
2661
      _Fail("File '%s' does not exist" % i)
2662

  
2659 2663
  status_dir = _CreateImportExportStatusDir(prefix)
2660 2664
  try:
2661 2665
    status_file = utils.PathJoin(status_dir, _IES_STATUS_FILE)
2662 2666
    pid_file = utils.PathJoin(status_dir, _IES_PID_FILE)
2667
    ca_file = utils.PathJoin(status_dir, _IES_CA_FILE)
2663 2668

  
2664 2669
    if ca is None:
2665 2670
      # Use server.pem
2666
      # TODO: If socat runs as a non-root user, this might need to be copied to
2667
      # a separate file
2668
      ca_path = constants.NODED_CERT_FILE
2669
    else:
2670
      ca_path = utils.PathJoin(status_dir, _IES_CA_FILE)
2671
      utils.WriteFile(ca_path, data=ca, mode=0400)
2671
      ca = utils.ReadFile(constants.NODED_CERT_FILE)
2672

  
2673
    utils.WriteFile(ca_file, data=ca, mode=0400)
2672 2674

  
2673 2675
    cmd = [
2674 2676
      constants.IMPORT_EXPORT_DAEMON,
2675 2677
      status_file, mode,
2676 2678
      "--key=%s" % key_path,
2677 2679
      "--cert=%s" % cert_path,
2678
      "--ca=%s" % ca_path,
2680
      "--ca=%s" % ca_file,
2679 2681
      ]
2680 2682

  
2681 2683
    if host:

Also available in: Unified diff