]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/dnsmessage.proto
Sync with https://github.com/PowerDNS/dnsmessage
[thirdparty/pdns.git] / pdns / dnsmessage.proto
CommitLineData
12471842 1/*
d47fca73 2 * This file describes the message format used by the protobuf logging feature in PowerDNS and dnsdist.
12471842 3 *
18594f4d 4 * MIT License
d47fca73 5 *
18594f4d
O
6 * Copyright (c) 2016-now PowerDNS.COM B.V. and its contributors.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in all
16 * copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
12471842 25 */
2e14d4bb
RG
26syntax = "proto2";
27
d8c19b98
RG
28message PBDNSMessage {
29 enum Type {
18594f4d
O
30 DNSQueryType = 1; // Query received by the service
31 DNSResponseType = 2; // Response returned by the service
32 DNSOutgoingQueryType = 3; // Query sent out by the service to a remote server
33 DNSIncomingResponseType = 4; // Response returned by the remote server
d8c19b98
RG
34 }
35 enum SocketFamily {
0caa1aa8
RG
36 INET = 1; // IPv4 (RFC 791)
37 INET6 = 2; // IPv6 (RFC 2460)
d8c19b98
RG
38 }
39 enum SocketProtocol {
0caa1aa8
RG
40 UDP = 1; // User Datagram Protocol (RFC 768)
41 TCP = 2; // Transmission Control Protocol (RFC 793)
d8c19b98 42 }
f3da83fe 43 enum PolicyType {
18594f4d 44 UNKNOWN = 1; // No RPZ policy applied, or unknown type
f3da83fe
RG
45 QNAME = 2; // Policy matched on the QName
46 CLIENTIP = 3; // Policy matched on the client IP
47 RESPONSEIP = 4; // Policy matched on one of the IPs contained in the answer
48 NSDNAME = 5; // Policy matched on the name of one nameserver involved
49 NSIP = 6; // Policy matched on the IP of one nameserver involved
50 }
12152c8c
ND
51 enum PolicyKind {
52 NoAction = 1; // No action taken
53 Drop = 2; // https://tools.ietf.org/html/draft-vixie-dns-rpz-04 3.4
54 NXDOMAIN = 3; // https://tools.ietf.org/html/draft-vixie-dns-rpz-04 3.1
55 NODATA = 4; // https://tools.ietf.org/html/draft-vixie-dns-rpz-04 3.2
56 Truncate= 5; // https://tools.ietf.org/html/draft-vixie-dns-rpz-04 3.5
57 Custom = 6; // https://tools.ietf.org/html/draft-vixie-dns-rpz-04 3.6
58 }
2e627150
O
59 enum VState {
60 Indeterminate = 1;
61 Insecure = 2;
62 Secure = 3;
2232e616
O
63 BogusNoValidDNSKEY = 4;
64 BogusInvalidDenial = 5;
65 BogusUnableToGetDSs = 6;
66 BogusUnableToGetDNSKEYs = 7;
67 BogusSelfSignedDS = 8;
68 BogusNoRRSIG = 9;
69 BogusNoValidRRSIG = 10;
70 BogusMissingNegativeIndication = 11;
71 BogusSignatureNotYetValid = 12;
72 BogusSignatureExpired = 13;
73 BogusUnsupportedDNSKEYAlgo = 14;
74 BogusUnsupportedDSDigestType = 15;
75 BogusNoZoneKeyBitSet = 16;
76 BogusRevokedDNSKEY = 17;
77 BogusInvalidDNSKEYProtocol = 18;
2e627150 78 }
18594f4d 79 required Type type = 1; // Type of event
0caa1aa8 80 optional bytes messageId = 2; // UUID, shared by the query and the response
c165308b 81 optional bytes serverIdentity = 3; // ID of the server emitting the protobuf message
d8c19b98
RG
82 optional SocketFamily socketFamily = 4;
83 optional SocketProtocol socketProtocol = 5;
18594f4d
O
84 optional bytes from = 6; // DNS requestor (client) as 4 (IPv4) or 16 (IPv6) raw bytes in network byte order
85 optional bytes to = 7; // DNS responder (server) as 4 (IPv4) or 16 (IPv6) raw bytes in network byte order
0caa1aa8
RG
86 optional uint64 inBytes = 8; // Size of the query or response on the wire
87 optional uint32 timeSec = 9; // Time of message reception (seconds since epoch)
88 optional uint32 timeUsec = 10; // Time of message reception (additional micro-seconds)
89 optional uint32 id = 11; // ID of the query/response as found in the DNS header
d8c19b98
RG
90
91 message DNSQuestion {
18594f4d
O
92 optional string qName = 1; // Fully qualified DNS name (with trailing dot)
93 optional uint32 qType = 2; // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
94 optional uint32 qClass = 3; // Typically 1 (IN), see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
d8c19b98 95 }
18594f4d 96 optional DNSQuestion question = 12; // DNS query received from client
d8c19b98
RG
97
98 message DNSResponse {
18594f4d
O
99 // See exportTypes in https://docs.powerdns.com/recursor/lua-config/protobuf.html#protobufServer
100 // for the list of supported resource record types.
d8c19b98 101 message DNSRR {
18594f4d
O
102 optional string name = 1; // Fully qualified DNS name (with trailing dot)
103 optional uint32 type = 2; // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
104 optional uint32 class = 3; // Typically 1 (IN), see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
105 optional uint32 ttl = 4; // TTL in seconds
106 optional bytes rdata = 5; // raw address bytes in network byte order for A & AAAA; text representation for others, with fully qualified (trailing dot) domain names
d6399006 107 optional bool udr = 6; // True if this is the first time this RR has been seen for this question
aa7929a3 108 }
57f8413e 109 optional uint32 rcode = 1; // DNS Response code, or 65536 for a network error including a timeout
18594f4d 110 repeated DNSRR rrs = 2; // DNS resource records in response
0caa1aa8 111 optional string appliedPolicy = 3; // Filtering policy (RPZ or Lua) applied
18594f4d 112 repeated string tags = 4; // Additional tags applied
0caa1aa8
RG
113 optional uint32 queryTimeSec = 5; // Time of the corresponding query reception (seconds since epoch)
114 optional uint32 queryTimeUsec = 6; // Time of the corresponding query reception (additional micro-seconds)
f3da83fe 115 optional PolicyType appliedPolicyType = 7; // Type of the filtering policy (RPZ or Lua) applied
b5892cfa 116 optional string appliedPolicyTrigger = 8; // The RPZ trigger
7f60444b 117 optional string appliedPolicyHit = 9; // The value (qname or IP) that caused the hit
12152c8c 118 optional PolicyKind appliedPolicyKind = 10; // The Kind (RPZ action) applied by the hit
b090b7c4 119 optional VState validationState = 11; // The DNSSEC Validation State
d8c19b98
RG
120 }
121
122 optional DNSResponse response = 13;
18594f4d 123 optional bytes originalRequestorSubnet = 14; // EDNS Client Subnet value (4 or 16 raw bytes in network byte order)
0caa1aa8 124 optional string requestorId = 15; // Username of the requestor
4898a348 125 optional bytes initialRequestId = 16; // UUID of the incoming query that initiated this outgoing query or incoming response
18594f4d 126 optional bytes deviceId = 17; // Device ID of the requestor (could be mac address IP address or e.g. IMEI, format implementation dependent)
d6399006 127 optional bool newlyObservedDomain = 18; // True if the domain has not been seen before
0a6a45c8 128 optional string deviceName = 19; // Device name of the requestor
36de3330
RG
129 optional uint32 fromPort = 20; // Source port of the DNS query (client)
130 optional uint32 toPort = 21; // Destination port of the DNS query (server)
634dd69e
CHB
131
132 message MetaValue {
133 repeated string stringVal = 1;
134 repeated int64 intVal = 2;
135 }
136
137 message Meta {
138 required string key = 1; // MUST be unique, so if you have multiple values they must be aggregated into on Meta
139 required MetaValue value = 2;
140 }
141 repeated Meta meta = 22; // Arbitrary meta-data - to be used in future rather than adding new fields all the time
4cdc62f5 142
65ee1fc5 143 // The well known EventTrace event numbers
4cdc62f5 144 enum EventType {
ade7a5e6 145 // Range 0..99: Generic events
f5b1d3bb 146 CustomEvent = 0; // A custom event
ade7a5e6 147 ReqRecv = 1; // A request was received
65ee1fc5 148 PCacheCheck = 2; // A packet cache check was initiated or completed; value: bool cacheHit
ade7a5e6
O
149 AnswerSent = 3; // An answer was sent to the client
150
151 // Range 100: Recursor events
152 SyncRes = 100; // Recursor Syncres main function has started or completed; value: int rcode
153 LuaGetTag = 101; // Events below mark start or end of Lua hook calls; value: return value of hook
154 LuaGetTagFFI = 102;
155 LuaIPFilter = 103;
156 LuaPreRPZ = 104;
157 LuaPreResolve = 105;
158 LuaPreOutQuery = 106;
159 LuaPostResolve = 107;
160 LuaNoData = 108;
161 LuaNXDomain = 109;
4cdc62f5 162 }
65ee1fc5 163
4cdc62f5 164 message Event {
7705bec9 165 required int64 ts = 1; // Timestamp in ns relative to time of creation of event trace data structure
65ee1fc5
O
166 required EventType event = 2; // Type of event
167 required bool start = 3; // true for "start" events, false for "completed" events
168 optional bool boolVal = 4; // Below are optional values associated with events
4cdc62f5
O
169 optional int64 intVal = 5;
170 optional string stringVal = 6;
171 optional bytes bytesVal = 7;
f5b1d3bb 172 optional string custom = 8; // The name of the event for custom events
4cdc62f5
O
173 }
174 repeated Event trace = 23;
d8c19b98 175}
a46fcb5e
PD
176
177message PBDNSMessageList {
178 repeated PBDNSMessage msg = 1;
179}