1 /* 2 * ProFTPD - mod_sftp SSH2 constants 3 * Copyright (c) 2008-2020 TJ Saunders 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 * 19 * As a special exemption, TJ Saunders and other respective copyright holders 20 * give permission to link this program with OpenSSL, and distribute the 21 * resulting executable, without including the source code for OpenSSL in the 22 * source distribution. 23 */ 24 25 #ifndef MOD_SFTP_SSH2_H 26 #define MOD_SFTP_SSH2_H 27 28 /* As per RFC 4253, Section 6.1, we MUST be able to handle a packet whose 29 * length is 35000 bytes; we SHOULD be able to handle larger packets. We 30 * impose a maximum size here to prevent overly-large packets from being 31 * used by attackers. The maximum size is a bit arbitrary. 32 */ 33 #define SFTP_MAX_PACKET_LEN (1024 * 256) 34 35 /* SSH2 message types */ 36 37 #define SFTP_SSH2_MSG_DISCONNECT 1 38 #define SFTP_SSH2_MSG_IGNORE 2 39 #define SFTP_SSH2_MSG_UNIMPLEMENTED 3 40 #define SFTP_SSH2_MSG_DEBUG 4 41 #define SFTP_SSH2_MSG_SERVICE_REQUEST 5 42 #define SFTP_SSH2_MSG_SERVICE_ACCEPT 6 43 #define SFTP_SSH2_MSG_EXT_INFO 7 44 #define SFTP_SSH2_MSG_KEXINIT 20 45 #define SFTP_SSH2_MSG_NEWKEYS 21 46 47 /* Key exchange message types */ 48 #define SFTP_SSH2_MSG_KEX_DH_INIT 30 49 #define SFTP_SSH2_MSG_KEX_DH_REPLY 31 50 #define SFTP_SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30 51 #define SFTP_SSH2_MSG_KEX_DH_GEX_GROUP 31 52 #define SFTP_SSH2_MSG_KEX_DH_GEX_INIT 32 53 #define SFTP_SSH2_MSG_KEX_DH_GEX_REPLY 33 54 #define SFTP_SSH2_MSG_KEX_DH_GEX_REQUEST 34 55 #define SFTP_SSH2_MSG_KEXRSA_PUBKEY 30 56 #define SFTP_SSH2_MSG_KEXRSA_SECRET 31 57 #define SFTP_SSH2_MSG_KEXRSA_DONE 32 58 #define SFTP_SSH2_MSG_KEX_ECDH_INIT 30 59 #define SFTP_SSH2_MSG_KEX_ECDH_REPLY 31 60 61 /* User authentication message types */ 62 #define SFTP_SSH2_MSG_USER_AUTH_REQUEST 50 63 #define SFTP_SSH2_MSG_USER_AUTH_FAILURE 51 64 #define SFTP_SSH2_MSG_USER_AUTH_SUCCESS 52 65 #define SFTP_SSH2_MSG_USER_AUTH_BANNER 53 66 #define SFTP_SSH2_MSG_USER_AUTH_PUBKEY 60 67 #define SFTP_SSH2_MSG_USER_AUTH_PK_OK 60 68 #define SFTP_SSH2_MSG_USER_AUTH_PASSWD 60 69 #define SFTP_SSH2_MSG_USER_AUTH_INFO_REQ 60 70 #define SFTP_SSH2_MSG_USER_AUTH_INFO_RESP 61 71 72 /* Request types */ 73 #define SFTP_SSH2_MSG_GLOBAL_REQUEST 80 74 #define SFTP_SSH2_MSG_REQUEST_SUCCESS 81 75 #define SFTP_SSH2_MSG_REQUEST_FAILURE 82 76 77 /* Channel message types */ 78 #define SFTP_SSH2_MSG_CHANNEL_OPEN 90 79 #define SFTP_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91 80 #define SFTP_SSH2_MSG_CHANNEL_OPEN_FAILURE 92 81 #define SFTP_SSH2_MSG_CHANNEL_WINDOW_ADJUST 93 82 #define SFTP_SSH2_MSG_CHANNEL_DATA 94 83 #define SFTP_SSH2_MSG_CHANNEL_EXTENDED_DATA 95 84 #define SFTP_SSH2_MSG_CHANNEL_EOF 96 85 #define SFTP_SSH2_MSG_CHANNEL_CLOSE 97 86 #define SFTP_SSH2_MSG_CHANNEL_REQUEST 98 87 #define SFTP_SSH2_MSG_CHANNEL_SUCCESS 99 88 #define SFTP_SSH2_MSG_CHANNEL_FAILURE 100 89 90 /* Channel extended data types */ 91 #define SFTP_SSH2_MSG_CHANNEL_EXTENDED_DATA_TYPE_STDERR 1 92 93 /* SSH Disconnect reason codes */ 94 #define SFTP_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1 95 #define SFTP_SSH2_DISCONNECT_PROTOCOL_ERROR 2 96 #define SFTP_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3 97 #define SFTP_SSH2_DISCONNECT_RESERVED 4 98 #define SFTP_SSH2_DISCONNECT_MAC_ERROR 5 99 #define SFTP_SSH2_DISCONNECT_COMPRESSION_ERROR 6 100 #define SFTP_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7 101 #define SFTP_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8 102 #define SFTP_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9 103 #define SFTP_SSH2_DISCONNECT_CONNECTION_LOST 10 104 #define SFTP_SSH2_DISCONNECT_BY_APPLICATION 11 105 #define SFTP_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12 106 #define SFTP_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13 107 #define SFTP_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14 108 #define SFTP_SSH2_DISCONNECT_ILLEGAL_USER_NAME 15 109 110 #endif /* MOD_SFTP_SSH2_H */ 111