module ietf-http-server {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-http-server";
prefix https;
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 AAAA: YANG Groupings for TCP Clients and TCP Servers";
}
import ietf-tls-server {
prefix tlss;
reference
"RFC BBBB: YANG Groupings for TLS Clients and TLS Servers";
}
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web:
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) 2020 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 Simplified
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 2020-07-08 {
description
"Initial version";
reference
"RFC GGGG: YANG Groupings for HTTP Clients and HTTP Servers";
}
// Features
feature client-auth-config-supported {
description
"Indicates that the configuration for how to authenticate
clients can be configured herein, as opposed to in an
application specific location. That is, to support the
consuming data models that prefer to place client
authentication with client definitions, rather then
in a data model principally concerned with configuring
the transport.";
}
feature basic-auth {
description
"The 'basic-auth' feature indicates that the server
may be configured authenticate users using the 'basic'
HTTP authentication scheme.";
reference
"RFC 7617: The 'Basic' HTTP Authentication Scheme";
}
feature tcp-supported {
description
"Indicates that the server supports HTTP/TCP.";
}
feature tls-supported {
description
"Indicates that the server supports HTTP/TLS.";
}
// Groupings
grouping http-server-grouping {
description
"A reusable grouping for configuring an HTTP server.
Note that this grouping uses fairly typical descendent
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-config-supported";
nacm:default-deny-write;
presence
"Indicates that HTTP based client authentication is
supported (i.e., the server will request that the
HTTP client send authenticate when needed). This
is needed as some HTTP-based protocols may only
support, e.g., TLS-level client authentication.";
description
"Specifies how the HTTP server can authenticate HTTP
clients.";
container users {
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 {
description
"The authentication type.";
container basic {
if-feature "basic-auth";
leaf user-id {
type string;
description
"The user-id for the authenticating client.";
}
leaf password {
nacm:default-deny-write;
type ianach:crypt-hash;
description
"The password for the authenticating client.";
}
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
"A wrapper around the TCP parameters to avoid
name collisions.";
uses "tcps:tcp-server-grouping";
}
container http-server-parameters {
description
"A wrapper around the HTTP parameters to avoid
name collisions.";
uses http-server-grouping;
}
}
}
case tls {
if-feature tls-supported;
container tls {
description
"Container for TLS-based HTTP protocols.";
container tcp-server-parameters {
description
"A wrapper around the TCP parameters to avoid
name collisions.";
uses "tcps:tcp-server-grouping";
}
container tls-server-parameters {
description
"A wrapper around the TLS parameters to avoid
name collisions.";
uses "tlss:tls-server-grouping";
}
container http-server-parameters {
description
"A wrapper around the HTTP parameters to avoid
name collisions.";
uses http-server-grouping;
}
}
}
}
}
}