[Freeipa-devel] [freeipa PR#294][synchronized] client, platform: Use paths.SSH* instead of get_config_dir().

2017-01-04 Thread tjaalton
   URL: https://github.com/freeipa/freeipa/pull/294
Author: tjaalton
 Title: #294: client, platform: Use paths.SSH* instead of get_config_dir().
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/294/head:pr294
git checkout pr294
From c680bf07a8d17da44274fa810db7e728b14f0228 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen 
Date: Thu, 1 Dec 2016 14:08:58 +0200
Subject: [PATCH] client, platform: Use paths.SSH* instead of get_config_dir().

---
 ipaclient/install/client.py| 43 --
 ipaplatform/base/paths.py  |  1 +
 ipaplatform/base/services.py   |  3 ---
 ipaplatform/redhat/services.py |  7 ---
 4 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 7bd8404..08fbb84 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -845,13 +845,9 @@ def configure_sssd_conf(
 sssdconfig.new_config()
 domain = sssdconfig.new_domain(cli_domain)
 
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
-
 if (
-(options.conf_ssh and file_exists(ssh_config)) or
-(options.conf_sshd and file_exists(sshd_config))
+(options.conf_ssh and file_exists(paths.SSH_CONFIG)) or
+(options.conf_sshd and file_exists(paths.SSHD_CONFIG))
 ):
 try:
 sssdconfig.new_service('ssh')
@@ -1006,14 +1002,12 @@ def change_ssh_config(filename, changes, sections):
 
 
 def configure_ssh_config(fstore, options):
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-
-if not file_exists(ssh_config):
-root_logger.info("%s not found, skipping configuration", ssh_config)
+if not file_exists(paths.SSH_CONFIG):
+root_logger.info("%s not found, skipping configuration",
+ paths.SSH_CONFIG)
 return
 
-fstore.backup_file(ssh_config)
+fstore.backup_file(paths.SSH_CONFIG)
 
 changes = {'PubkeyAuthentication': 'yes'}
 
@@ -1025,20 +1019,19 @@ def configure_ssh_config(fstore, options):
 changes['VerifyHostKeyDNS'] = 'yes'
 changes['HostKeyAlgorithms'] = 'ssh-rsa,ssh-dss'
 
-change_ssh_config(ssh_config, changes, ['Host', 'Match'])
-root_logger.info('Configured %s', ssh_config)
+change_ssh_config(paths.SSH_CONFIG, changes, ['Host', 'Match'])
+root_logger.info('Configured %s', paths.SSH_CONFIG)
 
 
 def configure_sshd_config(fstore, options):
 sshd = services.knownservices.sshd
-ssh_dir = sshd.get_config_dir()
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
 
-if not file_exists(sshd_config):
-root_logger.info("%s not found, skipping configuration", sshd_config)
+if not file_exists(paths.SSHD_CONFIG):
+root_logger.info("%s not found, skipping configuration",
+ paths.SSHD_CONFIG)
 return
 
-fstore.backup_file(sshd_config)
+fstore.backup_file(paths.SSHD_CONFIG)
 
 changes = {
 'PubkeyAuthentication': 'yes',
@@ -1085,8 +1078,8 @@ def configure_sshd_config(fstore, options):
 "loading authorized user keys. Public key authentication of "
 "IPA users will not be available.")
 
-change_ssh_config(sshd_config, changes, ['Match'])
-root_logger.info('Configured %s', sshd_config)
+change_ssh_config(paths.SSHD_CONFIG, changes, ['Match'])
+root_logger.info('Configured %s', paths.SSHD_CONFIG)
 
 if sshd.is_running():
 try:
@@ -2786,8 +2779,7 @@ def _install(options):
 configure_certmonger(fstore, subject_base, cli_realm, hostname,
  options, ca_enabled)
 
-update_ssh_keys(hostname, services.knownservices.sshd.get_config_dir(),
-options.create_sshfp)
+update_ssh_keys(hostname, paths.SSH_CONFIG_DIR, options.create_sshfp)
 
 try:
 os.remove(CCACHE_FILE)
@@ -3114,10 +3106,7 @@ def uninstall(options):
 was_sshd_configured = False
 if fstore.has_files():
 was_sssd_installed = fstore.has_file(paths.SSSD_CONF)
-
-sshd_config = os.path.join(
-services.knownservices.sshd.get_config_dir(), "sshd_config")
-was_sshd_configured = fstore.has_file(sshd_config)
+was_sshd_configured = fstore.has_file(paths.SSHD_CONFIG)
 try:
 tasks.restore_pre_ipa_client_configuration(fstore,
statestore,
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9942fc1..ab8b7ec 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -101,6 +101,7 @@ class BasePathNamespace(object):
 SAMBA_KEYTAB = "/etc/samba/samba.keytab"
 SMB_CONF = "/etc/samba/smb.conf"
 LIMITS_CO

[Freeipa-devel] [freeipa PR#294][synchronized] client, platform: Use paths.SSH* instead of get_config_dir().

2016-12-01 Thread tjaalton
   URL: https://github.com/freeipa/freeipa/pull/294
Author: tjaalton
 Title: #294: client, platform: Use paths.SSH* instead of get_config_dir().
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/294/head:pr294
git checkout pr294
From 35c72f00d5153c40c5c7e2aa99a5043c65b69940 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen 
Date: Thu, 1 Dec 2016 14:08:58 +0200
Subject: [PATCH] client, platform: Use paths.SSH* instead of get_config_dir().

---
 ipaclient/install/client.py| 43 --
 ipaplatform/base/paths.py  |  1 +
 ipaplatform/base/services.py   |  3 ---
 ipaplatform/redhat/services.py |  7 ---
 4 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 7bd8404..08fbb84 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -845,13 +845,9 @@ def configure_sssd_conf(
 sssdconfig.new_config()
 domain = sssdconfig.new_domain(cli_domain)
 
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
-
 if (
-(options.conf_ssh and file_exists(ssh_config)) or
-(options.conf_sshd and file_exists(sshd_config))
+(options.conf_ssh and file_exists(paths.SSH_CONFIG)) or
+(options.conf_sshd and file_exists(paths.SSHD_CONFIG))
 ):
 try:
 sssdconfig.new_service('ssh')
@@ -1006,14 +1002,12 @@ def change_ssh_config(filename, changes, sections):
 
 
 def configure_ssh_config(fstore, options):
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-
-if not file_exists(ssh_config):
-root_logger.info("%s not found, skipping configuration", ssh_config)
+if not file_exists(paths.SSH_CONFIG):
+root_logger.info("%s not found, skipping configuration",
+ paths.SSH_CONFIG)
 return
 
-fstore.backup_file(ssh_config)
+fstore.backup_file(paths.SSH_CONFIG)
 
 changes = {'PubkeyAuthentication': 'yes'}
 
@@ -1025,20 +1019,19 @@ def configure_ssh_config(fstore, options):
 changes['VerifyHostKeyDNS'] = 'yes'
 changes['HostKeyAlgorithms'] = 'ssh-rsa,ssh-dss'
 
-change_ssh_config(ssh_config, changes, ['Host', 'Match'])
-root_logger.info('Configured %s', ssh_config)
+change_ssh_config(paths.SSH_CONFIG, changes, ['Host', 'Match'])
+root_logger.info('Configured %s', paths.SSH_CONFIG)
 
 
 def configure_sshd_config(fstore, options):
 sshd = services.knownservices.sshd
-ssh_dir = sshd.get_config_dir()
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
 
-if not file_exists(sshd_config):
-root_logger.info("%s not found, skipping configuration", sshd_config)
+if not file_exists(paths.SSHD_CONFIG):
+root_logger.info("%s not found, skipping configuration",
+ paths.SSHD_CONFIG)
 return
 
-fstore.backup_file(sshd_config)
+fstore.backup_file(paths.SSHD_CONFIG)
 
 changes = {
 'PubkeyAuthentication': 'yes',
@@ -1085,8 +1078,8 @@ def configure_sshd_config(fstore, options):
 "loading authorized user keys. Public key authentication of "
 "IPA users will not be available.")
 
-change_ssh_config(sshd_config, changes, ['Match'])
-root_logger.info('Configured %s', sshd_config)
+change_ssh_config(paths.SSHD_CONFIG, changes, ['Match'])
+root_logger.info('Configured %s', paths.SSHD_CONFIG)
 
 if sshd.is_running():
 try:
@@ -2786,8 +2779,7 @@ def _install(options):
 configure_certmonger(fstore, subject_base, cli_realm, hostname,
  options, ca_enabled)
 
-update_ssh_keys(hostname, services.knownservices.sshd.get_config_dir(),
-options.create_sshfp)
+update_ssh_keys(hostname, paths.SSH_CONFIG_DIR, options.create_sshfp)
 
 try:
 os.remove(CCACHE_FILE)
@@ -3114,10 +3106,7 @@ def uninstall(options):
 was_sshd_configured = False
 if fstore.has_files():
 was_sssd_installed = fstore.has_file(paths.SSSD_CONF)
-
-sshd_config = os.path.join(
-services.knownservices.sshd.get_config_dir(), "sshd_config")
-was_sshd_configured = fstore.has_file(sshd_config)
+was_sshd_configured = fstore.has_file(paths.SSHD_CONFIG)
 try:
 tasks.restore_pre_ipa_client_configuration(fstore,
statestore,
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9942fc1..9942fa8 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -102,6 +102,7 @@ class BasePathNamespace(object):
 SMB_CONF = "/etc/samba/smb.conf"
 LIMITS_CONF = "/etc/security/limits.conf"
 SSH_CONF

[Freeipa-devel] [freeipa PR#294][synchronized] client, platform: Use paths.SSH* instead of get_config_dir().

2016-12-01 Thread tjaalton
   URL: https://github.com/freeipa/freeipa/pull/294
Author: tjaalton
 Title: #294: client, platform: Use paths.SSH* instead of get_config_dir().
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/294/head:pr294
git checkout pr294
From ec8abf458f4dee061b3a1abeb0aa24167399a607 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen 
Date: Thu, 1 Dec 2016 14:08:58 +0200
Subject: [PATCH] client, platform: Use paths.SSH* instead of get_config_dir().

---
 ipaclient/install/client.py| 41 ++---
 ipaplatform/base/paths.py  |  1 +
 ipaplatform/base/services.py   |  3 ---
 ipaplatform/redhat/services.py |  7 ---
 4 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 7bd8404..557a7da 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -845,13 +845,9 @@ def configure_sssd_conf(
 sssdconfig.new_config()
 domain = sssdconfig.new_domain(cli_domain)
 
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
-
 if (
-(options.conf_ssh and file_exists(ssh_config)) or
-(options.conf_sshd and file_exists(sshd_config))
+(options.conf_ssh and file_exists(paths.SSH_CONFIG)) or
+(options.conf_sshd and file_exists(paths.SSHD_CONFIG))
 ):
 try:
 sssdconfig.new_service('ssh')
@@ -1006,14 +1002,11 @@ def change_ssh_config(filename, changes, sections):
 
 
 def configure_ssh_config(fstore, options):
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-
-if not file_exists(ssh_config):
-root_logger.info("%s not found, skipping configuration", ssh_config)
+if not file_exists(paths.SSH_CONFIG):
+root_logger.info("%s not found, skipping configuration", paths.SSH_CONFIG)
 return
 
-fstore.backup_file(ssh_config)
+fstore.backup_file(paths.SSH_CONFIG)
 
 changes = {'PubkeyAuthentication': 'yes'}
 
@@ -1025,20 +1018,18 @@ def configure_ssh_config(fstore, options):
 changes['VerifyHostKeyDNS'] = 'yes'
 changes['HostKeyAlgorithms'] = 'ssh-rsa,ssh-dss'
 
-change_ssh_config(ssh_config, changes, ['Host', 'Match'])
-root_logger.info('Configured %s', ssh_config)
+change_ssh_config(paths.SSH_CONFIG, changes, ['Host', 'Match'])
+root_logger.info('Configured %s', paths.SSH_CONFIG)
 
 
 def configure_sshd_config(fstore, options):
 sshd = services.knownservices.sshd
-ssh_dir = sshd.get_config_dir()
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
 
-if not file_exists(sshd_config):
-root_logger.info("%s not found, skipping configuration", sshd_config)
+if not file_exists(paths.SSHD_CONFIG):
+root_logger.info("%s not found, skipping configuration", paths.SSHD_CONFIG)
 return
 
-fstore.backup_file(sshd_config)
+fstore.backup_file(paths.SSHD_CONFIG)
 
 changes = {
 'PubkeyAuthentication': 'yes',
@@ -1085,8 +1076,8 @@ def configure_sshd_config(fstore, options):
 "loading authorized user keys. Public key authentication of "
 "IPA users will not be available.")
 
-change_ssh_config(sshd_config, changes, ['Match'])
-root_logger.info('Configured %s', sshd_config)
+change_ssh_config(paths.SSHD_CONFIG, changes, ['Match'])
+root_logger.info('Configured %s', paths.SSHD_CONFIG)
 
 if sshd.is_running():
 try:
@@ -2786,8 +2777,7 @@ def _install(options):
 configure_certmonger(fstore, subject_base, cli_realm, hostname,
  options, ca_enabled)
 
-update_ssh_keys(hostname, services.knownservices.sshd.get_config_dir(),
-options.create_sshfp)
+update_ssh_keys(hostname, paths.SSH_CONFIG_DIR, options.create_sshfp)
 
 try:
 os.remove(CCACHE_FILE)
@@ -3114,10 +3104,7 @@ def uninstall(options):
 was_sshd_configured = False
 if fstore.has_files():
 was_sssd_installed = fstore.has_file(paths.SSSD_CONF)
-
-sshd_config = os.path.join(
-services.knownservices.sshd.get_config_dir(), "sshd_config")
-was_sshd_configured = fstore.has_file(sshd_config)
+was_sshd_configured = fstore.has_file(paths.SSHD_CONFIG)
 try:
 tasks.restore_pre_ipa_client_configuration(fstore,
statestore,
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9942fc1..9942fa8 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -102,6 +102,7 @@ class BasePathNamespace(object):
 SMB_CONF = "/etc/samba/smb.conf"
 LIMITS_CONF = "/etc/security/limits.conf"
 SSH_CONFIG = "/etc/ssh/ssh_config"
+SSH_CONFIG_DIR = "/et

[Freeipa-devel] [freeipa PR#294][synchronized] client, platform: Use paths.SSH* instead of get_config_dir().

2016-12-01 Thread tjaalton
   URL: https://github.com/freeipa/freeipa/pull/294
Author: tjaalton
 Title: #294: client, platform: Use paths.SSH* instead of get_config_dir().
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/294/head:pr294
git checkout pr294
From d18baf950db0023860894367a438735bf3bc4c49 Mon Sep 17 00:00:00 2001
From: Timo Aaltonen 
Date: Thu, 1 Dec 2016 14:08:58 +0200
Subject: [PATCH] client, platform: Use paths.SSH* instead of get_config_dir().

---
 ipaclient/install/client.py| 42 ++
 ipaplatform/base/paths.py  |  1 +
 ipaplatform/base/services.py   |  3 ---
 ipaplatform/redhat/services.py |  7 ---
 4 files changed, 15 insertions(+), 38 deletions(-)

diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 7bd8404..181fade 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -845,13 +845,9 @@ def configure_sssd_conf(
 sssdconfig.new_config()
 domain = sssdconfig.new_domain(cli_domain)
 
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
-
 if (
-(options.conf_ssh and file_exists(ssh_config)) or
-(options.conf_sshd and file_exists(sshd_config))
+(options.conf_ssh and file_exists(paths.SSH_CONFIG)) or
+(options.conf_sshd and file_exists(paths.SSHD_CONFIG))
 ):
 try:
 sssdconfig.new_service('ssh')
@@ -1006,14 +1002,11 @@ def change_ssh_config(filename, changes, sections):
 
 
 def configure_ssh_config(fstore, options):
-ssh_dir = services.knownservices.sshd.get_config_dir()
-ssh_config = os.path.join(ssh_dir, 'ssh_config')
-
-if not file_exists(ssh_config):
-root_logger.info("%s not found, skipping configuration", ssh_config)
+if not file_exists(paths.SSH_CONFIG):
+root_logger.info("%s not found, skipping configuration", paths.SSH_CONFIG)
 return
 
-fstore.backup_file(ssh_config)
+fstore.backup_file(paths.SSH_CONFIG)
 
 changes = {'PubkeyAuthentication': 'yes'}
 
@@ -1025,20 +1018,17 @@ def configure_ssh_config(fstore, options):
 changes['VerifyHostKeyDNS'] = 'yes'
 changes['HostKeyAlgorithms'] = 'ssh-rsa,ssh-dss'
 
-change_ssh_config(ssh_config, changes, ['Host', 'Match'])
-root_logger.info('Configured %s', ssh_config)
+change_ssh_config(paths.SSH_CONFIG, changes, ['Host', 'Match'])
+root_logger.info('Configured %s', paths.SSH_CONFIG)
 
 
 def configure_sshd_config(fstore, options):
 sshd = services.knownservices.sshd
-ssh_dir = sshd.get_config_dir()
-sshd_config = os.path.join(ssh_dir, 'sshd_config')
-
-if not file_exists(sshd_config):
-root_logger.info("%s not found, skipping configuration", sshd_config)
+if not file_exists(paths.SSHD_CONFIG):
+root_logger.info("%s not found, skipping configuration", paths.SSHD_CONFIG)
 return
 
-fstore.backup_file(sshd_config)
+fstore.backup_file(paths.SSHD_CONFIG)
 
 changes = {
 'PubkeyAuthentication': 'yes',
@@ -1085,8 +1075,8 @@ def configure_sshd_config(fstore, options):
 "loading authorized user keys. Public key authentication of "
 "IPA users will not be available.")
 
-change_ssh_config(sshd_config, changes, ['Match'])
-root_logger.info('Configured %s', sshd_config)
+change_ssh_config(paths.SSHD_CONFIG, changes, ['Match'])
+root_logger.info('Configured %s', paths.SSHD_CONFIG)
 
 if sshd.is_running():
 try:
@@ -2786,8 +2776,7 @@ def _install(options):
 configure_certmonger(fstore, subject_base, cli_realm, hostname,
  options, ca_enabled)
 
-update_ssh_keys(hostname, services.knownservices.sshd.get_config_dir(),
-options.create_sshfp)
+update_ssh_keys(hostname, paths.SSH_CONFIG_DIR, options.create_sshfp)
 
 try:
 os.remove(CCACHE_FILE)
@@ -3114,10 +3103,7 @@ def uninstall(options):
 was_sshd_configured = False
 if fstore.has_files():
 was_sssd_installed = fstore.has_file(paths.SSSD_CONF)
-
-sshd_config = os.path.join(
-services.knownservices.sshd.get_config_dir(), "sshd_config")
-was_sshd_configured = fstore.has_file(sshd_config)
+was_sshd_configured = fstore.has_file(paths.SSHD_CONFIG)
 try:
 tasks.restore_pre_ipa_client_configuration(fstore,
statestore,
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9942fc1..9942fa8 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -102,6 +102,7 @@ class BasePathNamespace(object):
 SMB_CONF = "/etc/samba/smb.conf"
 LIMITS_CONF = "/etc/security/limits.conf"
 SSH_CONFIG = "/etc/ssh/ssh_config"
+SSH_CONFIG_DIR = "/e