doc: Update documentation for glibc 2.34 changes
[resolv_wrapper.git] / doc / resolv_wrapper.1
1 '\" t
2 .\"     Title: resolv_wrapper
3 .\"    Author: The Samba Team
4 .\" Generator: Asciidoctor 2.0.15
5 .\"      Date: 2021-11-03
6 .\"    Manual: \ \&
7 .\"    Source: \ \&
8 .\"  Language: English
9 .\"
10 .TH "RESOLV_WRAPPER" "1" "2021-11-03" "\ \&" "\ \&"
11 .ie \n(.g .ds Aq \(aq
12 .el       .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 .  mso www.tmac
22 .  am URL
23 .    ad l
24 .  .
25 .  am MTO
26 .    ad l
27 .  .
28 .  LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 resolv_wrapper \- A wrapper for dns name resolving or dns faking.
32 .SH "SYNOPSIS"
33 .sp
34 LD_PRELOAD=libresolv_wrapper.so RESOLV_WRAPPER_CONF="/path/to/resolv.conf" \fB./myapplication\fP
35 .SH "DESCRIPTION"
36 .sp
37 resolv_wrapper makes it possible on most UNIX platforms to contact your own DNS
38 implementation in your test environment. It requires socket_wrapper to be able
39 to contact it.
40 If it doesn\(cqt work on a special platform the wrapper is able to fake DNS queries
41 and return valid responses to your application.
42 .sp
43 .RS 4
44 .ie n \{\
45 \h'-04'\(bu\h'+03'\c
46 .\}
47 .el \{\
48 .  sp -1
49 .  IP \(bu 2.3
50 .\}
51 Redirects name queries to the nameservers specified in your resolv.conf
52 .RE
53 .sp
54 .RS 4
55 .ie n \{\
56 \h'-04'\(bu\h'+03'\c
57 .\}
58 .el \{\
59 .  sp -1
60 .  IP \(bu 2.3
61 .\}
62 Can fake DNS queries using a simple formatted DNS hosts file.
63 .RE
64 .SH "ENVIRONMENT VARIABLES"
65 .sp
66 \fBRESOLV_WRAPPER_CONF\fP
67 .RS 4
68 This is used to specify the resolv.conf to use. The format of the resolv.conf
69 file is defined in the manpage \fIresolv.conf(5)\fP. Currently only the \fBnamserver\fP
70 directive is supported.
71 .RE
72 .sp
73 In order that this works with socket_wrapper. The res_* symbols need to be in
74 a separate libresolv library. If they are part of libc this wont work. This is
75 the case with glibc >= 2.34.
76 .sp
77 \fBRESOLV_WRAPPER_HOSTS\fP
78 .RS 4
79 This environment variable is used for faking DNS queries. It must point to a
80 hosts\-like text file that specifies fake records for custom queries. The
81 format of the file looks like this:
82 .sp
83 .if n .RS 4
84 .nf
85 .fam C
86 TYPE    RECORD_NAME RECORD_VALUE
87 .fam
88 .fi
89 .if n .RE
90 .RE
91 .sp
92 For example:
93 .sp
94 .if n .RS 4
95 .nf
96 .fam C
97 A       dc.cwrap.org 127.0.0.10
98 AAAA    dc.cwrap.org fd00::5357:5f0a
99 CNAME   kerberos.cwrap.org dc.cwrap.org
100 SRV     _kerberos._tcp.cwrap.org kerberos.cwrap.org 88
101 URI     _vpn.cwrap.org https://vpn.cwrap.org/VPN
102 TXT     cwrap.org v=spf1 mx
103 .fam
104 .fi
105 .if n .RE
106 .sp
107 \fBRESOLV_WRAPPER_DEBUGLEVEL\fP
108 .RS 4
109 If you need to see what is going on in resolv_wrapper itself or try to find a
110 bug, you can enable logging support in resolv_wrapper if you built it with
111 debug symbols.
112 .sp
113 .RS 4
114 .ie n \{\
115 \h'-04'\(bu\h'+03'\c
116 .\}
117 .el \{\
118 .  sp -1
119 .  IP \(bu 2.3
120 .\}
121 0 = ERROR
122 .RE
123 .sp
124 .RS 4
125 .ie n \{\
126 \h'-04'\(bu\h'+03'\c
127 .\}
128 .el \{\
129 .  sp -1
130 .  IP \(bu 2.3
131 .\}
132 1 = WARNING
133 .RE
134 .sp
135 .RS 4
136 .ie n \{\
137 \h'-04'\(bu\h'+03'\c
138 .\}
139 .el \{\
140 .  sp -1
141 .  IP \(bu 2.3
142 .\}
143 2 = DEBUG
144 .RE
145 .sp
146 .RS 4
147 .ie n \{\
148 \h'-04'\(bu\h'+03'\c
149 .\}
150 .el \{\
151 .  sp -1
152 .  IP \(bu 2.3
153 .\}
154 3 = TRACE
155 .RE
156 .RE
157 .sp
158 \fBRESOLV_WRAPPER_DISABLE_DEEPBIND\fP
159 .RS 4
160 This allows you to disable deep binding in resolv_wrapper. This is useful for
161 running valgrind tools or sanitizers like (address, undefined, thread).
162 .RE
163 .SH "EXAMPLE"
164 .sp
165 The following command would trick \fIkinit(1)\fP into using DNS servers from "./resolv.conf"
166 for Kerberos service resolution:
167 .sp
168 .if n .RS 4
169 .nf
170 .fam C
171 $ LD_PRELOAD=libresolv_wrapper.so RESOLV_WRAPPER_CONF="./resolv.conf" kinit user@EXAMPLE.COM
172 .fam
173 .fi
174 .if n .RE
175 .SH "AUTHOR"
176 .sp
177 The Samba Team