<?xml version="1.0"?>

<!--SSH configuration -->

<interfaceDefinition>
  <node name="service">
    <children>
      <node name="ssh" owner="${vyos_conf_scripts_dir}/ssh.py">
        <properties>
          <help>Secure SHell (SSH) protocol</help>
          <priority>500</priority>
        </properties>
        <children>
          <node name="access-control">
            <properties>
              <help>SSH user/group access controls. Directives are processed in this: deny-users, allow-users, deny-groups and allow-groups</help>
            </properties>
            <children>
              <node name="allow">
                <children>
                  <leafNode name="group">
                    <properties>
                      <help>Login is allowed for users whose primary or supplementary group matches</help>
                      <multi/>
                    </properties>
                  </leafNode>
                  <leafNode name="user">
                    <properties>
                      <help>Login is allowed only for user names that match</help>
                      <multi/>
                    </properties>
                  </leafNode>
                </children>
              </node>
              <node name="deny">
                <children>
                  <leafNode name="group">
                    <properties>
                      <help>Login is disallowed for users whose primary or supplementary group matches</help>
                      <multi/>
                    </properties>
                  </leafNode>
                  <leafNode name="user">
                    <properties>
                      <help>Login is disallowed for user names that match</help>
                      <multi/>
                    </properties>
                  </leafNode>
                </children>
              </node>
            </children>
          </node>
          <leafNode name="allow-root">
            <properties>
              <help>Enable root login over ssh</help>
              <valueless/>
            </properties>
          </leafNode>
          <leafNode name="ciphers">
            <properties>
              <help>Specifies allowed Ciphers</help>
              <completionHelp>
                <script>ssh -Q cipher | tr '\n' ' '</script>
              </completionHelp>
              <multi/>
            </properties>
          </leafNode>
          <leafNode name="disable-host-validation">
            <properties>
              <help>Don't validate the remote host name with DNS</help>
              <valueless/>
            </properties>
          </leafNode>
          <leafNode name="disable-password-authentication">
            <properties>
              <help>Don't allow unknown user to login with password</help>
              <valueless/>
            </properties>
          </leafNode>
          <leafNode name="key-exchange">
            <properties>
              <help>Specifies available KEX (Key Exchange) algorithms</help>
              <completionHelp>
                <script>ssh -Q kex | tr '\n' ' '</script>
              </completionHelp>
              <multi/>
            </properties>
          </leafNode>
          <leafNode name="listen-address">
            <properties>
              <help>Local addresses SSH service should listen on</help>
              <valueHelp>
                <format>ipv4</format>
                <description>IP address to listen for incoming connections</description>
              </valueHelp>
              <valueHelp>
                <format>ipv6</format>
                <description>IPv6 address to listen for incoming connections</description>
              </valueHelp>
              <multi/>
              <constraint>
                <validator name="ipv4-address"/>
                <validator name="ipv6-address"/>
              </constraint>
            </properties>
          </leafNode>
          <leafNode name="loglevel">
            <properties>
              <help>Log level</help>
              <valueHelp>
                <format>QUIET</format>
                <description>stay silent</description>
              </valueHelp>
              <valueHelp>
                <format>FATAL</format>
                <description>log fatals only</description>
              </valueHelp>
              <valueHelp>
                <format>ERROR</format>
                <description>log errors and fatals only</description>
              </valueHelp>
              <valueHelp>
                <format>INFO</format>
                <description>default log level</description>
              </valueHelp>
              <valueHelp>
                <format>VERBOSE</format>
                <description>enable logging of failed login attempts</description>
              </valueHelp>
            </properties>
          </leafNode>
          <leafNode name="mac">
            <properties>
                <help>Specifies available MAC (message authentication code) algorithms</help>
              <completionHelp>
                <script>ssh -Q mac | tr '\n' ' '</script>
              </completionHelp>
              <multi/>
            </properties>
          </leafNode>
          <leafNode name="port">
            <properties>
              <help>Port for SSH service</help>
              <valueHelp>
                <format>1-65535</format>
                <description>Numeric IP port</description>
              </valueHelp>
              <constraint>
                <validator name="numeric" argument="--range 1-65535"/>
              </constraint>
            </properties>
          </leafNode>
        </children>
      </node>
    </children>
  </node>
</interfaceDefinition>