6.6 ���������� �������� (SSH) (original) (raw)
������� �.�. (����-����)
Yu. Semenov (ITEP-MIPT)
����������������� ����� ������ ������������ � �������. ��� ������� � �������� ���������� �����. �� ����� �� ������� ��������� ��������, ����� ������������� �������� ��������� �� ��� ���� ��������� �������� � ���������� ���������. ���� ������������ ����� �� ����������, �� ����� ���� ���������� � ������� ����� ������ (��������, ��������� ��������� tcpdump ��� sniffer), ������������ � ���� �� ����������� �������� ���, � ����� ����� ������, � ���� �� ������. ������ �� ���� ������� ������������� �������� �������� ������, DNS, ������ �������� � �������������� � ��������� ������� �������, � �������� �� ���������� ������������ ������. ��� ���� ����� ������������� �������� ������ ����������� � ����������� ������ ���������, � ��������� ����������� ����������� ��������� ����������� ��������� SSH (Secure Shell). ��� ������������� ��������� �������� ��� ����� ��������� ������, ������� ��, ������� ���������� �������� HTTP. SSH ���������� ��� ���������� ��� �������� ����, ��� � ������������ �����. ��� ���� ������������ �������������� ��� � ������������ ����������������� ������ � ����������� ������������ ������. � ������� �� SSL ����� �� ��������� ����������� ���������� ������� ��� ������� ��� ����������� ������� ������� ������������. ��������� ����, ��� ��������� ����������� � ������, ������������ ���� �� ��������� ��� �������� ������� ������� ������ (��� ���������� ������������ �����������). SSH �������� ��� ����������, ��� ��������� ������������, ����� ��������� ��� telnet, rlogin, rsh � rcp. ��� ��������� ��� ���, �� ������� �����������, ������� ����� � ������ X Windows. ����������������� ��������� ����������� � ���, ��� ������ ������������� ������������ ��� ��������� ��� ���������� ����������� ����� TCP/IP ������, ��������, FTP ��� HTTP. ��� ����������� ����� ������� ����������� ������-��������� �� ����� ��������� ���. ������-��������� ������� ������ � ���������� ������� �� ������� �������. ��� ��������� ������������ �������� HTML, ����������� WEB-������� � ������ ����������� ��������, ������� ���� �� ���� �� ������������ ����������������� ������. ����������� ����� �������������� � WEB-��������, ������� �� ����� ���������������� �����������. � ����������� ����� ������ � ��������� ����������� ���������� ����������� ������ SCP, ���������� FTP. SSH �� ��������� ���������� ���� 22.
��� ������������ SSH-������ �� ��������� WEB-������� ������� ����� ��������������� �� ������������ ���� �� ��������� ������, ��������, 5678. ����� ����� ������� ������������ ��������� SSH ��� ����, ����� ���������� �����, ��������, � �����-�� WEB-��������. ��� ���� ��� �������� ������ ������� ��������� ����� �L:
SSH �L5678:www.pod.potol.com:80 www.pod.potol.com
��������, ��������� ����� ����� ����� -L ����� ������:
<_��������� ����_>:<_��������� ���_>:<_��������� ����_>.
����� �������, �� �������, ����� ������ ������������ ��������� ���� 5678 � ���������������� ���� ����� � ������������� ���� � ���� 80 ���� www.pod.potol.com. ����� ���������� ������ ������� �������, ��������, ��������� WEB-������� �� ����� ��� � ����������� ������������ ����� � http://localhost:5678/. ����������� ����� ����������� ����� � http://www.pod.potol.com, �� ���� ������ � ���� �������� ��� ����� ����������. �� ���������� ������ � ��������� ������� ��������� ������� logout �� ��������� ���. ������������� ������ SSH ����� ����� �� ������: www.cs.hut.fi/ssh. ���������� � ������������ ������� ��� Windows � Macintosh ����� ����� �� �������: www.datafellows.com/f-secure.
� ������ OpenSSH ���� ���������� ����������, ������� ��������� ��������� ������� ������� ������ ����������� �������������� ����� ���, ��� ������ �������� ���������� �������. ����� ���������� ������� �� ���� ������� Linux, �� ������������� �� �������. ������ ��� ����� ��������� � ������������� ������������� �������� ������� (��. "How can enterprises stop the OpenSSH vulnerability?", Michael Cobb).
� ��������� ����� ����� ������ �������� �������� �������������� ������������� � ����. ����� ���������� ����� ���������� ����� ����������� �������������� ������������ � ������������ ������������������.
����� �� ������� ��������� �������� ��������� ����� �� ����� ������ � ������ ��� ����������� �������� ���������� (��. "How to copy a file from one server to another from a third with SSH", Jack Wallen, November 1, 2019). ��� ������� ������ ������ ��������������, ��� ��� ���������� �������� � �� Linux � ����� ����������� SSH-����������. �������������� �����, ��� ��� ����� ���������������� ���� ����� ����������� SSH-������������.
����� Server A - 192.168.1.15; Server B - 192.168.1.160; Client C - 192.168.1.7
��������� ���������� � ����������� ������ �� ������, ��� ����������� � ������� ������� ssh-copy-id USER@IP. �������� ����������� �� A � B, �� A � C, �� B � A, �� B � C, �� C � A � �� C � B. ���������� � � B �������� ���������, � �- ��������. ����� ����������� �������:
scp USER@192.168.1.15:/home/USER/test.txt USER@192.168.1.160:/home/USER/test.txt
����� ��� ����� ����� ���������������� ���� ~/.ssh/config
��������� ��� ����������� �������: nano ~/.ssh/config. ������ ����� ���������������� SERVERA � SERVERB. ��� ����� �������, ��������, ��������� �������:
Host SERVERA HostName 192.168.1.16 ControlMaster auto ControlPath ~/.ssh/ssh-%r@%h:%p ControlPersist 30m
Host SERVERB HostName 192.168.1.22 ControlMaster auto ControlPath ~/.ssh/ssh-%r@%h:%p ControlPersist 30m
��������� � ��������� �����. ����� �������� �������� ���� � ������� C �� ������ � � ������� �������:
scp test.txt USER@192.168.1.15:/home/USER/test.txt, ��� USER ��� ���������� ��������.
��� ���� test.txt ������ ��������� �� Server A. ������ �������� ��� � Server A �� Server B ����������� Client C. ��� ����� ��������� �������:
scp -3 USER@SERVERA:/home/USER/test.txt USER@SERVERB:/home/USER/test.txt, ��� USER - ��� ���������� ������������. ����� -3 ��������� SCP ���������� ������ ����� ������-��������� (� ������ ������ Client C). ����������� ��� ���� ������������ � Client C.
�� ����� ���� ����� � ������� � � ���� �� �������� (���� ��� ������) � ������ ��������� ����� SCP, ��� ���� ����� ����� ������ ��� �������-��������. ����� ������� ����� ����� �������� ����������� ��������� ������ ��� ���� ���������� ����� ��������.