Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 297085 Details for
Bug 433515
Server setup script should validate hostname and A / PTR dns records
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
make sure /etc/hosts is sane
freeipa-722-host.patch (text/plain), 2.91 KB, created by
Rob Crittenden
on 2008-03-06 18:18:26 UTC
(
hide
)
Description:
make sure /etc/hosts is sane
Filename:
MIME Type:
Creator:
Rob Crittenden
Created:
2008-03-06 18:18:26 UTC
Size:
2.91 KB
patch
obsolete
># HG changeset patch ># User Rob Crittenden <rcritten@redhat.com> ># Date 1204827448 18000 ># Node ID 93e5e41a155c08879e6dbcf66a0a319e4330ec11 ># Parent 9d221748fc650b3559e66a32fdd5f4b84b3e29de >Verify that the hostname is correct in /etc/hosts >Fix an issue with reverse lookups on x86_64 >Don't ignore exceptions when getting the hostname from the user > >433515 > >diff -r 9d221748fc65 -r 93e5e41a155c ipa-server/ipa-install/ipa-server-install >--- a/ipa-server/ipa-install/ipa-server-install Wed Mar 05 16:33:12 2008 -0500 >+++ b/ipa-server/ipa-install/ipa-server-install Thu Mar 06 13:17:28 2008 -0500 >@@ -123,9 +123,8 @@ def read_host_name(host_default): > host_name = host_input > try: > verify_fqdn(host_name) >- except: >- host_name = "" >- continue >+ except Exception, e: >+ raise e > else: > host_ok = True > return host_name >diff -r 9d221748fc65 -r 93e5e41a155c ipa-server/ipaserver/installutils.py >--- a/ipa-server/ipaserver/installutils.py Wed Mar 05 16:33:12 2008 -0500 >+++ b/ipa-server/ipaserver/installutils.py Thu Mar 06 13:17:28 2008 -0500 >@@ -41,6 +41,11 @@ def get_fqdn(): > except: > fqdn = "" > return fqdn >+ >+def reverse_ip(ipaddr): >+ i = ipaddr.split('.') >+ i.reverse() >+ return '.'.join(i) > > def verify_fqdn(host_name): > if len(host_name.split(".")) < 2 or host_name == "localhost.localdomain": >@@ -54,7 +59,8 @@ def verify_fqdn(host_name): > # Compare the forward and reverse > forward = rs[0].dns_name > >- addr = socket.inet_ntoa(struct.pack('L',rs[0].rdata.address)) >+ addr = socket.inet_ntoa(struct.pack('=L',rs[0].rdata.address)) >+ ipaddr = reverse_ip(addr) > addr = addr + ".in-addr.arpa." > > rs = dnsclient.query(addr, dnsclient.DNS_C_IN, dnsclient.DNS_T_PTR) >@@ -64,6 +70,31 @@ def verify_fqdn(host_name): > > if forward != reverse: > raise RuntimeError("The DNS forward record %s does not match the reverse lookup %s" % (forward, reverse)) >+ >+ # Look in /etc/hosts for this IP >+ try: >+ fd = open("/etc/hosts", "r") >+ except: >+ raise RuntimeError("Unable to open /etc/hosts for reading. Check file permissions.") >+ >+ p = re.compile('([a-zA-Z0-9\.:]+)\s+([a-zA-Z0-9\.\-]+)') >+ while True: >+ line = fd.readline() >+ if not line: break >+ if len(line) > 0 and line[0] == "#": >+ continue >+ m = p.match(line) >+ hname = None >+ try: >+ if m.group(1) == ipaddr: >+ hname = m.group(2) + "." >+ except: >+ pass >+ if hname and hname != forward: >+ fd.close() >+ raise RuntimeError("The IP address in /etc/hosts defines the hostname as '%s' but DNS says it is '%s'. The fully-qualified hostname needs to appear on the list first in /etc/hosts" % (hname, forward)) >+ >+ fd.close() > > def port_available(port): > """Try to bind to a port on the wildcard host
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 433515
:
296678
| 297085