หากต้องการใช้วิธีการดังกล่าวต้องตรวจสอบข้อมูลให้ครบถ้วนดังนี้1. จะใช้ข้อมูลในการ Clear queue mail ดังกล่าวต่อเมื่อมีปริมาณสูงมากๆ เช่นตั้งแต่ 500,000 queue เป็นต้นไป2. ในระหว่างขั้นตอนการดำเนินการตลอดจนเสร็จสิ้นต้องแน่ใจว่า Service exim ไม่ Start ขึ้นมา "เด็ดขาด"3. ต้องทำการ Confirm กับลูกค้าว่าสามารถดำเนินการลบได้ทั้งหมดหรือไม่ ปัญหา ไม่สามารถทำการ Clear queue mail ปริมาณมากๆออกจาก Server ได้ วิธีการแก้ไข 1. Access SSH เข้าไปที่ Server ที่ต้องการ 2. ทำการ Stop service exim : /etc/init.d/exim stop [root@vps ~]#/etc/inin.d/exim stop หรือ [root@vps ~]#systemctl stop exim.service 3. run : cd /var/spool/exim [root@vps ~]#cd /var/spool/exim 4. run : find input -type f -exec rm -rf {} \; [root@vps ~]#find input -type f -exec rm -rf {} \; 5. run : find msglog -type f -exec rm -rf {} \; [root@vps ~]#find msglog -type f -exec rm -rf {} \; 6. service exim restart : /etc/init.d/exim restart [root@vps ~]#/etc/inin.d/exim restart หรือ [root@vps ~]#systemctl restart exim.service ทุกขั้นตอนในการดำเนินการ Service exim จะต้องถูก Stop ตลอดเวลา
ปัญหา เมื่อทำการ modify account ผ่าน WHM แล้วเครื่อง Server reset ทันที สาเหตุ เกิดจาก Kernel ที่ใช้งานมีปัญหา วิธีการตรวจสอบ 1. ตรวจสอบในส่วนของ /var/log/messages จะพบ Error Sep 20 14:21:40 netway40 kcare: Unknown Kernel (CloudLinux 3.10.0-793.21.1.lve1.5.20.el7.x86_64)Sep 20 14:21:40 netway40 kcare: Unknown Kernel (CloudLinux 3.10.0-793.21.1.lve1.5.20.el7.x86_64)Sep 20 14:21:40 netway40 systemd: PID file /run/apache2/httpd.pid not readable (yet?) after start.Sep 20 14:21:40 netway40 systemd: Started Apache web server managed by cPanel EasyApache.Sep 20 14:21:41 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:41 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:41 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:41 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:41 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:42 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:42 netway40 pure-ftpd: (?@61.91.33.142) [INFO] New connection from 61.91.33.142Sep 20 14:21:42 netway40 pure-ftpd: (?@61.91.33.142) [INFO] udon@thevaluation.com is now logged inSep 20 14:21:42 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:45 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:45 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064)Sep 20 14:21:45 netway40 cagefs-liblve: Act like CageFS is disabled (unable to acquire lock for user punparkc uid 1064) 2. ตรวจสอบ kernel ที่ใช้งานอยู่ปัจจุบัน [root@netway40 ~]# uname -r3.10.0-793.21.1.lve1.5.20.el7.x86_64 [root@netway40 ~]# kcare-uname -r3.10.0-793.21.1.lve1.5.20.el7.x86_64 [root@netway40 ~]# kcarectl --checkUnknown kernel (CloudLinux 3.10.0-793.21.1.lve1.5.20.el7.x86_64), no patches available แนวทางการแก้ไข เลือกใช้ kernel ที่ถูกต้อง จากตัวอย่างจะเป็น version : 3.10.0-714.10.2.lve1.5.17.1.el7.x86_64 ข้อมูลเปรียบเทียบ สามารตรวจสอบ version kernel เพื่อใช้ในการเปรียบเทียบได้จาก https://patches.kernelcare.com/
วิธีการใช้คำสั่ง sar เพื่อค้นหาข้อมูล Server ย้อนหลัง 1. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล load average ของ server ตามวันที่เรากำหนด โดยจะ Report ข้อมูลตั่งแต่เวลา 00.00น. - 23.59น. ของวันที่ต้องการ ตัวอย่างการใช้คำสั่งค้นหาในวันที่ 23 sar -q -f /var/log/sa/sa23 2. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล load average ของ server ในวันปัจจุบันโดยจะทำการ Report ข้อมูลตั้งแต่เวลา 00.00น. ถึงเวลาปัจจุบัน sar -q 3. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล CPU load average ของ server ในวันปัจจุบันโดยจะทำการ Report ข้อมูลตั้งแต่เวลา 00.00น. ถึงเวลาปัจจุบัน sar -p 4. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล RAM Usage ของ server ในวันปัจจุบันโดยจะทำการ Report ข้อมูลตั้งแต่เวลา 00.00น. ถึงเวลาปัจจุบัน sar -r 5. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล Swap Usage ของ server ในวันปัจจุบันโดยจะทำการ Report ข้อมูลตั้งแต่เวลา 00.00น. ถึงเวลาปัจจุบัน sar -S 6. การใช้คำสั่ง sar เพื่อตรวจสอบข้อมูล I/O Usage ของ server ในวันปัจจุบันโดยจะทำการ Report ข้อมูลตั้งแต่เวลา 00.00น. ถึงเวลาปัจจุบัน sar -d
ปัญหา เว็บไซต์ ติด virus, malware, exploit, hacked ทางแก้ปัญหา root@netway19 [~]# cd /root root@netway19 [~]# git clone https://github.com/Hestat/lw-yara.git แล้วทำการ scan ด้วยคำสั่ง root@netway19 [~]# clamscan -ir -d /root/lw-yara/lw-rules_index.yar /home/$user/public_html/ ในส่วนนี้มันจะ list file ขึ้นมาว่าไฟล์ไหนที่เป็นปัญหา ก็ให้เข้าไปแก้ไขไฟล์ที่เป็นปัญหาตาม list นี้ครับ สาเหตุปัญหา เว็บไซต์ ถูก hacked แล้วอัพโหลด script ที่ไม่พึงประสงค์ ขึ้นมา อ้างอิง : https://laskowski-tech.com/2018/04/26/eitest-cleanup-part-2-using-clamav-and-custom-yara-rules/
ปัญหา ไม่สามารถ run คำสั่ง yum ได้ Error ที่พบ [root@vps ~]# yum --helperror: rpmdb: BDB0113 Thread/process 9618/140007521281856 failed: BDB1507 Thread died in Berkeley DB libraryerror: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recoveryerror: cannot open Packages index using db5 - (-30973)error: cannot open Packages database in /var/lib/rpmCRITICAL:yum.main: Error: rpmdb open failed วิธีการแก้ไขปัญหา 1. ssh to server and go to /var/lib/rpm [root@vps ~]# cd /var/lib/rpm/ 2. ตรวจสอบไฟล์ที่ชื่อ __db.00? [root@vps rpm]# ls -altotal 105036drwxr-xr-x 2 root root 4096 May 14 04:18 .drwxr-xr-x 25 root root 4096 Aug 24 2017 ..-rw-r--r-- 1 root root 5947392 May 30 04:32 Basenames-rw-r--r-- 1 root root 16384 May 30 04:32 Conflictname-rw-r--r-- 1 root root 270336 Aug 27 11:48 __db.001-rw-r--r-- 1 root root 81920 Aug 27 11:48 __db.002-rw-r--r-- 1 root root 1318912 Aug 27 11:48 __db.003-rw-r--r-- 1 root root 0 Apr 1 2015 .dbenv.lock-rw-r--r-- 1 root root 2990080 May 30 04:32 Dirnames-rw-r--r-- 1 root root 40960 May 30 04:32 Group-rw-r--r-- 1 root root 36864 May 30 04:32 Installtid-rw-r--r-- 1 root root 188416 May 30 04:32 Name-rw-r--r-- 1 root root 32768 May 30 04:32 Obsoletename-rw-r--r-- 1 root root 90755072 May 30 04:32 Packages-rw-r--r-- 1 root root 4976640 May 30 04:32 Providename-rw-r--r-- 1 root root 593920 May 30 04:32 Requirename-rw-r--r-- 1 root root 0 Apr 1 2015 .rpm.lock-rw-r--r-- 1 root root 253952 May 30 04:32 Sha1header-rw-r--r-- 1 root root 139264 May 30 04:32 Sigmd5-rw-r--r-- 1 root root 8192 May 30 04:31 Triggername 3. ทำการลบไฟล์ __db.00? [root@vps rpm]# rm __db.00*rm: remove regular file ‘__db.001’? yrm: remove regular file ‘__db.002’? yrm: remove regular file ‘__db.003’? y 4.รันคำสั่ง Rebuild DB [root@vps rpm]# rpm --rebuilddb 5. รันคำสั่ง clean [[root@vps rpm]# yum clean allLoaded plugins: fastestmirror, universal-hooksCleaning repos: EA4 cpanel-addons-production-feed base extras updatesCleaning up everythingMaybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed reposCleaning up list of fastest mirrors 6. ทดสอบรันคสั่ง yum อีกครั้ง [root@vps rpm]# yum --helpLoaded plugins: fastestmirror, universal-hooksUsage: yum [options] COMMAND List of Commands: check Check for problems in the rpmdbcheck-update Check for available package updatesclean Remove cached datadeplist List a package's dependenciesdistribution-synchronization Synchronize installed packages to the latest available versionsdowngrade downgrade a packageerase Remove a package or packages from your systemfs Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.groups Display, or use, the groups informationhelp Display a helpful usage messagehistory Display, or use, the transaction historyinfo Display details about a package or group of packagesinstall Install a package or packages on your systemlist List a package or groups of packagesload-transaction load a saved transaction from filename ....