Linux how to use ControlPersist to speed up SSH connection speed

  

Linux system for server configuration management migration, SSH connection speed is a headache, too slow to affect efficiency, then what is the way to speed up SSH connection speed? It can be realized by ControlPersist. The following small series gives you a brief introduction.

Currently, the project configuration management server have all migrated from Puppet to Ansible, but not before been considered distressing problem of slow SSH channel is exposed apparent.

Because many times you need to update hundreds of servers at the same time, many servers are not in the same IDC room as Ansible.

Turning on SSH ControlMaster and persisting the socket connection can speed up the execution of Ansible. You don't need to go through SSH authentication every time. The time saved by a single server is only about 1 second, and hundreds of units. The server can save about a minute or so.

But to enable this feature, you must install a newer version of openssh, and most of our hosts are CentOS6.4 x86_64. The default version is too old and the version in the official yum repository is very old.

Considering that this feature only requires client support, you don't need to install it on every server. We downloaded the latest openssh source package and packaged it into RPM and installed it directly on the Ansible operation host.

Server Environment:

CentOS 6.4 x86_64 Minimal

1. Compile and Generate OpenSSH RPM

1.1 Install Compile Required Tools

$ Sudo yum -y groupinstall “Development tools”

$ sudo yum -y install pam-devel rpm-build rpmdevtools zlib-devel krb5-devel tcp_wrappers tcp_wrappers-devel tcp_wrappers-libs

1.2 Configuration RPM Compilation Environment

$ cd /home/dong.guo

$ mkdir rpmbuild

$ cd rpmbuild

$ mkdir -pv {BUILD,BUILDROOT, RPMS, SOURCES, SPECS, SRPMS, TMP}

$ cd /home/dong.guo

$ vim .rpmmacros

%_topdir /home/dong.guo/rpmbuild

%_tmppath /home/dong.guo/TMP

1.3 Upgrading OpenSSL to the Latest

$ sudo yum update openssl

1.4 Compiling OpenSSH RPM

1.4.1 Download Source Package

$ cd /home/dong.guo/rpmbuild/SOURCES/

$ wget http://mirror.team-cymru.org/pub /OpenBSD/OpenSSH/po Rtable/openssh-6.6p1.tar.gz

$ wget http://mirror.team-cymru.org/pub/OpenBSD/OpenSSH/portable/openssh-6.6p1.tar.gz.asc

$ openssl dgst -sha1 openssh-6.6p1.tar.gz; echo b850fd1af704942d9b3c2eff7ef6b3a59b6a6b6e

1.4.2 SPEC configuration file

$ cd /home/dong.guo/rpmbuild/SPECS

$ tar xfz . . /SOURCES/openssh-6.6p1.tar.gz openssh-6.6p1/contrib/redhat/openssh.spec

$ mv openssh-6.6p1/contrib/redhat/openssh.spec openssh-6.6p1.spec

$ rm -rf openssh-6.6p1

$ sudo chown 74:74 openssh-6.6p1.spec

$ sed -i -e & ldquo; s /% define no_gnome_askpass 0 /% define no_gnome_askpass 1 /g & rdquo; openssh-6.6p1.spec

$ sed -i -e & ldquo; s /% define no_x11_askpass 0 /% define no_x11_askpass 1 /g & rdquo; openssh-6.6p1.spec < Br>

$ sed -i -e <;//BuildPreReq/BuildRequires/g” openssh-6.6p1.spec

1.4.3 Compiling and Generating RPM

$ cd /home/Dong.guo/rpmbuild/SPECS

$ rpmbuild -ba openssh-6.6p1.spec

1.4.4 Viewing the generated RPM

$ cd /home/dong.guo /rpmbuild/RPMS/x86_64

$ ls openssh-*

openssh-6.6p1-1.x86_64.rpm openssh-clients-6.6p1-1.x86_64.rpm openssh-debuginfo-6.6 P1-1.x86_64.rpm openssh-server-6.6p1-1.x86_64.rpm

1.4.5 Installing generated RPM

$ Cd /home/dong.guo/rpmbuild/RPMS/x86_64

$ sudo rpm -e openssh-askpass

$ sudo rpm -e openssh-ldap

$ sudo Rpm -Fvh openssh*6.6p1-1*rpm

Preparing. . ###############################################################################

1: openssh ####################################################################### 33%]

2:openssh-clients ################################################ ####### [ 67%]

3:openssh-server warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnew ########## ########################## [100%]
Previous12Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved