Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ietf-ssh-server YANG #441

Closed
4 of 6 tasks
troglobit opened this issue May 13, 2024 · 7 comments · Fixed by #838
Closed
4 of 6 tasks

Add support for ietf-ssh-server YANG #441

troglobit opened this issue May 13, 2024 · 7 comments · Fixed by #838
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@troglobit
Copy link
Contributor

troglobit commented May 13, 2024

The recently ratified IETF RFC model for SSH provides an server grouping that can be included in the Infix services model.

Scope:

  • Enable disable service
  • Change listening port
  • ListenAddress1
  • Host key similar to NETCONF "genkey" setup

Future:

  • Bind to a single interface
  • Add support for certificates

Note: netopeer2-server use libssh for access on port 830. This should probably be handled by the NETCONF model and not the SSH server model.

Footnotes

  1. which may also require sysctl setting net.ipv4.ip_nonlocal_bind=1, e.g., if binding to a dynamic address like 169.254.1.1, in very specific conditions -- one customer setup uses this for predictive addresses in a local setup with containers.

@troglobit troglobit added the enhancement New feature or request label May 13, 2024
@mattiaswal
Copy link
Contributor

mattiaswal commented May 14, 2024

Blocked by #434, that includes the latest SSH model

@mattiaswal
Copy link
Contributor

The netconf model just includes parts of the ssh model for SSH transport. @troglobit

@troglobit troglobit moved this to Todo in Infix & C:o May 14, 2024
@troglobit
Copy link
Contributor Author

troglobit commented Aug 30, 2024

Looks like it might be better to just extend infix-services.yang.

Update Oct 1: extend infix-services.yang with a uses ... from ietf-ssh-server.yang, with some heavy redactions (deviations).

@troglobit troglobit added triage Pending investigation & classification (CCB) and removed triage Pending investigation & classification (CCB) labels Oct 1, 2024
@troglobit troglobit added this to the Infix v24.10 milestone Oct 1, 2024
@troglobit troglobit modified the milestones: Infix v24.10, Infix v24.11 Oct 9, 2024
@troglobit troglobit modified the milestones: Infix v24.11, Infix v24.12 Nov 12, 2024
@troglobit
Copy link
Contributor Author

Reduced scope (enable/disable + custom port) re-targeted for v24.11.

@mattiaswal
Copy link
Contributor

mattiaswal commented Nov 21, 2024

Proposed model (infix-services):

module infix-services {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:infix-services";
  prefix infix-svc;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 6991: Common YANG Data Types";
  }
  import ietf-crypto-types {
    prefix ct;
    reference
      "RFC AAAA: YANG Data Types and Groupings for Cryptography";
  }

  import ietf-ssh-server {
    prefix ssh-srv;
  }

  import ietf-ssh-common {
    prefix ssh-common;
  }

  import ietf-tcp-server {
    prefix tcp-srv;
  }
  import ietf-keystore {
    prefix ks;
  }

  organization "KernelKit";
  contact      "kernelkit@googlegroups.com";
  description  "Infix services, generic.";

  revision 2024-06-08 {
    description "Add support for RESTCONF enable/disable as a web service.";
    reference "internal";
  }
  revision 2024-05-30 {
    description "Add support for RESTCONF enable/disable as a web service.";
    reference "internal";
  }
  revision 2024-04-08 {
    description "Initial support for web services.";
    reference "internal";
  }
  revision 2023-10-16 {
    description "Drop SSDP support, mDNS-SD is now available in Windows 10.";
    reference "internal";
  }
  revision 2023-08-22 {
    description "Initial revision, add SSDP and mDNS-SD enable/disable only.";
    reference "internal";
  }
....
  container ssh {
    leaf enabled {
      default true;
      description "Disable or enable SSH daemon";
      type boolean;
    }
    choice host-key-type {
      description
        "The type of host key being specified";
      container public-key {
        description
          "A locally-defined or referenced asymmetric key pair
           to be used for the SSH server's host key.";
        reference
          "RFC 9642: A YANG Data Model for a Keystore";
        uses ks:inline-or-keystore-asymmetric-key-grouping {
          refine "inline-or-keystore/inline/inline-definition" {
            must 'not(public-key-format) or derived-from-or-self'
              + '(public-key-format, "ct:ssh-public-key-format")';
          }
          refine "inline-or-keystore/central-keystore/"
            + "central-keystore-reference" {
            must 'not(deref(.)/../ks:public-key-format) or '
              + 'derived-from-or-self(deref(.)/../ks:public-'
              + 'key-format, "ct:ssh-public-key-format")';
          }
        }
      }
    }
    list listen {
      key "address port";
      leaf address {
        type inet:ip-address;
        description
          "The local IP address to listen on for incoming
           SSH client connections.  INADDR_ANY (0.0.0.0) or
           INADDR6_ANY (0:0:0:0:0:0:0:0 a.k.a. ::) MUST be
           used when the server is to listen on all IPv4 or
           IPv6 addresses, respectively.";
      }
      leaf port {
        type inet:port-number;
        default "22";
        description "Local port for SSH daemon to listen to.

                     The standard port for SSH is 22";
      }
    }
  }
......
}

@troglobit
Copy link
Contributor Author

Very nice! A few comments:

  1. Please move the description first in the leaf definitions, I've tried to be consistent with that in other models
  2. Could you post the -f tree view as well?

@mattiaswal
Copy link
Contributor

module: infix-services
+--rw mdns
| +--rw enabled? boolean
+--rw ssh
| +--rw enabled? boolean
| +--rw hostkey* ks:asymmetric-key-ref
| +--rw listen* [name]
| +--rw name string
| +--rw address? inet:ip-address
| +--rw port? inet:port-number
+--rw web
+--rw enabled? boolean
+--rw console
| +--rw enabled? boolean
+--rw netbrowse
| +--rw enabled? boolean
+--rw restconf
+--rw enabled? boolean

@mattiaswal mattiaswal mentioned this issue Nov 28, 2024
17 tasks
axkar added a commit that referenced this issue Dec 4, 2024
mattiaswal pushed a commit that referenced this issue Dec 4, 2024
mattiaswal added a commit that referenced this issue Dec 4, 2024
@troglobit troglobit moved this from Todo to In progress in Infix & C:o Dec 5, 2024
mattiaswal added a commit that referenced this issue Dec 5, 2024
mattiaswal added a commit that referenced this issue Dec 9, 2024
mattiaswal added a commit that referenced this issue Dec 10, 2024
mattiaswal added a commit that referenced this issue Dec 10, 2024
mattiaswal added a commit that referenced this issue Dec 11, 2024
mattiaswal added a commit that referenced this issue Dec 11, 2024
mattiaswal added a commit that referenced this issue Dec 11, 2024
mattiaswal added a commit that referenced this issue Dec 19, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Infix & C:o Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants