-
Notifications
You must be signed in to change notification settings - Fork 3
/
conf
74 lines (69 loc) · 2.01 KB
/
conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#/bin/bash
clear
if [ $(id -u) -eq 0 ]
then
clear
else
if echo $(id) |grep sudo > /dev/null 2>&1
then
clear
echo -e "\033[1;37mVoce não é root"
echo -e "\033[1;37mSeu usuario esta no grupo sudo"
echo -e "\033[1;37mPara virar root execute \033[1;31msudo su\033[1;37m ou execute \033[1;31msudo $0\033[0m"
exit
else
clear
echo -e "Vc nao esta como usuario root, nem com seus direitos (sudo)\nPara virar root execute \033[1;31msu\033[0m e digite sua senha root"
exit
fi
fi
IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
if [[ "$IP" = "" ]]; then
IP=$(wget -qO- ipv4.icanhazip.com)
fi
echo -ne "\033[1;31mPara continuar confirme seu IP ; read -e -i $IP ip
if [ -z "$ip" ]; then
echo ""
echo -e "\033[1;31mErro \033[1;32mIP incorreto!\033[0m"
rm -rf $HOME/conf > /dev/null 2>&1
sleep 2
clear; exit 1
fi
clear
echo -e "\033[1;31m-----> \033[01;37mSeu sistema operacional:\033[1;31m $(cat /etc/so)"
echo -e "\033[1;31m-----> \033[01;37mSeu ip:\033[1;31m $ip"
echo -e "\033[1;31m-----> \033[1;37mSSH NA PORTA: \033[1;31m 22\033[0m"
function sshd_config(){ echo "Port 22
Protocol 2
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes" > /etc/ssh/sshd_config
}
echo -e "\033[01;31mConfigurando, Aguarde...\033[0m"
apt-get update > /dev/null 2>&1
chattr -i /etc/ssh/sshd_config > /dev/null 2>&1
sshd_config
service sshd restart 1> /dev/null 2>&1
service ssh restart > /dev/null 2>&1
echo -e "\033[01;31mTudo terminado crie um usuario e teste !! \033[0m"