View Javadoc
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  
11  package org.eclipse.jgit.transport;
12  
13  import org.eclipse.jgit.lib.Constants;
14  
15  /**
16   * Constants relating to ssh.
17   *
18   * @since 5.2
19   */
20  @SuppressWarnings("nls")
21  public final class SshConstants {
22  
23  	private SshConstants() {
24  		// No instances, please.
25  	}
26  
27  	/** IANA assigned port number for ssh. */
28  	public static final int SSH_DEFAULT_PORT = 22;
29  
30  	/** URI scheme for ssh. */
31  	public static final String SSH_SCHEME = "ssh";
32  
33  	/** URI scheme for sftp. */
34  	public static final String SFTP_SCHEME = "sftp";
35  
36  	/** Default name for a ssh directory. */
37  	public static final String SSH_DIR = ".ssh";
38  
39  	/** Name of the ssh config file. */
40  	public static final String CONFIG = Constants.CONFIG;
41  
42  	/** Default name of the user "known hosts" file. */
43  	public static final String KNOWN_HOSTS = "known_hosts";
44  
45  	// Config file keys
46  
47  	/** Key in an ssh config file. */
48  	public static final String BATCH_MODE = "BatchMode";
49  
50  	/** Key in an ssh config file. */
51  	public static final String CANONICAL_DOMAINS = "CanonicalDomains";
52  
53  	/** Key in an ssh config file. */
54  	public static final String CERTIFICATE_FILE = "CertificateFile";
55  
56  	/** Key in an ssh config file. */
57  	public static final String CIPHERS = "Ciphers";
58  
59  	/** Key in an ssh config file. */
60  	public static final String COMPRESSION = "Compression";
61  
62  	/** Key in an ssh config file. */
63  	public static final String CONNECTION_ATTEMPTS = "ConnectionAttempts";
64  
65  	/** Key in an ssh config file. */
66  	public static final String CONTROL_PATH = "ControlPath";
67  
68  	/** Key in an ssh config file. */
69  	public static final String GLOBAL_KNOWN_HOSTS_FILE = "GlobalKnownHostsFile";
70  
71  	/**
72  	 * Key in an ssh config file.
73  	 *
74  	 * @since 5.5
75  	 */
76  	public static final String HASH_KNOWN_HOSTS = "HashKnownHosts";
77  
78  	/** Key in an ssh config file. */
79  	public static final String HOST = "Host";
80  
81  	/** Key in an ssh config file. */
82  	public static final String HOST_KEY_ALGORITHMS = "HostKeyAlgorithms";
83  
84  	/** Key in an ssh config file. */
85  	public static final String HOST_NAME = "HostName";
86  
87  	/** Key in an ssh config file. */
88  	public static final String IDENTITIES_ONLY = "IdentitiesOnly";
89  
90  	/** Key in an ssh config file. */
91  	public static final String IDENTITY_AGENT = "IdentityAgent";
92  
93  	/** Key in an ssh config file. */
94  	public static final String IDENTITY_FILE = "IdentityFile";
95  
96  	/** Key in an ssh config file. */
97  	public static final String KEX_ALGORITHMS = "KexAlgorithms";
98  
99  	/** Key in an ssh config file. */
100 	public static final String LOCAL_COMMAND = "LocalCommand";
101 
102 	/** Key in an ssh config file. */
103 	public static final String LOCAL_FORWARD = "LocalForward";
104 
105 	/** Key in an ssh config file. */
106 	public static final String MACS = "MACs";
107 
108 	/** Key in an ssh config file. */
109 	public static final String NUMBER_OF_PASSWORD_PROMPTS = "NumberOfPasswordPrompts";
110 
111 	/** Key in an ssh config file. */
112 	public static final String PORT = "Port";
113 
114 	/** Key in an ssh config file. */
115 	public static final String PREFERRED_AUTHENTICATIONS = "PreferredAuthentications";
116 
117 	/**
118 	 * Key in an ssh config file; defines signature algorithms for public key
119 	 * authentication as a comma-separated list.
120 	 *
121 	 * @since 5.11.1
122 	 */
123 	public static final String PUBKEY_ACCEPTED_ALGORITHMS = "PubkeyAcceptedAlgorithms";
124 
125 	/** Key in an ssh config file. */
126 	public static final String PROXY_COMMAND = "ProxyCommand";
127 
128 	/**
129 	 * Comma-separated list of jump hosts, defining a jump host chain <em>in
130 	 * reverse order</em>. Each jump host is a SSH URI or "[user@]host[:port]".
131 	 * <p>
132 	 * Reverse order means: to connect A->B->target, one can do in
133 	 * {@code ~/.ssh/config} either of:
134 	 * </p>
135 	 *
136 	 * <pre>
137 	 * Host target
138 	 *   ProxyJump B,A
139 	 * </pre>
140 	 * <p>
141 	 * <em>or</em>
142 	 * </p>
143 	 *
144 	 * <pre>
145 	 * Host target
146 	 *   ProxyJump B
147 	 *
148 	 * Host B
149 	 *   ProxyJump A
150 	 * </pre>
151 	 *
152 	 * @since 5.10
153 	 */
154 	public static final String PROXY_JUMP = "ProxyJump";
155 
156 	/** Key in an ssh config file. */
157 	public static final String REMOTE_COMMAND = "RemoteCommand";
158 
159 	/** Key in an ssh config file. */
160 	public static final String REMOTE_FORWARD = "RemoteForward";
161 
162 	/** Key in an ssh config file. */
163 	public static final String SEND_ENV = "SendEnv";
164 
165 	/** Key in an ssh config file. */
166 	public static final String STRICT_HOST_KEY_CHECKING = "StrictHostKeyChecking";
167 
168 	/** Key in an ssh config file. */
169 	public static final String USER = "User";
170 
171 	/** Key in an ssh config file. */
172 	public static final String USER_KNOWN_HOSTS_FILE = "UserKnownHostsFile";
173 
174 	// Values
175 
176 	/** Flag value. */
177 	public static final String YES = "yes";
178 
179 	/** Flag value. */
180 	public static final String ON = "on";
181 
182 	/** Flag value. */
183 	public static final String TRUE = "true";
184 
185 	/** Flag value. */
186 	public static final String NO = "no";
187 
188 	/** Flag value. */
189 	public static final String OFF = "off";
190 
191 	/** Flag value. */
192 	public static final String FALSE = "false";
193 
194 	// Default identity file names
195 
196 	/** Name of the default RSA private identity file. */
197 	public static final String ID_RSA = "id_rsa";
198 
199 	/** Name of the default DSA private identity file. */
200 	public static final String ID_DSA = "id_dsa";
201 
202 	/** Name of the default ECDSA private identity file. */
203 	public static final String ID_ECDSA = "id_ecdsa";
204 
205 	/** Name of the default ECDSA private identity file. */
206 	public static final String ID_ED25519 = "id_ed25519";
207 
208 	/** All known default identity file names. */
209 	public static final String[] DEFAULT_IDENTITIES = { //
210 			ID_RSA, ID_DSA, ID_ECDSA, ID_ED25519
211 	};
212 }