URL: https://github.com/freeipa/freeipa/pull/1496
Author: mrizwan93
 Title: #1496: test to check if error is thrown when 0.0.0.0 specified as dns 
forwarder
Action: opened

PR body:
"""
IANA reserved IP address can not be used as a forwarder.
This test checks if ipa server installation throws an error when
0.0.0.0 is specified as forwarder IP address.

related ticket: https://pagure.io/freeipa/issue/6894

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1496/head:pr1496
git checkout pr1496
From e56032a8e43feaa8973d69798eecec2c5d8625a6 Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan Yusuf <myu...@redhat.com>
Date: Thu, 25 Jan 2018 14:21:04 +0530
Subject: [PATCH] IANA reserved IP address can not be used as a forwarder. This
 test checks if ipa server installation throws an error when 0.0.0.0 is
 specified as forwarder IP address.

related ticket: https://pagure.io/freeipa/issue/6894

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
---
 ipatests/test_integration/test_installation.py | 39 ++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index 2031ad5a23..9fde1de780 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -316,3 +316,42 @@ def test_install_master(self):
 
     def test_install_kra(self):
         tasks.install_kra(self.master, first_instance=True)
+
+
+class TestInstallMasterReservedIPasForwarder(IntegrationTest):
+    """IANA reserved IP address can not be used as a forwarder.
+    This test checks if ipa server installation throws an error when
+    0.0.0.0 is specified as forwarder IP address.
+
+    related ticket: https://pagure.io/freeipa/issue/6894 """
+
+    def test_reserved_ip_as_forwarder(self):
+        args = [
+            'ipa-server-install',
+            '-n', self.master.domain.name,
+            '-r', self.master.domain.realm,
+            '-p', self.master.config.dirman_password,
+            '-a', self.master.config.admin_password,
+            '--setup-dns',
+            '--forwarder', '0.0.0.0',
+            '--auto-reverse']
+        cmd = self.master.run_command(args, raiseonerr=False)
+        assert cmd.returncode == 2
+        exp_str = ("error: option --forwarder: invalid IP address 0.0.0.0: "
+                   "cannot use IANA reserved IP address 0.0.0.0")
+        assert exp_str in cmd.stderr_text
+
+        dirman_password = self.master.config.dirman_password
+        admin_password = self.master.config.admin_password
+        ip = "0.0.0.0"
+        server_install_options = ("yes\n\n\n\n"
+            "{dirman_password}\n{dirman_password}"
+            "\n{admin_password}\n{admin_password}\n"
+            "yes\nyes\n{ip}\n".format(dirman_password=dirman_password,
+            admin_password=admin_password,ip=ip))
+
+        cmd = self.master.run_command(['ipa-server-install'],
+                stdin_text=server_install_options, raiseonerr=False)
+        exp_str = ("Invalid IP Address 0.0.0.0: cannot use IANA reserved "
+            "IP address 0.0.0.0")
+        assert exp_str in cmd.stdout_text
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to