module ietf-http-server { yang-version 1.1; namespace "urn:ietf:params:xml:ns:yang:ietf-http-server"; prefix https; import ietf-yang-types { prefix yang; reference "RFC 6991: Common YANG Data Types"; } import iana-crypt-hash { prefix ianach; reference "RFC 7317: A YANG Data Model for System Management"; } import ietf-netconf-acm { prefix nacm; reference "RFC 8341: Network Configuration Access Control Model"; } import ietf-tcp-server { prefix tcps; reference "RFC DDDD: YANG Groupings for TCP Clients and TCP Servers"; } import ietf-tls-server { prefix tlss; reference "RFC FFFF: YANG Groupings for TLS Clients and TLS Servers"; } organization "IETF NETCONF (Network Configuration) Working Group"; contact "WG Web: https://datatracker.ietf.org/wg/netconf WG List: NETCONF WG list Author: Kent Watsen "; description "This module defines reusable groupings for HTTP servers that can be used as a basis for specific HTTP server instances. Copyright (c) 2024 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Revised BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info). This version of this YANG module is part of RFC GGGG (https://www.rfc-editor.org/info/rfcGGGG); see the RFC itself for full legal notices. The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document are to be interpreted as described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, they appear in all capitals, as shown here."; revision 2024-02-08 { description "Initial version"; reference "RFC GGGG: YANG Groupings for HTTP Clients and HTTP Servers"; } // Features feature client-auth-supported { description "Indicates that the server supports configuring HTTP servers to authenticate HTTP clients. HTTP-level client authentication may not be needed when client authentication is expected to occur only at another protocol layer (e.g., TLS)."; } feature local-users-supported { if-feature "client-auth-supported"; description "Indicates that the server supports configuring client authentication with its own database of local users, as opposed to in an application specific location."; } feature basic-auth { if-feature "local-users-supported"; description "Indicates that the server supports configuring 'basic' authentication credentials in its local user database."; reference "RFC 7617: The 'Basic' HTTP Authentication Scheme"; } feature tcp-supported { description "Indicates that the server supports configuring HTTP servers to listen for HTTP 1.1/2.0 connections over TCP."; reference "RFC 9110: HTTP Semantics"; } feature tls-supported { description "Indicates that the server supports configuring HTTP servers to listen for HTTP 1.1/2.0 connections over TLS."; reference "RFC 9110: HTTP Semantics"; } // Groupings grouping http-server-grouping { description "A reusable grouping for configuring an HTTP server. Note that this grouping uses fairly typical descendant node names such that a stack of 'uses' statements will have name conflicts. It is intended that the consuming data model will resolve the issue (e.g., by wrapping the 'uses' statement in a container called 'http-server-parameters'). This model purposely does not do this itself so as to provide maximum flexibility to consuming models."; leaf server-name { nacm:default-deny-write; type string; description "The value of the 'Server' header field. If not set, then underlying software's default value is used. Set to the empty string to disable."; } container client-authentication { if-feature "client-auth-supported"; nacm:default-deny-write; presence "Indicates that HTTP based client authentication is configured. This statement is present so the mandatory descendant nodes do not imply that this node must be configured."; description "Configures how the HTTP server can authenticate HTTP clients. The HTTP server will request that the HTTP client send authentication when needed."; container users { if-feature "local-users-supported"; description "A list of locally configured users."; list user { key "user-id"; description "The list of local users configured on this device."; leaf user-id { type string; description "The user-id for the authenticating client."; } choice auth-type { mandatory true; description "The authentication type."; case basic { container basic { if-feature "basic-auth"; leaf username { type string; description "The username for the authenticating HTTP client."; } container password { description "The hashed password the HTTP server uses to authenticate this user. A user is authenticated if the hash of the supplied password matches this value."; leaf hashed-password { type ianach:crypt-hash; description "The password for the authenticating client."; } leaf last-modified { type yang:date-and-time; config false; description "Identifies when the password was last set."; } } description "The 'basic' HTTP scheme credentials."; reference "RFC 7617: The 'Basic' HTTP Authentication Scheme"; } } } } } } // container client-authentication } // grouping http-server-grouping grouping http-server-stack-grouping { description "A grouping that defines common HTTP-based protocol stacks."; choice transport { mandatory true; description "Choice amongst various transports type. TCP, with and without TLS are defined here, with 'feature' statements so that they may be disabled. Other transports MAY be augmented in as 'case' statements by future efforts."; case tcp { if-feature "tcp-supported"; container tcp { description "Container for TCP-based HTTP protocols."; container tcp-server-parameters { description "TCP-level server parameters to listen for HTTP connections."; uses tcps:tcp-server-grouping; } container http-server-parameters { description "HTTP-level server parameters to listen for HTTP connections."; uses http-server-grouping; } } } case tls { if-feature "tls-supported"; container tls { description "Container for TLS-based HTTP protocols."; container tcp-server-parameters { description "TCP-level server parameters to listen for HTTPS connections."; uses tcps:tcp-server-grouping; } container tls-server-parameters { description "TLS-level server parameters to listen for HTTPS connections."; uses tlss:tls-server-grouping; } container http-server-parameters { description "HTTP-level server parameters to listen for HTTPS connections."; uses http-server-grouping; } } } } } // http-server-stack-grouping }