RESOLV_WRAPPER(1)

πŸ’– RESOLV_WRAPPER πŸ’–

okay bestie, gather round, because this is the resolv_wrapper(1) manual page and it is lowkey a whole vibe. it's a wrapper for dns name resolving or dns faking, and yes, both of those things are as iconic as they sound. πŸ¦‹


✨ SYNOPSIS ✨

LD_PRELOAD=libresolv_wrapper.so
RESOLV_WRAPPER_CONF="/path/to/resolv.conf" ./myapplication

🌸 DESCRIPTION 🌸

so here's the tea πŸ«–: resolv_wrapper makes it possible, on most UNIX platforms, to contact your own DNS implementation inside your test environment. that's the dream, right? it does require socket_wrapper to be able to contact it though β€” no socket_wrapper, no party. πŸ™ˆ

and if it just doesn't work on some special platform? no worries bestie, the wrapper is able to fake DNS queries and return valid responses to your application. main character energy: it adapts. πŸ’…

  • Redirects name queries to the nameservers specified in your resolv.conf
  • Can fake DNS queries using a simple formatted DNS hosts file

πŸ‘‘ ENVIRONMENT VARIABLES πŸ‘‘

  • RESOLV_WRAPPER_CONF β€” this is how you specify which resolv.conf to use. the format of the resolv.conf file is defined in the manpage resolv.conf(5). rn, only the namserver directive is supported β€” that's it, that's the whole menu, periodt.

so that this works with socket_wrapper, the res_* symbols need to be in a separate libresolv library. if they're part of libc this wont work. and this is literally the case with glibc >= 2.34. 😭

  • RESOLV_WRAPPER_HOSTS β€” this env var is the one you use for faking DNS queries. it must point to a hosts-like text file that specifies fake records for custom queries. the format of the file looks like this:
TYPE    RECORD_NAME RECORD_VALUE

for example:

A       dc.cwrap.org 127.0.0.10
AAAA    dc.cwrap.org fd00::5357:5f0a
CNAME   kerberos.cwrap.org dc.cwrap.org
SRV     _kerberos._tcp.cwrap.org kerberos.cwrap.org 88
URI     _vpn.cwrap.org https://vpn.cwrap.org/VPN
TXT     cwrap.org v=spf1 mx

look at that. immaculate. πŸ”₯

  • RESOLV_WRAPPER_DEBUGLEVEL β€” if you need to see what is going on in resolv_wrapper itself, or you're trying to find a bug, you can enable logging support in resolv_wrapper if you built it with debug symbols. iykyk. 🧚
    • 0 = ERROR
    • 1 = WARNING
    • 2 = DEBUG
    • 3 = TRACE
  • RESOLV_WRAPPER_DISABLE_DEEPBIND β€” this lets you disable deep binding in resolv_wrapper. super useful for running valgrind tools or sanitizers like (address, undefined, thread). slay. ⭐

🌈 EXAMPLE 🌈

the following command would trick kinit(1) into using DNS servers from "./resolv.conf" for Kerberos service resolution:

$ LD_PRELOAD=libresolv_wrapper.so RESOLV_WRAPPER_CONF="./resolv.conf" kinit user@EXAMPLE.COM

not me gaslighting kinit into using a different resolv.conf. it's giving chaos, but make it DNS. πŸ’€


πŸŽ€ AUTHOR πŸŽ€

The Samba Team


and that's the whole page, bestie!! this was RESOLV_WRAPPER(1) from 2021-11-03, brought to you by the lovely humans who ship the resolv_wrapper manual. mwah πŸ’‹ go forth and resolve (or fake) responsibly, ily 🫢