Back to Cilium

Protocol Documentation

api/v1/standalone-dns-proxy/README.md

1.20.013.6 KB
Original Source
<!-- This file was autogenerated via "make generate-sdp-api", do not edit manually -->

Protocol Documentation

<a name="top"></a>

Table of Contents

<a name="standalone-dns-proxy_standalone-dns-proxy-proto"></a>

<p align="right"><a href="#top">Top</a></p>

standalone-dns-proxy/standalone-dns-proxy.proto

<a name="standalonednsproxy-DNSPolicy"></a>

DNSPolicy

L7 DNS policy specifying which requests are permitted to which DNS server

FieldTypeLabelDescription
source_endpoint_iduint32Endpoint ID of the workload this L7 DNS policy should apply to
dns_patternstringrepeatedAllowed DNS pattern this identity is allowed to resolve.
dns_serversDNSServerrepeatedList of DNS servers to be allowed to connect.

<a name="standalonednsproxy-DNSResponseData"></a>

DNSResponseData

DNSResponseData holds the DNS message details extracted from the response that are needed for access logging on the agent side.

FieldTypeLabelDescription
is_responseboolWhether this is a DNS response (true) or request (false)
cnamesstringrepeatedCNAME records from the DNS response
qtypesuint32repeatedDNS question types
answer_typesuint32repeatedDNS answer record types

<a name="standalonednsproxy-DNSServer"></a>

DNSServer

DNServer identity, port and protocol the requests be allowed to

FieldTypeLabelDescription
dns_server_identityuint32Identity of destination DNS server
dns_server_portuint32
dns_server_protouint32

<a name="standalonednsproxy-EndpointInfo"></a>

EndpointInfo

cilium endpoint ipaddress and ID

FieldTypeLabelDescription
iduint64
ipbytesrepeated

<a name="standalonednsproxy-FQDNMapping"></a>

FQDNMapping

FQDN-IP mapping goalstate sent from SDP to agent

FieldTypeLabelDescription
fqdnstringdns name
record_ipbytesrepeatedList of IPs corresponding to dns name
ttluint32TTL of DNS record
source_identityuint32Identity of the client making the DNS request
source_ipbytesIP address of the client making the DNS request
response_codeuint32DNS Response code as specified in RFC2316
metrics_dataMetricsDataMetrics and access logging data collected by the standalone DNS proxy.

<a name="standalonednsproxy-IdentityToEndpointMapping"></a>

IdentityToEndpointMapping

Cilium Identity ID to IP address mapping

FieldTypeLabelDescription
identityuint32
endpoint_infoEndpointInforepeated

<a name="standalonednsproxy-IdentityToPrefixMapping"></a>

IdentityToPrefixMapping

Cilium Identity ID to IP prefix mapping

FieldTypeLabelDescription
identityuint32
prefixbytesrepeated

<a name="standalonednsproxy-MetricsData"></a>

MetricsData

MetricsData carries the flow context and timing statistics that the agent needs to emit proxy metrics and access log records for DNS events originating from the standalone DNS proxy.

FieldTypeLabelDescription
processing_statsProcessingStatsProxy request processing timing statistics
dns_response_dataDNSResponseDataDNS response metadata extracted from the DNS message
source_portuint32Source port of the endpoint making the DNS request
server_addrstringIP:port of the destination DNS server as "ip:port" string (e.g., "8.8.8.8:53")
server_identityuint32Security identity of the destination DNS server
protocolstringL4 protocol used for the DNS request (e.g., "udp", "tcp")
allowedboolWhether the DNS request was allowed by policy
error_messagestringError message if the DNS request encountered an error (empty if no error)
error_typeProxyErrorTypeStructured error classification for metrics without relying on string matching.

<a name="standalonednsproxy-PolicyState"></a>

PolicyState

L7 DNS policy snapshot of all local endpoints and identity to ip mapping of source and destinatione egress endpoints enforcing fqdn rules.

FieldTypeLabelDescription
egress_l7_dns_policyDNSPolicyrepeated
request_idstringRandom UUID based identifier which will be referenced in ACKs
identity_to_endpoint_mappingIdentityToEndpointMappingrepeatedIdentity to Endpoint mapping for the DNS server and the source identity
identity_to_prefix_mappingIdentityToPrefixMappingrepeatedIdentity to Prefix mapping for the identity

<a name="standalonednsproxy-PolicyStateResponse"></a>

PolicyStateResponse

