Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_dns does not work on Solaris/Omnios #701

Closed
miesi opened this issue Aug 16, 2021 · 2 comments · Fixed by #729
Closed

check_dns does not work on Solaris/Omnios #701

miesi opened this issue Aug 16, 2021 · 2 comments · Fixed by #729
Assignees
Labels

Comments

@miesi
Copy link

miesi commented Aug 16, 2021

Describe the bug
check_dns does not work for long resource record names. Validation of _acme-challenge.abrechnung.spi-kg.de. fails on SunOS.

To Reproduce
Steps to reproduce the behaviour:

code is

check_result=$($DNS_CHECK_FUNC $DNS_CHECK_OPTIONS TXT "${rr}" "@${ns}" \
                      | grep -i "^${rr}" \
                      | grep 'IN\WTXT'|awk -F'"' '{ print $2}')

this does not work for

dig TXT _acme-challenge.abrechnung.spi-kg.de @ns1123.ui-dns.de | grep -i "^${rr}" 

; <<>> DiG 9.16.13 <<>> TXT _acme-challenge.abrechnung.spi-kg.de @ns1123.ui-dns.de
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8706
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1220
;; QUESTION SECTION:
;_acme-challenge.abrechnung.spi-kg.de. IN TXT

;; ANSWER SECTION:
_acme-challenge.abrechnung.spi-kg.de. 60 IN TXT "AlWd1_kDahAKaVroDRKmvXLPZ6pOOg9yWuAyGOsuB0Q"

;; Query time: 12 msec
;; SERVER: 2001:8d8:fe:53:0:d9a0:507b:100#53(2001:8d8:fe:53:0:d9a0:507b:100)
;; WHEN: Mo. Aug. 16 17:27:20 CEST 2021
;; MSG SIZE  rcvd: 121

I think the \W is only correctly interpreted by GNU grep. The default grep on Solaris/OmniOS is POSIX.1 grep.

using gawk the greps can be avoided and the command looks like this:

dig TXT _acme-challenge.abrechnung.spi-kg.de @ns1123.ui-dns.de | gawk -F'"' '/^'${rr}'.*IN\WTXT.*/{print $2}'

Alternatively check for uname == SunOS and -d /usr/gnu/bin and then PATH=/usr/gnu/bin:$PATH

Operating system (please complete the following information):
uname -a
SunOS serverle-g10p 5.11 omnios-r151038-c078b41acd i86pc i386 i86pc
bash --version
GNU bash, version 5.1.4(1)-release (x86_64-pc-solaris2.11)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

@timkimber timkimber self-assigned this Aug 25, 2021
@timkimber timkimber added the bug label Aug 25, 2021
@timkimber
Copy link
Member

Hi @miesi

Thanks for reporting this, I'll fix

@miesi
Copy link
Author

miesi commented Aug 25, 2021

I sketched something like

 elif [[ ${uname_res} == "SunOS" ]]; then
    os="solaris"
    if [ -d /usr/gnu/bin ]; then
      export PATH=/usr/gnu/bin:$PATH
    else
      echo "required GNU Tools not found, exiting"
      exit 1
    fi

in my fork. If this acceptable, I can create a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants