|
|
2e9388 |
From 64dc38643ead5cb00f3f42562a92769de10ef7b5 Mon Sep 17 00:00:00 2001
|
|
|
2e9388 |
From: Jan Cholasta <jcholast@redhat.com>
|
|
|
2e9388 |
Date: Fri, 20 Nov 2015 09:35:43 +0100
|
|
|
2e9388 |
Subject: [PATCH] client install: do not corrupt OpenSSH config with Match
|
|
|
2e9388 |
sections
|
|
|
2e9388 |
|
|
|
2e9388 |
https://fedorahosted.org/freeipa/ticket/5461
|
|
|
2e9388 |
|
|
|
2e9388 |
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
2e9388 |
---
|
|
|
2e9388 |
ipa-client/ipa-install/ipa-client-install | 8 ++++++--
|
|
|
2e9388 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
2e9388 |
|
|
|
2e9388 |
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
|
|
|
2e9388 |
index 793de4fc950ad73b1d88f9ab4bd5178afc8b813d..543c6f027f2312792e7ad33533db8e7c10a3cddb 100755
|
|
|
2e9388 |
--- a/ipa-client/ipa-install/ipa-client-install
|
|
|
2e9388 |
+++ b/ipa-client/ipa-install/ipa-client-install
|
|
|
2e9388 |
@@ -1330,6 +1330,7 @@ def change_ssh_config(filename, changes, sections):
|
|
|
2e9388 |
section_keys = tuple(key.lower() for key in sections)
|
|
|
2e9388 |
|
|
|
2e9388 |
lines = []
|
|
|
2e9388 |
+ in_section = False
|
|
|
2e9388 |
for line in f:
|
|
|
2e9388 |
line = line.rstrip('\n')
|
|
|
2e9388 |
pline = line.strip()
|
|
|
2e9388 |
@@ -1338,7 +1339,7 @@ def change_ssh_config(filename, changes, sections):
|
|
|
2e9388 |
continue
|
|
|
2e9388 |
option = pline.split()[0].lower()
|
|
|
2e9388 |
if option in section_keys:
|
|
|
2e9388 |
- lines.append(line)
|
|
|
2e9388 |
+ in_section = True
|
|
|
2e9388 |
break
|
|
|
2e9388 |
if option in change_keys:
|
|
|
2e9388 |
line = '#' + line
|
|
|
2e9388 |
@@ -1346,6 +1347,9 @@ def change_ssh_config(filename, changes, sections):
|
|
|
2e9388 |
for option, value in changes.items():
|
|
|
2e9388 |
if value is not None:
|
|
|
2e9388 |
lines.append('%s %s' % (option, value))
|
|
|
2e9388 |
+ if in_section:
|
|
|
2e9388 |
+ lines.append('')
|
|
|
2e9388 |
+ lines.append(line)
|
|
|
2e9388 |
for line in f:
|
|
|
2e9388 |
line = line.rstrip('\n')
|
|
|
2e9388 |
lines.append(line)
|
|
|
2e9388 |
@@ -1386,7 +1390,7 @@ def configure_ssh_config(fstore, options):
|
|
|
2e9388 |
changes['VerifyHostKeyDNS'] = 'yes'
|
|
|
2e9388 |
changes['HostKeyAlgorithms'] = 'ssh-rsa,ssh-dss'
|
|
|
2e9388 |
|
|
|
2e9388 |
- change_ssh_config(ssh_config, changes, ['Host'])
|
|
|
2e9388 |
+ change_ssh_config(ssh_config, changes, ['Host', 'Match'])
|
|
|
2e9388 |
root_logger.info('Configured %s', ssh_config)
|
|
|
2e9388 |
|
|
|
2e9388 |
def configure_sshd_config(fstore, options):
|
|
|
2e9388 |
--
|
|
|
2e9388 |
2.4.3
|
|
|
2e9388 |
|