Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- clear
- #System update
- echo ~~Now Installing Update~~
- yum update -y
- clear
- echo ~~Update Installation Complete~~
- sleep 1
- echo "Server3.jelle.lan" > /etc/hostname
- systemctl restart systemd-hostnamed
- #Variables
- ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
- #Hosts file
- echo "Vul ip adress van uw Server 1"
- read n
- echo "
- $n Server1.jelle.lan Server1" >> /etc/hosts
- #Users
- adduser user1
- passwd user1
- useradd -ou 0 -g 0 user2
- passwd user2
- groupadd production
- usermod -a -G production user1
- usermod -a -G production user2
- #DHCP
- sed -i 's/BOOTPROTO=none/BOOTPROTO=dhcp/g' /etc/sysconfig/network-scripts/ifcfg-eth0
- systemctl restart network
- #SSH
- echo "
- DenyUsers user1
- DenyUsers root" >> /etc/ssh/sshd_config
- systemctl restart sshd.service
- #NTP
- sed -i 's/server 0.centos.pool.ntp.org iburst/server 192.168.5.20 prefer/g' /etc/ntp.conf
- firewall-cmd --add-service=ntp --zone=internal --permanent
- firewall-cmd --reload
- systemctl restart ntpd
- systemctl enable ntpd
- #Samba
- clear
- echo "Geef wachtwoord van user1"
- read p
- firewall-cmd --permanent --zone=internal --add-service=samba
- firewall-cmd --permanent --zone=internal --add-port=137/tcp
- firewall-cmd --permanent --zone=internal --add-port=138/tcp
- firewall-cmd --permanent --zone=internal --add-port=901/tcp
- firewall-cmd --reload
- mkdir /tempMount
- mount -t cifs -o username=user1,password=$p //192.168.5.20/public /tempMount
- echo "
- //192.168.5.20/private /tempMount cifs x-systemd.automount,username=user1,password=$p, 0 0" >> /etc/fstab
- mount -a
- #Rsyslog install
- echo ~~Now Installing Rsyslog~~
- yum install httpd php php-mysql wget -y
- systemctl enable httpd && systemctl start httpd
- yum install mariadb-server -y rsyslog-mysql -y
- systemctl enable mariadb && systemctl start mariadb
- mysql_secure_installation
- cd /usr/share/doc/
- mysql -u root -p < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
- echo "Kopieer onderste en paste in terminal, sluit dit met ctrl + X
- GRANT ALL ON Syslog.* TO rsyslog@localhost IDENTIFIED BY 'centos';
- FLUSH PRIVILEGES;
- exit" > tocopy
- nano tocopy
- mysql -u root -p
- cp /etc/rsyslog.conf /etc/rsyslog.bak
- sed -i 's/#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf
- sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/g' /etc/rsyslog.conf
- sed -i 's/#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf
- sed -i 's/#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf
- echo '
- # Load the MySQL Module
- module(load="ommysql")
- *.* :ommysql:127.0.0.1,Syslog,rsyslog,centos
- *.* @@192.168.5.20:514' >> /etc/rsyslog.conf
- systemctl restart rsyslog
- cd /tmp
- wget http://download.adiscon.com/loganalyzer/loganalyzer-4.1.6.tar.gz
- tar -xzvf loganalyzer-4.1.6.tar.gz
- mkdir /var/www/html/loganalyzer
- cp -r /tmp/loganalyzer-4.1.6/src/ /var/www/html/loganalyzer
- cp -r /tmp/loganalyzer-4.1.6/contrib/* /var/www/html/loganalyzer
- cd /var/www/html/loganalyzer/src
- touch config.php
- chown apache:apache config.php
- chmod 777 config.php
- chcon -h -t httpd_sys_script_rw_t /var/www/html/loganalyzer/src/config.php
- service rsyslog restart
- systemctl enable rsyslog
- service httpd restart
- service mariadb restart
- firewall-cmd --permanent --zone=internal --add-port=514/tcp
- firewall-cmd --permanent --zone=internal --add-port=3306/tcp
- firewall-cmd --reload
- clear
- echo "Reboot je Server3 en log in als user1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement