|
Data de criação |
Autor |
Última revisão |
Validade |
Observações |
|---|---|---|---|---|
04/09/2020 |
Ramissés Araujo |
18/06/2021 |
Até alteração do procedimento |
- |
Passo 01 Criar um arquivo executável e adicionar o seguinte conteúdo:
Adicionar o script em /root
setenforce 0
yum install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel unzip -y
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.8p1.tar.gz
tar -xvf openssh-8.8p1.tar.gz
cd openssh-8.8p1
./configure --prefix=/usr/local
make && make install
cp /etc/ssh/ /tmp/ssh -rf
cp /etc/pam.d/sshd /tmp/sshd
rpm -e `rpm -qa | grep openssh` --nodeps
rm /etc/ssh -r
cp /tmp/ssh /etc/ssh -rf
cp /tmp/sshd /etc/pam.d/sshd
cp /root/openssh-8.8p1/contrib/redhat/sshd.init /etc/init.d/sshd
sed -i s/'SSHD=\/usr\/sbin\/sshd'/'SSHD=\/usr\/local\/sbin\/sshd'/ /etc/init.d/sshd
sed -i s/'\/usr\/bin\/ssh-keygen'/'\/usr\/local\/bin\/ssh-keygen'/ /etc/init.d/sshd
chkconfig --add sshd
cd /etc/ssh/
chmod 400 ssh_host_ecdsa_key ssh_host_ed25519_key ssh_host_rsa_key
ln /usr/local/etc/sshd_config /etc/ssh/sshd_config -f
/etc/init.d/sshd restart
sshd -V
### Script para Oracle Linux 8
setenforce 0
dnf install rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel unzip -y
dnf install make gcc -y
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.9p1.tar.gz
tar -xvf openssh-8.9p1.tar.gz
cd openssh-8.9p1
./configure --prefix=/usr/local
make && make install
cp /etc/ssh/ /tmp/ssh -rf
cp /etc/pam.d/sshd /tmp/sshd
rpm -e `rpm -qa | grep openssh` --nodeps
rm /etc/ssh -r
cp /tmp/ssh /etc/ssh -rf
cp /tmp/sshd /etc/pam.d/sshd
cp /root/openssh-8.9p1/contrib/redhat/sshd.init /etc/init.d/sshd
sed -i s/'SSHD=\/usr\/sbin\/sshd'/'SSHD=\/usr\/local\/sbin\/sshd'/ /etc/init.d/sshd
sed -i s/'\/usr\/bin\/ssh-keygen'/'\/usr\/local\/bin\/ssh-keygen'/ /etc/init.d/sshd
chkconfig --add sshd
cd /etc/ssh/
chmod 400 ssh_host_ecdsa_key ssh_host_ed25519_key ssh_host_rsa_key
ln /usr/local/etc/sshd_config /etc/ssh/sshd_config -f
/etc/init.d/sshd restart
sshd -V
Passo 02 Caso ocorra problema de login via SSH desabilite ou deixe como PERMISSIVE o SELinux
Passo 02.1 Para mudar sem reiniciar
setenforce 0
Passo 02.2 Para mudar permanente, edite o arquivo e altere a linha SELINUX=enforcing para SELINUX=permissive
vim /etc/sysconfig/selinux
Passo 3 Em caso de erro em não encontrar o comando sshd, execute:
cp /usr/local/sbin/sshd /sbin/sshd
Procedimento testado no Ubuntu 16
Passo 01 Criar um arquivo executável e adicionar o seguinte conteúdo:
mkdir /tmp/ssh
cp /etc/systemd/system/sshd.service /tmp/ssh/sshd.service
cp /etc/init.d/ssh /tmp/ssh/sshd
cp -r /etc/ssh /tmp/ssh/
sudo apt update -y
sudo apt install build-essential zlib1g-dev libssl-dev -y
sudo mkdir /var/lib/sshd
sudo chmod -R 700 /var/lib/sshd/
sudo chown -R root:sys /var/lib/sshd/
wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz
tar -xzf openssh-8.4p1.tar.gz
cd openssh-8.4p1/
sudo apt install libpam0g-dev libselinux1-dev -y
./configure --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh
make
sudo make install
cp /tmp/ssh/sshd.service /etc/systemd/system/sshd.service
cp -rf /tmp/ssh/ssh /etc
sed -i s/'UsePrivilegeSeparation'/'#UsePrivilegeSeparation'/ /etc/ssh/sshd_config
sed -i s/'KeyRegenerationInterval'/'#KeyRegenerationInterval'/ /etc/ssh/sshd_config
sed -i s/'ServerKeyBits'/'#ServerKeyBits'/ /etc/ssh/sshd_config
sed -i s/'RhostsRSAAuthentication no'/'#RhostsRSAAuthentication no'/ /etc/ssh/sshd_config
sed -i s/'RSAAuthentication'/'#RSAAuthentication'/ /etc/ssh/sshd_config
apt remove openssh-client -y
systemctl unmask ssh
cp /usr/local/sbin/sshd /usr/sbin/sshd -f
/usr/sbin/sshd
systemctl start ssh
systemctl enable ssh
Passo 02 Verificar se o serviço está rodando.
systemctl status sshd