![]() |
![]()
| ![]() |
![]()
OpenXPKI::Template::Plugin::CheckDNSHow to usePlugin for Template::Toolkit to check FQDNs against DNS. You can pass a timeout in seconds and a comma seperated list of servers to the "USE" statement: [% USE CheckDNS(timeout = 10, servers = '1.2.3.4, 5.6.7.8') %] validExpects the fqdn to check as argument. Returns the fqdn wrapped into a span element with css class dns-failed, dns-valid, dns-timeout or dns-skipped. Isolated hostnames or strings that do not appear to be a valid fqdn are not checked and directly set to dns-failed, domains starting with an asterisk (wildcard domains) are set to dns-skipped. You can pass strings to append to the fqdn for failure, success or timeout as second/third/fourth argument. Timeout falls back to the string given for failed if it was not given (can be turned off by setting an empty value). Example: CheckDNS.valid(fqdn,'(FAILED!)','(ok)') Valid: <span class="dns-valid">www.openxpki.org (ok)</span> Invalid: <span class="dns-failed">www.openxpki.org (FAILED!)</span> resolveExpects the fqdn to check as argument. The result of the dns lookup is appended to the fqdn using brackets. By default, the first result is taken, which might result in a CNAME. Add a true value as second argument to do a recursive lookup up to the first A-Record. If the lookup failed, "???" is printed instead of the result. The combined string is wrapped into a span element with css class dns-valid or dns-failed. Example: CheckDNS.resolve(fqdn) Valid: <span class="dns-valid">www.openxpki.org (1.2.3.4)</span> Valid: <span class="dns-valid">www2.openxpki.org (www.openxpki.org)</span> Invalid: <span class="dns-failed">www.openxpki.org (???)</span>
|