วิธีการ Renew Free SSL Let's encrypt บนเครื่อง Zabbix และ Ezyadmin 1. ให้ดำเนินการ Generate SSL โดยไปที่ Website : https://www.sslforfree.com/ 2. ดำเนินการใส่ข้อมูล URL ที่ต้องการติดตั้ง Free ssl ลงไป และดำเนินการ Click : Manual Verification 3. จากนั้นให้ทำการสร้างไฟล์เพื่อยืนยันตัวตนในการใช้งาน Free ssl 3.1 เครื่อง ezazbweb1.ezyadmin.com (Zabbix server) ให้ทำการสร้างไฟล์ไว้ที่ >>> /var/www/html/.well-known/acme-challenge/ 3.2 เครื่อง netway.ezyadmin.com (eza05.netway.co.th) ให้ทำการสร้างไฟล์ไว้ที่ >>> /home/netway/app/frontend/semaphore/clientsite/.well-known/acme-challenge/ หลังจากทำการสร้างไฟล์ยืนยันตัวตนเรียบร้อยแล้วให้ทำการ Verify โดย Click : Download SSL Certtificate 4. หากดำเนินการยืนยันตัวตนสำเร็จระบบจัด Generate Key , Certificate , Intermediate CA ให้โดยอัตโนมัติ จากนั้นให้ทำการ Copy ข้อมูลที่ได้ไปไว้ในแต่ละส่วนให้ถูกต้อง 4.1 เครื่อง ezazbweb1.ezyadmin.com (Zabbix server) ให้ทำการสร้างไฟล์ไว้ที่ - Key >>> /etc/httpd/ssl/private/ezazbweb1.key - Certificate >>> /etc/httpd/ssl/private/ezazbweb1.crt - Intermediate CA >>> /etc/httpd/ssl/private/ezazbweb1.ca-bundle 4.2 เครื่อง netway.ezyadmin.com (eza05.netway.co.th) ก่อนอื่นให้เข้าไปที่ Container บนเครื่อง eza05.netway.co.th ก่อนจากโดยใช้คำสั่ง docker exec -it appserver /bin/bash จากนั้นให้ทำการแก้ไขข้อมูลที่ - Key >>> /app/backend/lib/ssl2/netway_ezyadmin.key - Certificate >>> /app/backend/lib/ssl2/netway_ezyadmin.cert - Intermediate CA >>> /app/backend/lib/ssl2/netway_ezyadmin.ca **** หลังจากนั้นให้ทำการ restart : pm2 restart 0 ****
ปัญหา เนื่องจากการตั้งค่า System filter path default cPanel ก่อนหน้านี้นั้นเมื่อทำการ Save Exim configuration จะส่งผลให้ค่า Config filter ที่มีการสร้างไว้ทั้งหมดหายไปทันที วิธีการตั้งค่า System filter Block domain 1. หากต้องการตั้งค่า System block domain ให้ดำเนินการ Config ที่ไฟล์ /usr/local/cpanel/etc/exim/sysfilter/options/netway_filters [root@system ~]# nano -w /usr/local/cpanel/etc/exim/sysfilter/options/netway_filters 2. ตัวอย่างการเพิ่ม Rule System block domain if ("$header_from:" contains "qqq.com") then seen finish endif 3. หลังจากแก้ไข Config ที่ต้องการเรียบร้อยแล้วให้ทำการ Buildeximconfig ทุกครั้ง [root@system ~]# /scripts/buildeximconf วิธีการตั้งค่า Auto BCC Email 1. หากต้องการตั้งค่า Auto BCC Email ให้ดำเนินการ Config ที่ไฟล์ /usr/local/cpanel/etc/exim/sysfilter/options/netway_filters [root@system ~]# nano -w /usr/local/cpanel/etc/exim/sysfilter/options/netway_filters 2. ตัวอย่างการเพิ่ม Auto BCC Email if $sender_address contains useremail@domain.com (ชื่อ Account Email ที่ต้องการ Auto BCC) then unseen deliver bccto@domain.com (ชื่อ Account ปลายทางที่ต้องการให้ได้รับ Auto BCC) endif กรณีต้องการ Auto BCC ไปที่หลายๆปลายทางสามารถทำการเพิ่มบรรทัดunseen deliver ได้ตามความต้องการ 3. หลังจากแก้ไข Config ที่ต้องการเรียบร้อยแล้วให้ทำการ Buildeximconfig ทุกครั้ง [root@system ~]# /scripts/buildeximconf หมายเหตุ : หากต้องการลบข้อมูล Auto BCC ให้ทำในรูปแบบนี้ตามข้อ 1 เหมือนการเพิ่ม Auto BCC นะครับ
Install Zabbix_proxy on Windows serverขั้นตอนการติดตั้ง Zabbix_proxy1. ทำการ Remote desktop เข้าที่ Windows server เพื่อทำการติดตั้ง VirtualBox2. ทำการ Download VirtualBox เพื่อใช้ในการสร้าง Ubuntu server สำหรับการติดตั้ง Zabbix_proxy โดยสามารถทำการ Download ได้ที่ https://download.virtualbox.org/virtualbox/6.0.14/VirtualBox-6.0.14-133895-Win.exe3. หลังจากทำการติดตั้ง VirtualBox เรียบร้อยแล้วให้ทำการสร้าง OS Ubuntu server ขึ้นมา 4. เมื่อทำการสร้าง Ubuntu server เรียบร้อยแล้วให้ทำการแก้ไข Config Network ให้ถูกต้อง 4.1 แก้ไขที่ VirtualBox โดยไปที่ Setting >> Network โดยให้ทำการแก้ไขที่Attached to : Bridged Adapter Name : เลือก Network ที่เครื่อง Windows server ใช้งาน 4.2 ทำการ access เข้าที่ Ubuntu server ที่ทำการสร้างขึ้นมาเพื่อแก้ไขไฟล์ Config network [root@ubuntu ~]# cp -a /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak [root@ubuntu ~]# nano -w /etc/netplan/50-cloud-init.yaml # This file is generated from information provided by# the datasource. Changes to it will not persist across an instance.# To disable cloud-init's network configuration capabilities, write a file# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:# network: {config: disabled}network: ethernets: enp0s3: addresses: [192.168.100.147/24] ใส่ ip server ที่ต้องการโดยจะต้องมี /24 เพื่อกำหนดเป็น ip เดียว gateway4: 192.168.100.2 ระบุ gateway ให้ถูกต้อง dhcp4: no nameservers: addresses: [8.8.8.8,8.8.4.4] optional: true version: 2 [root@ubuntu ~]# apt install net-tools[root@ubuntu ~]# netplan apply[root@ubuntu ~]# ifconfig 5. ทำการ Download package เพื่อใช้ในการติดตั้ง [root@ubuntu ~]# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+bionic_all.deb[root@ubuntu ~]# dpkg -i zabbix-release_4.0-3+bionic_all.deb[root@ubuntu ~]# apt update 6. ทำการติดตั้ง Zabbix_proxy [root@ubuntu ~]# apt install zabbix-proxy-mysql 7. ทำการสร้าง Zabbix Proxy database โดยให้ทำการติดตั้ง mariadb-server ก่อน[root@ubuntu ~]# apt install mariadb-server[root@ubuntu ~]# systemctl enable mariadb && systemctl start mariadb[root@ubuntu ~]# systemctl status mariadb 8.ทำการ Run mysql_secure_installation และกำหนด root database password [root@ubuntu ~]# mysql_secure_installation 9.ทำการสร้างฐานข้อมูลสำหรับ Zabbix_proxy และกำหนด privileges ในการใช้งาน Database [root@ubuntu ~]# mysql -u root -pEnter password: ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;MariaDB [(none)]> grant all privileges on zabbix_proxy.* to zabbixuser@localhost identified by "Password";MariaDB [(none)]> flush privileges; 10.ทำการ Import schema [root@ubuntu ~]# zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz | mysql -u zabbixuser zabbix_proxy -pEnter password: ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5 11.ทำการ Config zabbix_proxy[root@ubuntu ~]# nano -w /etc/zabbix/zabbix_proxy.confServer=< ใส่ IP ของ zabbix server Ex. 203.78.103.9>Hostname=<ใส่ชื่อ Zabbix-proxy ที่เราต้องการจะสร้าง>DBName=<ใส่ข้อมูล Database name ก่อนหน้านี้เรากำหนดเป็น zabbix_proxy >DBUser=<ใส่ข้อมูล Database User ก่อนหน้านี้เรากำหนดเป็น zabbixuser>DBPassword=<ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5> 12. หลังจากทำการ Config zabbix_proxy เรียบร้อยแล้ว ให้ทำการติดตั้ง csf firewall เพื่อทำการเปิด Port 10050-10052 [root@ubuntu ~]# cd /usr/src [root@ubuntu ~]# rm -fv csf.tgz [root@ubuntu ~]# wget https://download.configserver.com/csf.tgz [root@ubuntu ~]# tar -xzf csf.tgz [root@ubuntu ~]# cd csf [root@ubuntu ~]# sh install.sh 13. ทำการ Allow port 10050-10052 [root@ubuntu ~]# nano -w /etc/csf/csf.conf # Allow incoming TCP portsTCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,10050,10051,10052" # Allow outgoing TCP portsTCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,10050,10051,10052" 14. ทำการติดตั้ง Package พื้นฐานเพิ่มเติม [root@ubuntu ~]# apt install unzip[root@ubuntu ~]# apt install sendmail[root@ubuntu ~]# apt install libwww-perl[root@ubuntu ~]# apt install snmp 15. ทำการ Restart service zabbix_proxy [root@ubuntu ~]# systemctl enable zabbix-proxy[root@ubuntu ~]# systemctl start zabbix-proxy Add Zabbix_proxy to Zabbix_server 1. Go to Zabbix_server dashboard >> Administrator >> Proxies >> Create proxy Add Zabbix_agent to Zabbix_proxy 1. เมื่อทำการติดตั้ง Zabbix_agent บนเครื่อง Local ที่ต้องการให้ Zabbix_proxy monitor เรียบร้อยแล้วให้ทำการ Config zabbix_agent [ local server ~]# nano -w /etc/zabbix/zabbix_agentd.confServer=<ใส่ ip zabbix_proxy Ex.192.168.100.150>ServerActive=<ใส่ ip zabbix_proxy Ex.192.168.100.150>Hostname=<ใส่ Hostname ของเครื่อง Local server ที่เราต้องการ> 2. ทำการ Restart service zabbix_agent [root@system ~]# systemctl restart zabbix-agent 3. หลังจากทำการ Config zabbix_agent เรียบร้อยแล้วให้ดำเนินการ add server บน Zabbix_server dashboard Go to Zabbix_server dashboard >> Configuration >> Hosts >> Create host
Install Zabbix_proxy on CentOs8 ขั้นตอนการติดตั้ง Zabbix_proxy 1. ทำการ access root login on CentOs8 2. ทำการ Download package เพื่อใช้ในการติดตั้ง [root@system ~]# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX[root@system ~]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/8/x86_64/zabbix-release-4.0-2.el8.noarch.rpm 3. ทำการติดตั้ง Zabbix_proxy [root@system ~]# yum install zabbix-proxy-mysql 4. ทำการสร้าง Zabbix Proxy database โดยให้ทำการติดตั้ง mariadb-server ก่อน [root@system ~]# yum install mariadb-server[root@system ~]# systemctl enable mariadb && systemctl start mariadb[root@system ~]# systemctl status mariadb 5. ทำการ Run mysql_secure_installation และกำหนด root database password [root@system ~]# mysql_secure_installation 6. ทำการสร้างฐานข้อมูลสำหรับ Zabbix_proxy และกำหนด privileges ในการใช้งาน Database [root@system ~]# mysql -u root -pEnter password: ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;MariaDB [(none)]> grant all privileges on zabbix_proxy.* to zabbixuser@localhost identified by "Password";MariaDB [(none)]> flush privileges; 7. ทำการ Import schema [root@system ~]# zcat /usr/share/doc/zabbix-proxy-mysql/schema.sql.gz | mysql -u zabbixuser zabbix_proxy -pEnter password: ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5 8. ตรวจสอบว่า Server มีการปิด SElinux แล้วหรือไม่ หากยังไม่ทำการปิดให้ทำการ Disable SElinux ให้เรียบร้อยก่อน [root@system ~]# nano -w /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of these three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection.SELINUXTYPE=targeted 9. ทำการ Config zabbix_proxy [root@system ~]# nano -w /etc/zabbix/zabbix_proxy.confServer=< ใส่ IP ของ zabbix server Ex. 203.78.103.9>Hostname=<ใส่ชื่อ Zabbix-proxy ที่เราต้องการจะสร้าง>DBName=<ใส่ข้อมูล Database name ก่อนหน้านี้เรากำหนดเป็น zabbix_proxy >DBUser=<ใส่ข้อมูล Database User ก่อนหน้านี้เรากำหนดเป็น zabbixuser>DBPassword=<ทำการกรอก root database password ที่สร้างในขั้นตอนที่ 5> 10. หลังจากทำการ Config zabbix_proxy เรียบร้อยแล้ว ให้ทำการ Allow port 10050,10051,10052 ในส่วนของ TCP in และ TCP OUT 11. ทำการ Restart service zabbix_proxy [root@system ~]# systemctl enable zabbix-proxy[root@system ~]# systemctl start zabbix-proxy Add Zabbix_proxy to Zabbix_server 1. Go to Zabbix_server dashboard >> Administrator >> Proxies >> Create proxy Add Zabbix_agent to Zabbix_proxy 1. เมื่อทำการติดตั้ง Zabbix_agent บนเครื่อง Local ที่ต้องการให้ Zabbix_proxy monitor เรียบร้อยแล้วให้ทำการ Config zabbix_agent [ local server ~]# nano -w /etc/zabbix/zabbix_agentd.confServer=<ใส่ ip zabbix_proxy Ex.192.168.100.150>ServerActive=<ใส่ ip zabbix_proxy Ex.192.168.100.150>Hostname=<ใส่ Hostname ของเครื่อง Local server ที่เราต้องการ> 2. ทำการ Restart service zabbix_agent [root@system ~]# systemctl restart zabbix-agent 3. หลังจากทำการ Config zabbix_agent เรียบร้อยแล้วให้ดำเนินการ add server บน Zabbix_server dashboard Go to Zabbix_server dashboard >> Configuration >> Hosts >> Create host
ขั้นตอนการติดตั้ง Zabbix agent บน Windows server 1. ทำการ Remote Desktop เข้าที่ Server ที่ต้องการติดตั้ง 2. ทำการ Download โดยสามารถทำการ Download ผ่าน Browser 3. ทำการ Extract file ที่ได้จากการ Download และทำการติดตั้ง ตามรายละเอียดด้านล่าง 4. ทำการ Download file Config และ File get metadata โดยสามารถทำการ Download ได้ที่ : http://203.78.107.84/zabbix_windows.tar.gz 5. ทำการ Extract file Config และ File get metadata จะได้ไฟล์ - zabbix_agentd.conf - get_server_for_zabbix.pl 6. ทำการ Move file ที่ได้ไปที่ C:\Program Files\Zabbix Agent 7. ทำการแก้ไขไฟล์ zabbix_agentd.conf โดยให้ทำการแก้ไขในส่วนของ- Server=203.78.103.9 - ServerActive=203.78.103.9 - Hostname=[Servername] 8. ทำการติดตั้ง Strawberryperl เพื่อให้สามารถใช้งานคำสั่ง perl ได้ - Download and setup perl from http://strawberryperl.com - Install CPAN module with command line ผ่านโปรแกรม strawberryperl > cpan Win32 Net::Domain User Win32::Service 9. เปิดโปรแกรม Powershell จากนั้น Run คำสั่ง - ทำการ Run : cd 'C:\Program Files\Zabbix Agent\' -ทำการ Run : perl .\get_server_for_zabbix.pl 10. ทำการ Allow port 10050 , 10051 , 10052 ในส่วนของ Firewall ทั้ง TCP IN และ TCP OUT 11. ทำการ Restart zabbix_agentd โดยสามารถดำเนินการได้โดย - กดที่เมนู Run จากนั้นใส่ข้อมูล services.msc - ทำการ Restart zabbix_agentd