Ack sent from SDP to Agent on processing DNS policy rules

FieldTypeLabelDescription
responseResponseCode
request_idstringRequest ID for which response is sent to

<a name="standalonednsproxy-ProcessingStats"></a>

ProcessingStats

ProcessingStats carries proxy request timing statistics collected by the standalone DNS proxy. All durations are in nanoseconds. Only fields actually measured by the standalone proxy are included here; agent-side timings (policy generation, dataplane, cache updates, etc.) are measured directly by the agent after receiving the gRPC message.

FieldTypeLabelDescription
total_time_nsint64
processing_time_nsint64
upstream_time_nsint64
semaphore_acquire_time_nsint64
policy_check_time_nsint64

<a name="standalonednsproxy-UpdateMappingResponse"></a>

UpdateMappingResponse

Ack returned by cilium agent to SDP on receiving FQDN-IP mapping update

FieldTypeLabelDescription
responseResponseCode

<a name="standalonednsproxy-ProxyErrorType"></a>

ProxyErrorType

ProxyErrorType classifies the error that occurred during DNS proxy processing. The agent uses this to reconstruct the correct error type for metrics reporting (metric label, semaphore-rejected counter, etc.) without relying on Go error-type information that is lost during gRPC serialization.

NameNumberDescription
PROXY_ERROR_TYPE_NONE0No error occurred.
PROXY_ERROR_TYPE_PROXY1A generic proxy-side error (e.g. failed to parse, forward, etc.).
PROXY_ERROR_TYPE_TIMEOUT2An upstream network timeout (e.g. DNS server did not respond).
PROXY_ERROR_TYPE_SEMAPHORE_FAILED3The DNS proxy concurrency semaphore could not be acquired immediately.
PROXY_ERROR_TYPE_SEMAPHORE_TIMED_OUT4The DNS proxy concurrency semaphore timed out during the grace period.

<a name="standalonednsproxy-ResponseCode"></a>

ResponseCode

Response code returned by RPC methods.

NameNumberDescription
RESPONSE_CODE_UNSPECIFIED0
RESPONSE_CODE_NO_ERROR1
RESPONSE_CODE_FORMAT_ERROR2
RESPONSE_CODE_SERVER_FAILURE3
RESPONSE_CODE_NOT_IMPLEMENTED4
RESPONSE_CODE_ERROR_INVALID_ARGUMENT6Invalid argument passed to the RPC method
RESPONSE_CODE_ERROR_ENDPOINT_NOT_FOUND5Endpoint not found for the given IP
RESPONSE_CODE_REFUSED7

<a name="standalonednsproxy-FQDNData"></a>

FQDNData

Cilium agent runs the FQDNData service and Standalone DNS proxy connects to it to get the DNS Policy rules. Standalone DNS proxy sends FQDN-IP mapping updates to Cilium Agent. CFP: https://github.com/cilium/design-cfps/pull/54

Method NameRequest TypeResponse TypeDescription
StreamPolicyStatePolicyStateResponse streamPolicyState streamStreamPolicyState is used by the Standalone DNS proxy to get the current policy state. Policy state includes the DNS policies and the identity to IP mapping. Cilium agent will stream DNS policies state to Standalone DNS proxy. In case of any client side error, cilium agent will cancel the stream and SDP will have to re-subscribe. In case of any server side error, cilium agent will send an error response and SDP will have to re-subscribe.
UpdateMappingRequestFQDNMappingUpdateMappingResponseUpdateMappingRequest is used by the Standalone DNS proxy to update ciliium agent with FQDN-IP mappings which in turn update L3/L4 policy maps. In case of any error, SDP will either retry the connection if the error is server side or will error out. Note: In case of concurrent updates, since this is called in a callback(notifyDNSMsg) from the DNS server it follows the same behavior as the inbuilt dns proxy in cilium.

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
<a name="double" /> doubledoubledoublefloatfloat64doublefloatFloat
<a name="float" /> floatfloatfloatfloatfloat32floatfloatFloat
<a name="int32" /> int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
<a name="int64" /> int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
<a name="uint32" /> uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
<a name="uint64" /> uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
<a name="sint32" /> sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
<a name="sint64" /> sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
<a name="fixed32" /> fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
<a name="fixed64" /> fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
<a name="sfixed32" /> sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
<a name="sfixed64" /> sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
<a name="bool" /> boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
<a name="string" /> stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
<a name="bytes" /> bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)