added zabbix agent install, some fix
This commit is contained in:
		| @@ -2,14 +2,14 @@ | |||||||
|  |  | ||||||
| # TODO check if root | # TODO check if root | ||||||
|  |  | ||||||
| echo '\033[35m | echo -e '\033[35m | ||||||
|     ______      _ _____   __ |     ______      _ _____   __ | ||||||
|    / ____/___ _(_) /__ \ / /_  ____ _____ |    / ____/___ _(_) /__ \ / /_  ____ _____ | ||||||
|   / /_  / __ `/ / /__/ // __ \/ __ `/ __ \ |   / /_  / __ `/ / /__/ // __ \/ __ `/ __ \ | ||||||
|  / __/ / /_/ / / // __// /_/ / /_/ / / / / |  / __/ / /_/ / / // __// /_/ / /_/ / / / / | ||||||
| /_/    \__,_/_/_//____/_.___/\__,_/_/ /_/ | /_/    \__,_/_/_//____/_.___/\__,_/_/ /_/ | ||||||
| \033[0m' | \033[0m' | ||||||
| echo "\033[35;1mInstalling fall2ban \033[0m" | echo -e "\033[35;1mInstalling fall2ban \033[0m" | ||||||
|  |  | ||||||
| if [ "$EUID" -ne 0 ]; then | if [ "$EUID" -ne 0 ]; then | ||||||
|   echo "Please run as root" |   echo "Please run as root" | ||||||
| @@ -22,4 +22,4 @@ cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local | |||||||
| # ToDo ask for email and configure jail.local with it | # ToDo ask for email and configure jail.local with it | ||||||
| systemctl enable fail2ban | systemctl enable fail2ban | ||||||
| systemctl restart fail2ban | systemctl restart fail2ban | ||||||
| echo "\033[92;1mfail2ban installed and configured\033[Om" | echo -e "\033[92;1mfail2ban installed and configured\033[Om" | ||||||
|   | |||||||
| @@ -2,14 +2,14 @@ | |||||||
|  |  | ||||||
| # TODO check if root | # TODO check if root | ||||||
|  |  | ||||||
| echo '\033[35m | echo -e '\033[35m | ||||||
|     ______________  _______       _____    __    __ |     ______________  _______       _____    __    __ | ||||||
|    / ____/  _/ __ \/ ____/ |     / /   |  / /   / / |    / ____/  _/ __ \/ ____/ |     / /   |  / /   / / | ||||||
|   / /_   / // /_/ / __/  | | /| / / /| | / /   / / |   / /_   / // /_/ / __/  | | /| / / /| | / /   / / | ||||||
|  / __/ _/ // _, _/ /___  | |/ |/ / ___ |/ /___/ /___ |  / __/ _/ // _, _/ /___  | |/ |/ / ___ |/ /___/ /___ | ||||||
| /_/   /___/_/ |_/_____/  |__/|__/_/  |_/_____/_____/ | /_/   /___/_/ |_/_____/  |__/|__/_/  |_/_____/_____/ | ||||||
| \033[0m' | \033[0m' | ||||||
| echo "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m" | echo -e "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m" | ||||||
|  |  | ||||||
| if [ "$EUID" -ne 0 ]; then | if [ "$EUID" -ne 0 ]; then | ||||||
|   echo "Please run as root" |   echo "Please run as root" | ||||||
| @@ -22,8 +22,8 @@ apt-get --yes --force-yes install ufw | |||||||
| ufw allow http | ufw allow http | ||||||
| ufw allow https | ufw allow https | ||||||
|  |  | ||||||
| # TODO ask for allowing ssh for some ip  | # TODO ask for allowing ssh for some ip | ||||||
|  |  | ||||||
| ufw enable | ufw enable | ||||||
| ufw status verbose | ufw status verbose | ||||||
| echo "\033[92;1mufw installed and firwall configured\033[Om" | echo -e "\033[92;1mufw installed and firwall configured\033[Om" | ||||||
|   | |||||||
| @@ -2,14 +2,14 @@ | |||||||
|  |  | ||||||
| # TODO check if root | # TODO check if root | ||||||
|  |  | ||||||
| echo '\033[35m | echo -e '\033[35m | ||||||
|     __                    __       __ |     __                    __       __ | ||||||
|    / /______  ____  _____/ /______/ / |    / /______  ____  _____/ /______/ / | ||||||
|   / //_/ __ \/ __ \/ ___/ //_/ __  / |   / //_/ __ \/ __ \/ ___/ //_/ __  / | ||||||
|  / ,< / / / / /_/ / /__/ ,< / /_/ / |  / ,< / / / / /_/ / /__/ ,< / /_/ / | ||||||
| /_/|_/_/ /_/\____/\___/_/|_|\__,_/ | /_/|_/_/ /_/\____/\___/_/|_|\__,_/ | ||||||
| \033[0m' | \033[0m' | ||||||
| echo "\033[35;1mInstalling knockd to control ssh port opening\033[0m" | echo -e "\033[35;1mInstalling knockd to control ssh port opening\033[0m" | ||||||
|  |  | ||||||
| if [ "$EUID" -ne 0 ]; then | if [ "$EUID" -ne 0 ]; then | ||||||
|   echo "Please run as root" |   echo "Please run as root" | ||||||
| @@ -42,7 +42,7 @@ systemctl start knockd | |||||||
| # patch https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868015 | # patch https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868015 | ||||||
| # systemctl enable knockd | # systemctl enable knockd | ||||||
|  |  | ||||||
| echo "\033[92;1mknockd installed and configured\033[Om" | echo -e "\033[92;1mknockd installed and configured\033[Om" | ||||||
| echo "\033[92;1mplease note this sequence for future ssh knocking\033[Om" | echo -e "\033[92;1mplease note this sequence for future ssh knocking\033[Om" | ||||||
| echo "$sq1" | echo "$sq1" | ||||||
| sleep 3 | sleep 3 | ||||||
|   | |||||||
| @@ -1,8 +1,6 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
|  |  | ||||||
| # TODO check if root | echo -e '\033[35m | ||||||
|  |  | ||||||
| echo '\033[35m |  | ||||||
|     __  ____ |     __  ____ | ||||||
|    /  |/  (_)_________ |    /  |/  (_)_________ | ||||||
|   / /|_/ / / ___/ ___/ |   / /|_/ / / ___/ ___/ | ||||||
| @@ -23,3 +21,5 @@ locale-gen | |||||||
| apt-get --yes --force-yes install ntp | apt-get --yes --force-yes install ntp | ||||||
| dpkg-reconfigure tzdata | dpkg-reconfigure tzdata | ||||||
| apt-get --yes --force-yes install needrestart | apt-get --yes --force-yes install needrestart | ||||||
|  |  | ||||||
|  | echo -e "\033[92;1mMisc done \033[Om" | ||||||
|   | |||||||
							
								
								
									
										37
									
								
								bin/zabbix.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								bin/zabbix.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | #!/bin/sh | ||||||
|  |  | ||||||
|  |  | ||||||
|  | echo -e '\033[35m | ||||||
|  |  _____         __    __    _ | ||||||
|  | /__  /  ____ _/ /_  / /_  (_)  __ | ||||||
|  |   / /  / __ `/ __ \/ __ \/ / |/_/ | ||||||
|  |  / /__/ /_/ / /_/ / /_/ / />  < | ||||||
|  | /____/\__,_/_.___/_.___/_/_/|_| | ||||||
|  | \033[0m' | ||||||
|  |  | ||||||
|  | if [ "$EUID" -ne 0 ]; then | ||||||
|  |   echo "Please run as root" | ||||||
|  |   exit | ||||||
|  | fi | ||||||
|  |  | ||||||
|  |  | ||||||
|  | wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+stretch_all.deb | ||||||
|  | dpkg -i zabbix-release_3.0-2+stretch_all.deb | ||||||
|  |  | ||||||
|  | apt-get update -y | ||||||
|  |  | ||||||
|  | apt-get install zabbix-agent -y | ||||||
|  |  | ||||||
|  | # configure | ||||||
|  | echo -n "Please provide the zabbix-server's ip : " | ||||||
|  | read _ip | ||||||
|  | echo -n "Please provide the hostname of this agent : " | ||||||
|  | read _host_name | ||||||
|  |  | ||||||
|  | sed -i 's#Server=127.0.0.1#Server=$_ip#g' /etc/zabbix/zabbix-agent.confd | ||||||
|  | sed -i 's#Hostname=Zabbix server#Hostname=$_host_name#g' | ||||||
|  |  | ||||||
|  | systemctl restart zabbix-agent | ||||||
|  | systemctl enable zabbix-agent | ||||||
|  |  | ||||||
|  | echo -e "\033[92;1mZabbix-agent installed and configured, please add the host in your zabbix-server \033[Om" | ||||||
		Reference in New Issue
	
	Block a user
	 Bachir Soussi Chiadmi
					Bachir Soussi Chiadmi