Revision 052783ff

b/Makefile.am
1201 1201
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
1202 1202
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
1203 1203
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
1204
	  echo "SSH_LOGIN_USER = '$(SSH_LOGIN_USER)'"; \
1205
	  echo "SSH_CONSOLE_USER = '$(SSH_CONSOLE_USER)'"; \
1204 1206
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
1205 1207
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
1206 1208
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
b/configure.ac
176 176
  [lvm_stripecount="1"])
177 177
AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
178 178

  
179
# --with-ssh-login-user=...
180
AC_ARG_WITH([ssh-login-user],
181
  [AS_HELP_STRING([--with-ssh-login-user=USERNAME],
182
    [user to use for SSH logins within the cluster (default is root)]
183
  )],
184
  [ssh_login_user="$withval"],
185
  [ssh_login_user=root])
186
AC_SUBST(SSH_LOGIN_USER, $ssh_login_user)
187

  
188
# --with-ssh-console-user=...
189
AC_ARG_WITH([ssh-console-user],
190
  [AS_HELP_STRING([--with-ssh-console-user=USERNAME],
191
    [user to use for SSH logins to access instance consoles (default is root)]
192
  )],
193
  [ssh_console_user="$withval"],
194
  [ssh_console_user=root])
195
AC_SUBST(SSH_CONSOLE_USER, $ssh_console_user)
196

  
179 197
# --with-default-user=...
180 198
AC_ARG_WITH([default-user],
181 199
  [AS_HELP_STRING([--with-default-user=USERNAME],
b/lib/backend.py
497 497

  
498 498
  if modify_ssh_setup:
499 499
    try:
500
      priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
500
      priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.SSH_LOGIN_USER)
501 501

  
502 502
      utils.RemoveAuthorizedKey(auth_keys, utils.ReadFile(pub_key))
503 503

  
......
2039 2039
                                " oflag=dsync", dest_path)
2040 2040

  
2041 2041
  remotecmd = _GetSshRunner(cluster_name).BuildCmd(dest_node,
2042
                                                   constants.GANETI_RUNAS,
2042
                                                   constants.SSH_LOGIN_USER,
2043 2043
                                                   destcmd)
2044 2044

  
2045 2045
  # all commands have been checked, so we're safe to combine them
b/lib/bootstrap.py
61 61
  permitted hosts and adds the hostkey to its own known hosts.
62 62

  
63 63
  """
64
  priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
64
  priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.SSH_LOGIN_USER)
65 65

  
66 66
  for name in priv_key, pub_key:
67 67
    if os.path.exists(name):
......
675 675
  mycommand = ("%s stop-all; %s start %s" %
676 676
               (pathutils.DAEMON_UTIL, pathutils.DAEMON_UTIL, constants.NODED))
677 677

  
678
  result = sshrunner.Run(node, "root", mycommand, batch=False,
678
  result = sshrunner.Run(node, constants.SSH_LOGIN_USER, mycommand, batch=False,
679 679
                         ask_key=ssh_key_check,
680 680
                         use_cluster_key=True,
681 681
                         strict_host_check=ssh_key_check)
b/lib/cli.py
2488 2488
      # No need to use SSH
2489 2489
      result = utils.RunCmd(cmd)
2490 2490
    else:
2491
      result = self.ssh.Run(node_name, "root", utils.ShellQuoteArgs(cmd))
2491
      result = self.ssh.Run(node_name, constants.SSH_LOGIN_USER,
2492
                            utils.ShellQuoteArgs(cmd))
2492 2493

  
2493 2494
    if result.failed:
2494 2495
      errmsg = ["Failed to run command %s" % result.cmd]
b/lib/client/gnt_cluster.py
538 538
    nodes.append(master_node)
539 539

  
540 540
  for name in nodes:
541
    result = srun.Run(name, "root", command)
541
    result = srun.Run(name, constants.SSH_LOGIN_USER, command)
542 542
    ToStdout("------------------------------------------------")
543 543
    if opts.show_machine_names:
544 544
      for line in result.output.splitlines():
b/lib/constants.py
101 101
CONFD_GROUP = _autoconf.CONFD_GROUP
102 102
NODED_USER = _autoconf.NODED_USER
103 103
NODED_GROUP = _autoconf.NODED_GROUP
104
SSH_LOGIN_USER = _autoconf.SSH_LOGIN_USER
105
SSH_CONSOLE_USER = _autoconf.SSH_CONSOLE_USER
104 106

  
105 107
# cpu pinning separators and constants
106 108
CPU_PINNING_SEP = ":"
......
551 553
IP6_FAMILY = socket.AF_INET6
552 554

  
553 555
TCP_PING_TIMEOUT = 10
554
GANETI_RUNAS = "root"
555 556
DEFAULT_VG = "xenvg"
556 557
DEFAULT_DRBD_HELPER = "/bin/true"
557 558
MIN_VG_SIZE = 20480
b/lib/hypervisor/hv_chroot.py
273 273
    return objects.InstanceConsole(instance=instance.name,
274 274
                                   kind=constants.CONS_SSH,
275 275
                                   host=instance.primary_node,
276
                                   user=constants.GANETI_RUNAS,
276
                                   user=constants.SSH_CONSOLE_USER,
277 277
                                   command=["chroot", root_dir])
278 278

  
279 279
  def Verify(self):
b/lib/hypervisor/hv_kvm.py
1833 1833
      return objects.InstanceConsole(instance=instance.name,
1834 1834
                                     kind=constants.CONS_SSH,
1835 1835
                                     host=instance.primary_node,
1836
                                     user=constants.GANETI_RUNAS,
1836
                                     user=constants.SSH_CONSOLE_USER,
1837 1837
                                     command=cmd)
1838 1838

  
1839 1839
    vnc_bind_address = hvparams[constants.HV_VNC_BIND_ADDRESS]
b/lib/hypervisor/hv_lxc.py
395 395
    return objects.InstanceConsole(instance=instance.name,
396 396
                                   kind=constants.CONS_SSH,
397 397
                                   host=instance.primary_node,
398
                                   user=constants.GANETI_RUNAS,
398
                                   user=constants.SSH_CONSOLE_USER,
399 399
                                   command=["lxc-console", "-n", instance.name])
400 400

  
401 401
  def Verify(self):
b/lib/hypervisor/hv_xen.py
421 421
    return objects.InstanceConsole(instance=instance.name,
422 422
                                   kind=constants.CONS_SSH,
423 423
                                   host=instance.primary_node,
424
                                   user=constants.GANETI_RUNAS,
424
                                   user=constants.SSH_CONSOLE_USER,
425 425
                                   command=[pathutils.XM_CONSOLE_WRAPPER,
426 426
                                            instance.name])
427 427

  
b/lib/ssh.py
271 271
           "else"
272 272
           "  echo \"$GANETI_HOSTNAME\";"
273 273
           "fi")
274
    retval = self.Run(node, "root", cmd, quiet=False)
274
    retval = self.Run(node, constants.SSH_LOGIN_USER, cmd, quiet=False)
275 275

  
276 276
    if retval.failed:
277 277
      msg = "ssh problem"
b/test/ganeti.query_unittest.py
818 818
    consinfo["inst7"] = \
819 819
      objects.InstanceConsole(instance="inst7", kind=constants.CONS_SSH,
820 820
                              host=instbyname["inst7"].primary_node,
821
                              user=constants.GANETI_RUNAS,
821
                              user="root",
822 822
                              command=["hostname"]).ToDict()
823 823

  
824 824
    iqd = query.InstanceQueryData(instances, cluster, disk_usage,
b/tools/setup-ssh
183 183
  @param transport: The paramiko transport instance
184 184

  
185 185
  """
186
  priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
186
  priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.SSH_LOGIN_USER)
