Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. clear
  4. #System update
  5. echo ~~Now Installing Update~~
  6. yum update -y
  7. clear
  8. echo ~~Update Installation Complete~~
  9. sleep 1
  10. echo "Server3.jelle.lan" > /etc/hostname
  11. systemctl restart systemd-hostnamed
  12.  
  13. #Variables
  14. ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
  15.  
  16. #Hosts file
  17. echo "Vul ip adress van uw Server 1"
  18. read n
  19.  
  20. echo "
  21. $n Server1.jelle.lan Server1" >> /etc/hosts
  22.  
  23. #Users
  24. adduser user1
  25. passwd user1
  26. useradd -ou 0 -g 0 user2
  27. passwd user2
  28. groupadd production
  29. usermod -a -G production user1
  30. usermod -a -G production user2
  31.  
  32. #DHCP
  33. sed -i 's/BOOTPROTO=none/BOOTPROTO=dhcp/g' /etc/sysconfig/network-scripts/ifcfg-eth0
  34. systemctl restart network
  35.  
  36. #SSH
  37. echo "
  38. DenyUsers user1
  39. DenyUsers root" >> /etc/ssh/sshd_config
  40. systemctl restart sshd.service
  41.  
  42. #NTP
  43. sed -i 's/server 0.centos.pool.ntp.org iburst/server 192.168.5.20 prefer/g' /etc/ntp.conf
  44. firewall-cmd --add-service=ntp --zone=internal --permanent
  45. firewall-cmd --reload
  46. systemctl restart ntpd
  47. systemctl enable ntpd
  48.  
  49. #Samba
  50. clear
  51. echo "Geef wachtwoord van user1"
  52. read p
  53. firewall-cmd --permanent --zone=internal --add-service=samba
  54. firewall-cmd --permanent --zone=internal --add-port=137/tcp
  55. firewall-cmd --permanent --zone=internal --add-port=138/tcp
  56. firewall-cmd --permanent --zone=internal --add-port=901/tcp
  57. firewall-cmd --reload
  58. mkdir /tempMount
  59. mount -t cifs -o username=user1,password=$p //192.168.5.20/public /tempMount
  60.  
  61. echo "
  62. //192.168.5.20/private /tempMount cifs x-systemd.automount,username=user1,password=$p, 0 0" >> /etc/fstab
  63. mount -a
  64.  
  65. #Rsyslog install
  66. echo ~~Now Installing Rsyslog~~
  67. yum install httpd php php-mysql wget -y
  68. systemctl enable httpd && systemctl start httpd
  69. yum install mariadb-server -y rsyslog-mysql -y
  70. systemctl enable mariadb && systemctl start mariadb
  71. mysql_secure_installation
  72. cd /usr/share/doc/
  73. mysql -u root -p < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
  74.  
  75. echo "Kopieer onderste en paste in terminal, sluit dit met ctrl + X
  76.  
  77. GRANT ALL ON Syslog.* TO rsyslog@localhost IDENTIFIED BY 'centos';
  78. FLUSH PRIVILEGES;
  79. exit" > tocopy
  80. nano tocopy
  81. mysql -u root -p
  82.  
  83. cp /etc/rsyslog.conf /etc/rsyslog.bak
  84. sed -i 's/#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf
  85. sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/g' /etc/rsyslog.conf
  86. sed -i 's/#$ModLoad imtcp/$ModLoad imtcp/g' /etc/rsyslog.conf
  87. sed -i 's/#$InputTCPServerRun 514/$InputTCPServerRun 514/g' /etc/rsyslog.conf
  88.  
  89. echo '
  90. # Load the MySQL Module
  91. module(load="ommysql")
  92. *.* :ommysql:127.0.0.1,Syslog,rsyslog,centos
  93. *.* @@192.168.5.20:514' >> /etc/rsyslog.conf
  94.  
  95. systemctl restart rsyslog
  96. cd /tmp
  97. wget http://download.adiscon.com/loganalyzer/loganalyzer-4.1.6.tar.gz
  98. tar -xzvf loganalyzer-4.1.6.tar.gz
  99. mkdir /var/www/html/loganalyzer
  100. cp -r /tmp/loganalyzer-4.1.6/src/ /var/www/html/loganalyzer
  101. cp -r /tmp/loganalyzer-4.1.6/contrib/* /var/www/html/loganalyzer
  102. cd /var/www/html/loganalyzer/src
  103. touch config.php
  104. chown apache:apache config.php
  105. chmod 777 config.php
  106. chcon -h -t httpd_sys_script_rw_t /var/www/html/loganalyzer/src/config.php
  107. service rsyslog restart
  108. systemctl enable rsyslog
  109. service httpd restart
  110. service mariadb restart
  111. firewall-cmd --permanent --zone=internal --add-port=514/tcp
  112. firewall-cmd --permanent --zone=internal --add-port=3306/tcp
  113. firewall-cmd --reload
  114.  
  115. clear
  116. echo "Reboot je Server3 en log in als user1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement