mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Verify the user-provided hostname in the server installer
The refactor change 9094dfc
had a slight error where the
user-input provided value in input wasn't being validated. Only
the command-line or the current FQDN was being verified so
if the FQDN was bad any value input by the user was being skipped.
Fixes: https://pagure.io/freeipa/issue/9111
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
parent
50241b36af
commit
8b517e6825
@ -502,7 +502,7 @@ def install_check(installer):
|
|||||||
host_name = host_default
|
host_name = host_default
|
||||||
|
|
||||||
try:
|
try:
|
||||||
verify_fqdn(host_default, options.no_host_dns)
|
verify_fqdn(host_name, options.no_host_dns)
|
||||||
except BadHostError as e:
|
except BadHostError as e:
|
||||||
raise ScriptError(e)
|
raise ScriptError(e)
|
||||||
|
|
||||||
|
@ -1994,3 +1994,33 @@ class TestInstallwithSHA384withRSA(IntegrationTest):
|
|||||||
result = self.master.run_command(cmd_args)
|
result = self.master.run_command(cmd_args)
|
||||||
assert_str = 'Signature Algorithm: sha384WithRSAEncryption'
|
assert_str = 'Signature Algorithm: sha384WithRSAEncryption'
|
||||||
assert assert_str in result.stdout_text
|
assert assert_str in result.stdout_text
|
||||||
|
|
||||||
|
|
||||||
|
class TestHostnameValidator(IntegrationTest):
|
||||||
|
"""Test installer options/validation"""
|
||||||
|
|
||||||
|
num_replicas = 0
|
||||||
|
|
||||||
|
def test_validate_hostname(self):
|
||||||
|
# https://pagure.io/freeipa/issue/9111
|
||||||
|
# Validate the user-provided hostname
|
||||||
|
self.master.run_command(['hostname', 'fedora'])
|
||||||
|
result = tasks.install_master(
|
||||||
|
self.master, unattended=False,
|
||||||
|
stdin_text=self.master.hostname + '\nn\nn\nn\n',
|
||||||
|
extra_args=('--netbios-name', 'EXAMPLE',),
|
||||||
|
raiseonerr=False
|
||||||
|
)
|
||||||
|
|
||||||
|
# Scrape the output for the summary which is only displayed
|
||||||
|
# if the hostname is validated.
|
||||||
|
hostname = None
|
||||||
|
for line in result.stdout_text.split('\n'):
|
||||||
|
print(line)
|
||||||
|
m = re.match(
|
||||||
|
r"Hostname:\s+({})".format(self.master.hostname), line
|
||||||
|
)
|
||||||
|
if m:
|
||||||
|
hostname = m.group(1)
|
||||||
|
break
|
||||||
|
assert hostname == self.master.hostname
|
||||||
|
Loading…
Reference in New Issue
Block a user