URL: https://github.com/freeipa/freeipa/pull/1513
Author: Tiboris
 Title: #1513: [Backport][ipa-4-5] test to check if error is thrown when 
0.0.0.0 specified as dns forwarder
Action: opened

PR body:
"""
This PR was opened automatically because PR #1496 was pushed to master and 
backport to ipa-4-5 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1513/head:pr1513
git checkout pr1513
From d5addd141bc2951279b098690df8a97dadb02e76 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 | 42 ++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index b13c9996b9..ac6bdda19e 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -312,3 +312,45 @@ def test_install_master(self):
 
     def test_install_kra(self):
         tasks.install_kra(self.master, first_instance=True)
+
+
+class TestInstallMasterReservedIPasForwarder(IntegrationTest):
+    """Test to check if IANA reserved IP doesn't accepted as DNS forwarder
+
+    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
+
+        server_install_options = (
+                "yes\n\n\n\n"
+                "{dm_pass}\n{dm_pass}"
+                "\n{admin_pass}\n{admin_pass}\n"
+                "yes\nyes\n0.0.0.0\n".format(
+                    dm_pass=self.master.config.dirman_password,
+                    admin_pass=self.master.config.admin_password))
+
+        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