Server IP : 103.119.228.120 / Your IP : 3.144.89.152 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/share/doc/openssh-7.4p1/ |
Upload File : |
[Note: This file has not been updated for OpenSSH versions after OpenSSH-1.2 and should be considered OBSOLETE. It has been left in the distribution because some of its information may still be useful to developers.] This document is intended for those who wish to read the ssh source code. This tries to give an overview of the structure of the code. Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi> Updated 17 Nov 1995. Updated 19 Oct 1999 for OpenSSH-1.2 Updated 20 May 2001 note obsolete for > OpenSSH-1.2 The software consists of ssh (client), sshd (server), scp, sdist, and the auxiliary programs ssh-keygen, ssh-agent, ssh-add, and make-ssh-known-hosts. The main program for each of these is in a .c file with the same name. There are some subsystems/abstractions that are used by a number of these programs. Buffer manipulation routines - These provide an arbitrary size buffer, where data can be appended. Data can be consumed from either end. The code is used heavily throughout ssh. The basic buffer manipulation functions are in buffer.c (header buffer.h), and additional code to manipulate specific data types is in bufaux.c. Compression Library - Ssh uses the GNU GZIP compression library (ZLIB). Encryption/Decryption - Ssh contains several encryption algorithms. These are all accessed through the cipher.h interface. The interface code is in cipher.c, and the implementations are in libc. Multiple Precision Integer Library - Uses the SSLeay BIGNUM sublibrary. Random Numbers - Uses arc4random() and such. RSA key generation, encryption, decryption - Ssh uses the RSA routines in libssl. RSA key files - RSA keys are stored in files with a special format. The code to read/write these files is in authfile.c. The files are normally encrypted with a passphrase. The functions to read passphrases are in readpass.c (the same code is used to read passwords). Binary packet protocol - The ssh binary packet protocol is implemented in packet.c. The code in packet.c does not concern itself with packet types or their execution; it contains code to build packets, to receive them and extract data from them, and the code to compress and/or encrypt packets. CRC code comes from crc32.c. - The code in packet.c calls the buffer manipulation routines (buffer.c, bufaux.c), compression routines (zlib), and the encryption routines. X11, TCP/IP, and Agent forwarding - Code for various types of channel forwarding is in channels.c. The file defines a generic framework for arbitrary communication channels inside the secure channel, and uses this framework to implement X11 forwarding, TCP/IP forwarding, and authentication agent forwarding. The new, Protocol 1.5, channel close implementation is in nchan.c Authentication agent - Code to communicate with the authentication agent is in authfd.c. Authentication methods - Code for various authentication methods resides in auth-*.c (auth-passwd.c, auth-rh-rsa.c, auth-rhosts.c, auth-rsa.c). This code is linked into the server. The routines also manipulate known hosts files using code in hostfile.c. Code in canohost.c is used to retrieve the canonical host name of the remote host. Code in match.c is used to match host names. - In the client end, authentication code is in sshconnect.c. It reads Passwords/passphrases using code in readpass.c. It reads RSA key files with authfile.c. It communicates the authentication agent using authfd.c. The ssh client - The client main program is in ssh.c. It first parses arguments and reads configuration (readconf.c), then calls ssh_connect (in sshconnect.c) to open a connection to the server (possibly via a proxy), and performs authentication (ssh_login in sshconnect.c). It then makes any pty, forwarding, etc. requests. It may call code in ttymodes.c to encode current tty modes. Finally it calls client_loop in clientloop.c. This does the real work for the session. - The client is suid root. It tries to temporarily give up this rights while reading the configuration data. The root privileges are only used to make the connection (from a privileged socket). Any extra privileges are dropped before calling ssh_login. Pseudo-tty manipulation and tty modes - Code to allocate and use a pseudo tty is in pty.c. Code to encode and set terminal modes is in ttymodes.c. Logging in (updating utmp, lastlog, etc.) - The code to do things that are done when a user logs in are in login.c. This includes things such as updating the utmp, wtmp, and lastlog files. Some of the code is in sshd.c. Writing to the system log and terminal - The programs use the functions fatal(), log(), debug(), error() in many places to write messages to system log or user's terminal. The implementation that logs to system log is in log-server.c; it is used in the server program. The other programs use an implementation that sends output to stderr; it is in log-client.c. The definitions are in ssh.h. The sshd server (daemon) - The sshd daemon starts by processing arguments and reading the configuration file (servconf.c). It then reads the host key, starts listening for connections, and generates the server key. The server key will be regenerated every hour by an alarm. - When the server receives a connection, it forks, disables the regeneration alarm, and starts communicating with the client. They first perform identification string exchange, then negotiate encryption, then perform authentication, preparatory operations, and finally the server enters the normal session mode by calling server_loop in serverloop.c. This does the real work, calling functions in other modules. - The code for the server is in sshd.c. It contains a lot of stuff, including: - server main program - waiting for connections - processing new connection - authentication - preparatory operations - building up the execution environment for the user program - starting the user program. Auxiliary files - There are several other files in the distribution that contain various auxiliary routines: ssh.h the main header file for ssh (various definitions) uidswap.c uid-swapping xmalloc.c "safe" malloc routines $OpenBSD: OVERVIEW,v 1.12 2015/07/08 19:01:15 markus Exp $