diff options
Diffstat (limited to 'man/coredns-rewrite.7')
-rw-r--r-- | man/coredns-rewrite.7 | 72 |
1 files changed, 56 insertions, 16 deletions
diff --git a/man/coredns-rewrite.7 b/man/coredns-rewrite.7 index 752041603..16f300448 100644 --- a/man/coredns-rewrite.7 +++ b/man/coredns-rewrite.7 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "COREDNS\-REWRITE" "7" "August 2018" "CoreDNS" "CoreDNS plugins" +.TH "COREDNS\-REWRITE" "7" "October 2018" "CoreDNS" "CoreDNS plugins" . .SH "NAME" \fIrewrite\fR \- performs internal message rewriting\. @@ -10,7 +10,7 @@ Rewrites are invisible to the client\. There are simple rewrites (fast) and complex rewrites (slower), but they\'re powerful enough to accommodate most dynamic back\-end applications\. . .SH "SYNTAX" -A simplified/easy to digest syntax for \fIrewrite\fR is\.\.\. ~~~ rewrite [continue|stop] FIELD FROM TO ~~~ +A simplified/easy to digest syntax for \fIrewrite\fR is\.\.\. ~~~ rewrite [continue|stop] FIELD [FROM TO|FROM TTL] ~~~ . .IP "\(bu" 4 \fBFIELD\fR indicates what part of the request/response is being re\-written\. @@ -30,15 +30,21 @@ A simplified/easy to digest syntax for \fIrewrite\fR is\.\.\. ~~~ rewrite [conti .IP "\(bu" 4 \fBedns0\fR \- an EDNS0 option can be appended to the request as described below in the \fBEDNS0 Options\fR section\. . +.IP "\(bu" 4 +\fBttl\fR \- the TTL value in the \fIresponse\fR is rewritten\. +. .IP "" 0 . .IP "\(bu" 4 -\fBFROM\fR is the name or type to match +\fBFROM\fR is the name (exact, suffix, prefix, substring, or regex) or type to match . .IP "\(bu" 4 \fBTO\fR is the destination name or type to rewrite to . +.IP "\(bu" 4 +\fBTTL\fR is the number of seconds to set the TTL value to +. .IP "" 0 . .P @@ -131,6 +137,19 @@ Re\-written Request Name: \fBftp\.service\.us\-west\-1\.consul\fR . .IP "" 0 . +.P +The following example rewrites the \fBschmoogle\.com\fR suffix to \fBgoogle\.com\fR\. +. +.IP "" 4 +. +.nf + +rewrite name suffix \.schmoogle\.com\. \.google\.com\. +. +.fi +. +.IP "" 0 +. .SS "RESPONSE REWRITES" When re\-writing incoming DNS requests\' names, CoreDNS re\-writes the \fBQUESTION SECTION\fR section of the requests\. It may be necessary to re\-write the \fBANSWER SECTION\fR of the requests, because some DNS resolvers would treat the mismatch between \fBQUESTION SECTION\fR and \fBANSWER SECTION\fR as a man\-in\-the\-middle attack (MITM)\. . @@ -254,6 +273,40 @@ rewrite [continue|stop] name regex STRING STRING answer name STRING STRING . .IP "" 0 . +.SS "TTL FIELD REWRITES" +At times, the need for rewriting TTL value could arise\. For example, a DNS server may prevent caching by setting TTL as low as zero (\fB0\fR)\. An administrator may want to increase the TTL to prevent caching, e\.g\. to 15 seconds\. +. +.P +In the below example, the TTL in the answers for \fBcoredns\.rocks\fR domain are being set to \fB15\fR: +. +.IP "" 4 +. +.nf + + rewrite continue { + ttl regex (\.*)\e\.coredns\e\.rocks 15 + } +. +.fi +. +.IP "" 0 +. +.P +By the same token, an administrator may use this feature to force caching by setting TTL value really low\. +. +.P +The syntax for the TTL rewrite rule is as follows\. The meaning of \fBexact|prefix|suffix|substring|regex\fR is the same as with the name rewrite rules\. +. +.IP "" 4 +. +.nf + +rewrite [continue|stop] ttl [exact|prefix|suffix|substring|regex] STRING SECONDS +. +.fi +. +.IP "" 0 +. .SH "EDNS0 OPTIONS" Using FIELD edns0, you can set, append, or replace specific EDNS0 options on the request\. . @@ -328,19 +381,6 @@ rewrite edns0 local set 0xffee {client_ip} .IP "" 0 . .P -The following example rewrites the \fBschmoogle\.com\fR suffix to \fBgoogle\.com\fR\. -. -.IP "" 4 -. -.nf - -rewrite name suffix \.schmoogle\.com\. \.google\.com\. -. -.fi -. -.IP "" 0 -. -.P The following example uses metadata and an imaginary "some\-plugin" that would provide "some\-label" as metadata information\. . .IP "" 4 |