187 187
  keyfiles = [
188 188
    (pathutils.SSH_HOST_DSA_PRIV, 0600),
189 189
    (pathutils.SSH_HOST_DSA_PUB, 0644),
......
234 234

  
235 235
  """
236 236
  program = os.path.basename(sys.argv[0])
237
  (default_key, _, _) = ssh.GetUserFiles(constants.SSH_LOGIN_USER)
237 238

  
238 239
  parser = optparse.OptionParser(usage=("%prog [--debug|--verbose] [--force]"
239 240
                                        " <node> <node...>"), prog=program)
240 241
  parser.add_option(cli.DEBUG_OPT)
241 242
  parser.add_option(cli.VERBOSE_OPT)
242 243
  parser.add_option(cli.NOSSH_KEYCHECK_OPT)
243
  default_key = ssh.GetUserFiles(constants.GANETI_RUNAS)[0]
244 244
  parser.add_option(optparse.Option("-f", dest="private_key",
245 245
                                    default=default_key,
246 246
                                    help="The private key to (try to) use for"
......
382 382
  @return: paramiko.util.load_host_keys dict
383 383

  
384 384
  """
385
  homedir = utils.GetHomeDir(constants.GANETI_RUNAS)
385
  homedir = utils.GetHomeDir(constants.SSH_LOGIN_USER)
386 386
  known_hosts = os.path.join(homedir, ".ssh", "known_hosts")
387 387

  
388 388
  try:
......
429 429
  all_keys = LoadPrivateKeys(options)
430 430

  
431 431
  passwd = None
432
  username = constants.GANETI_RUNAS
432
  username = constants.SSH_LOGIN_USER
433 433
  ssh_port = netutils.GetDaemonPort("ssh")
434 434
  host_keys = LoadKnownHosts()
435 435

  

Also available in: Unified diff