@@ -, +, @@ --- .../python/diagnostic/plugins/hostname_check.py | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py --- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py +++ a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py @@ -0,0 +1,83 @@ +#!/usr/bin/python2.7 +# coding: utf-8 +# +# Univention Management Console module: +# System Diagnosis UMC module +# +# Copyright 2017 Univention GmbH +# +# http://www.univention.de/ +# +# All rights reserved. +# +# The source code of this program is made available +# under the terms of the GNU Affero General Public License version 3 +# (GNU AGPL V3) as published by the Free Software Foundation. +# +# Binary versions of this program provided by Univention to you as +# well as other copyrighted, protected or trademarked materials like +# Logos, graphics, fonts, specific documentations and configurations, +# cryptographic keys etc. are subject to a license agreement between +# you and Univention and not subject to the GNU AGPL V3. +# +# In the case you use this program under the terms of the GNU AGPL V3, +# the program is provided in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License with the Debian GNU/Linux or Univention distribution in file +# /usr/share/common-licenses/AGPL-3; if not, see +# . + +import re + +import univention.uldap +from univention.management.console.modules.diagnostic import Warning + +from univention.lib.i18n import Translation +_ = Translation('univention-management-console-module-diagnostic').translate + +title = _('Check hostname RFC compliance') +description = _('No uncompliant hostnames found.') +links = [{ + 'name': 'rfc1123', + 'href': _('https://tools.ietf.org/html/rfc1123#section-2'), + 'label': _('RFC 1123 - 2.1 Host Names and Numbers') +}] + +VALID_HOSTNAME = re.compile(r"^(?!-)[A-Z0-9-]{1,63}(? 100755 management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py --- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py +++ a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/plugins/hostname_check.py @@ -40,7 +40,7 @@ from univention.lib.i18n import Translation _ = Translation('univention-management-console-module-diagnostic').translate title = _('Check hostname RFC compliance') -description = _('No uncompliant hostnames found.') +description = _('No non-compliant hostnames found.') links = [{ 'name': 'rfc1123', 'href': _('https://tools.ietf.org/html/rfc1123#section-2'), @@ -58,20 +58,20 @@ def univention_hostnames(): yield hostname -def valid_hostname(hostname): +def compliant_hostname(hostname): return bool(VALID_HOSTNAME.match(hostname)) -def invalid_hostnames(): +def non_compliant_hostnames(): for hostname in univention_hostnames(): - if not valid_hostname(hostname): + if not compliant_hostname(hostname): yield hostname def run(): - hostnames = list(invalid_hostnames()) + hostnames = list(non_compliant_hostnames()) if hostnames: - invalid = _('The following invalid hostnames have been found: {hostnames}.') + invalid = _('The following non-compliant hostnames have been found: {hostnames}.') problem = _('This may lead to DNS problems.') specification = _('Please refer to {rfc1123} for the syntax of host names.') description = [invalid.format(hostnames=', '.join(hostnames)), problem, specification] -- (pe) --- .../umc/python/diagnostic/de.po | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) --- a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po +++ a/management/univention-management-console-module-diagnostic/umc/python/diagnostic/de.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: univention-management-console-module-diagnostic\n" -"Report-Msgid-Bugs-To: packages@univention.de\n" -"POT-Creation-Date: 2016-01-14 12:19+0100\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-08 14:53+0200\n" "PO-Revision-Date: \n" "Last-Translator: Univention GmbH \n" "Language-Team: Univention GmbH \n" @@ -27,6 +27,10 @@ msgstr "" msgid "Adjust to suggested limits" msgstr "An vorgeschlagene Limits anpassen" +#: umc/python/diagnostic/plugins/hostname_check.py:42 +msgid "Check hostname RFC compliance" +msgstr "Überprüfe Rechnernamen auf RFC Konformität" + #: umc/python/diagnostic/plugins/gateway.py:11 msgid "Gateway is not reachable" msgstr "Gateway ist nicht erreichbar" @@ -97,6 +101,10 @@ msgstr "" msgid "Nameserver(s) are not responsive" msgstr "Nameserver sind nicht ansprechbar" +#: umc/python/diagnostic/plugins/hostname_check.py:43 +msgid "No non-compliant hostnames found." +msgstr "Keine nicht konformen Rechnernamen gefunden." + #: umc/python/diagnostic/plugins/package_status.py:11 msgid "Package status corrupt" msgstr "Paketstatus korrupt" @@ -116,6 +124,11 @@ msgstr "" "Bitte sicherstellen, dass die DNS-Einstellungen in {setup:network} korrekt " "konfiguriert sind." +#: umc/python/diagnostic/plugins/hostname_check.py:76 +#, python-brace-format +msgid "Please refer to {rfc1123} for the syntax of host names." +msgstr "Siehe {rfc1123} für die Syntax von Rechnernamen." + #: umc/python/diagnostic/plugins/ssh_connection.py:52 #, python-format msgid "" @@ -129,6 +142,10 @@ msgstr "" msgid "Proxy server failure" msgstr "Proxy-Server-Fehler" +#: umc/python/diagnostic/plugins/hostname_check.py:47 +msgid "RFC 1123 - 2.1 Host Names and Numbers" +msgstr "" + #: umc/python/diagnostic/plugins/ssh_connection.py:16 msgid "SSH connection to UCS server failed!" msgstr "SSH-Verbindung zu anderem UCS Server fehlgeschlagen!" @@ -149,6 +166,12 @@ msgstr "" "Die folgende Liste zeigt die betroffenen entfernten Rechner und den Grund " "für die fehlgeschlagene SSH-Verbindung." +#: umc/python/diagnostic/plugins/hostname_check.py:74 +#, python-brace-format +msgid "The following non-compliant hostnames have been found: {hostnames}." +msgstr "" +"Die folgenden nicht konformen Rechnernamen wurden gefunden: {hostnames}." + #: umc/python/diagnostic/plugins/gateway.py:13 #, python-format msgid "" @@ -249,6 +272,10 @@ msgstr "" "an Samba-Servern unmöglich, Dateioperationen (Kopieren, Verschieben) auf " "Freigaben kann fehlschlagen, uvm.)" +#: umc/python/diagnostic/plugins/hostname_check.py:75 +msgid "This may lead to DNS problems." +msgstr "Dies kann zu DNS Problemen führen." + #: umc/python/diagnostic/plugins/proxy.py:83 #, python-format msgid "" @@ -260,6 +287,10 @@ msgstr "" "dass Authentifikations-Zugangsdaten (falls existierend) korrekt sind und die " "ACL's des Proxy-Servers nicht verbieten, Anfragen an %s zu stellen." +#: umc/python/diagnostic/plugins/hostname_check.py:46 +msgid "https://tools.ietf.org/html/rfc1123#section-2" +msgstr "" + #: umc/python/diagnostic/plugins/package_status.py:28 msgid "some" msgstr "einigen" --