SshConstants.java

  1. /*
  2.  * Copyright (C) 2018, 2020 Thomas Wolf <thomas.wolf@paranor.ch> and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.transport;

  11. import org.eclipse.jgit.lib.Constants;

  12. /**
  13.  * Constants relating to ssh.
  14.  *
  15.  * @since 5.2
  16.  */
  17. @SuppressWarnings("nls")
  18. public final class SshConstants {

  19.     private SshConstants() {
  20.         // No instances, please.
  21.     }

  22.     /** IANA assigned port number for ssh. */
  23.     public static final int SSH_DEFAULT_PORT = 22;

  24.     /** URI scheme for ssh. */
  25.     public static final String SSH_SCHEME = "ssh";

  26.     /** URI scheme for sftp. */
  27.     public static final String SFTP_SCHEME = "sftp";

  28.     /** Default name for a ssh directory. */
  29.     public static final String SSH_DIR = ".ssh";

  30.     /** Name of the ssh config file. */
  31.     public static final String CONFIG = Constants.CONFIG;

  32.     /** Default name of the user "known hosts" file. */
  33.     public static final String KNOWN_HOSTS = "known_hosts";

  34.     // Config file keys

  35.     /** Key in an ssh config file. */
  36.     public static final String BATCH_MODE = "BatchMode";

  37.     /** Key in an ssh config file. */
  38.     public static final String CANONICAL_DOMAINS = "CanonicalDomains";

  39.     /** Key in an ssh config file. */
  40.     public static final String CERTIFICATE_FILE = "CertificateFile";

  41.     /** Key in an ssh config file. */
  42.     public static final String CIPHERS = "Ciphers";

  43.     /** Key in an ssh config file. */
  44.     public static final String COMPRESSION = "Compression";

  45.     /** Key in an ssh config file. */
  46.     public static final String CONNECTION_ATTEMPTS = "ConnectionAttempts";

  47.     /** Key in an ssh config file. */
  48.     public static final String CONTROL_PATH = "ControlPath";

  49.     /** Key in an ssh config file. */
  50.     public static final String GLOBAL_KNOWN_HOSTS_FILE = "GlobalKnownHostsFile";

  51.     /**
  52.      * Key in an ssh config file.
  53.      *
  54.      * @since 5.5
  55.      */
  56.     public static final String HASH_KNOWN_HOSTS = "HashKnownHosts";

  57.     /** Key in an ssh config file. */
  58.     public static final String HOST = "Host";

  59.     /** Key in an ssh config file. */
  60.     public static final String HOST_KEY_ALGORITHMS = "HostKeyAlgorithms";

  61.     /** Key in an ssh config file. */
  62.     public static final String HOST_NAME = "HostName";

  63.     /** Key in an ssh config file. */
  64.     public static final String IDENTITIES_ONLY = "IdentitiesOnly";

  65.     /** Key in an ssh config file. */
  66.     public static final String IDENTITY_AGENT = "IdentityAgent";

  67.     /** Key in an ssh config file. */
  68.     public static final String IDENTITY_FILE = "IdentityFile";

  69.     /** Key in an ssh config file. */
  70.     public static final String KEX_ALGORITHMS = "KexAlgorithms";

  71.     /** Key in an ssh config file. */
  72.     public static final String LOCAL_COMMAND = "LocalCommand";

  73.     /** Key in an ssh config file. */
  74.     public static final String LOCAL_FORWARD = "LocalForward";

  75.     /** Key in an ssh config file. */
  76.     public static final String MACS = "MACs";

  77.     /** Key in an ssh config file. */
  78.     public static final String NUMBER_OF_PASSWORD_PROMPTS = "NumberOfPasswordPrompts";

  79.     /** Key in an ssh config file. */
  80.     public static final String PORT = "Port";

  81.     /** Key in an ssh config file. */
  82.     public static final String PREFERRED_AUTHENTICATIONS = "PreferredAuthentications";

  83.     /** Key in an ssh config file. */
  84.     public static final String PROXY_COMMAND = "ProxyCommand";

  85.     /**
  86.      * Comma-separated list of jump hosts, defining a jump host chain <em>in
  87.      * reverse order</em>. Each jump host is a SSH URI or "[user@]host[:port]".
  88.      * <p>
  89.      * Reverse order means: to connect A->B->target, one can do in
  90.      * {@code ~/.ssh/config} either of:
  91.      * </p>
  92.      *
  93.      * <pre>
  94.      * Host target
  95.      *   ProxyJump B,A
  96.      * </pre>
  97.      * <p>
  98.      * <em>or</em>
  99.      * </p>
  100.      *
  101.      * <pre>
  102.      * Host target
  103.      *   ProxyJump B
  104.      *
  105.      * Host B
  106.      *   ProxyJump A
  107.      * </pre>
  108.      *
  109.      * @since 5.10
  110.      */
  111.     public static final String PROXY_JUMP = "ProxyJump";

  112.     /** Key in an ssh config file. */
  113.     public static final String REMOTE_COMMAND = "RemoteCommand";

  114.     /** Key in an ssh config file. */
  115.     public static final String REMOTE_FORWARD = "RemoteForward";

  116.     /** Key in an ssh config file. */
  117.     public static final String SEND_ENV = "SendEnv";

  118.     /** Key in an ssh config file. */
  119.     public static final String STRICT_HOST_KEY_CHECKING = "StrictHostKeyChecking";

  120.     /** Key in an ssh config file. */
  121.     public static final String USER = "User";

  122.     /** Key in an ssh config file. */
  123.     public static final String USER_KNOWN_HOSTS_FILE = "UserKnownHostsFile";

  124.     // Values

  125.     /** Flag value. */
  126.     public static final String YES = "yes";

  127.     /** Flag value. */
  128.     public static final String ON = "on";

  129.     /** Flag value. */
  130.     public static final String TRUE = "true";

  131.     /** Flag value. */
  132.     public static final String NO = "no";

  133.     /** Flag value. */
  134.     public static final String OFF = "off";

  135.     /** Flag value. */
  136.     public static final String FALSE = "false";

  137.     // Default identity file names

  138.     /** Name of the default RSA private identity file. */
  139.     public static final String ID_RSA = "id_rsa";

  140.     /** Name of the default DSA private identity file. */
  141.     public static final String ID_DSA = "id_dsa";

  142.     /** Name of the default ECDSA private identity file. */
  143.     public static final String ID_ECDSA = "id_ecdsa";

  144.     /** Name of the default ECDSA private identity file. */
  145.     public static final String ID_ED25519 = "id_ed25519";

  146.     /** All known default identity file names. */
  147.     public static final String[] DEFAULT_IDENTITIES = { //
  148.             ID_RSA, ID_DSA, ID_ECDSA, ID_ED25519
  149.     };
  150. }