(2024/11/30)
敬啟者:
高雄市政府日前全面性之網站弱點掃描報告中,貴校所屬之虛擬主機被檢測出有資安弱點,請依掃描報告指出之資安弱點檢查是依然存在,若仍存在者請依國際弱點網站建議方式修補弱點,修補範例如下方。
教育局將視弱點改善狀況應變,若再催告相同的IP、網站仍未改善者,本系統管理者將逕行該虛擬機停用。
謹請修補完成後回報系統管理員或資教中心!
<<修補範例>>:
請參照弱掃結果清單主機之「Finding」及「Description」資料進行弱點修補,若有相關弱點風險尚不清楚修補方式,建議可以針對關鍵字搜尋弱點或貴校使用的作業系統名稱進行了解修補建議。
例如:
Test
Finding
Description
建議解決方式
TLS Deprecated Protocols
TLS server supports deprecated protocols
Due to security weaknesses in the SSL protocol, it has been deprecated as a means for secure communications by multiple standards, including PCI-DSS and NIST. Please disable support for these protocols and move to updated TLS protocols.
**Supported deprecated protocols:**
TLSv1.1
建議停止使用TLSv1.1以下,並升級使用TLSv1.2以上協定。
Exposed Services Used in Ransomware Campaigns
Detected exposed ports and services that are prone to be used in ransomware campaigns
The detected services are known to be commonly used in ransomware campaigns and should not be publicly accessible.
**Service details:**
3389/tcp (RDP - Microsoft Terminal Server)
建議關閉不必要對外連線3389遠端連線Port。
Technologies with High Severity Vulnerabilities
Detected CVEs for PHP 8.2.12 with CVSS above 7.0
The detected technology has CVEs with a CVSS score higher than 7.0. It should be prioritized for patching, and addressed as part of the evaluation of Vulnerabilities and Risk Management policies.
建議更新PHP至較新版本。
<<弱點掃描結果>>:
Severity
Test
Finding
Asset
domain
IP
Description
Critical
Technologies with Known Exploited Vulnerabilities
Detected Apache HTTP Server 2.4.37 with CVE-2019-0211 appearing in KEV catalog
163.16.245.6
The detected technology was found to have a CVE that is currently being exploited by threat actors and therefore appears in the Known Exploitable Vulnerability catalog. This Finding is considered to be Critical as it may pose an immediate risk to the corporate security posture.
High
Technologies with High Severity Vulnerabilities
Detected CVEs for OpenSSL 1.1.1 with CVSS above 7.0
163.16.245.6
The detected technology has CVEs with a CVSS score higher than 7.0. It should be prioritized for patching, and addressed as part of the evaluation of Vulnerabilities and Risk Management policies.
High
TLS Certificate Untrusted
TLS certificate is not trusted
163.16.245.6
If your certificate is not trusted (for a variety of reasons), it can cause browsers to display warnings to visitors saying that your site is insecure.
**Reasons for TLS trust issues:**
The certificate is not valid for this hostname.
並且進入可以使用 SSL Server Test 檢查是否關閉
關閉方式檔案會在httpd/conf.d/ssl.conf這裡面 (/etc/httpd/conf.d/ssl.conf)
找一下SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
改成上面這樣就可以了,改完重啟apache即可。
[root@shsps conf.d]# systemctl stop httpd.service
[root@shsps conf.d]# systemctl start httpd.service
CentOS 8 的軟件源已無法訪問。這是因為 CentOS 8 的官方支援已於 2021 年底停止,官方軟件源已經被移除
考慮升級至 CentOS Stream 或 RHEL: CentOS 8 的生命周期已結束,您應考慮遷移到支援更長的版本,這可提高安全性與更新頻率。
遷移至 RHEL(免費開發者訂閱)。
使用其他 LTS 發行版,如 Rocky Linux 或 AlmaLinux。
==>最後將Centos8遷移到 Rocky Linux 8.1 (這好像是最簡單的方法)
遷移方法:
cat /etc/redhat-release (觀看版本)
wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
chmod +x migrate2rocky.sh (為 migrate2rocky.sh shell 腳本檔分配執行許可權。)
sudo bash migrate2rocky.sh -r
Done, please reboot your system. A log of this installation can be found at /var/log/migrate2rocky.log
运行以下命令以同步已安装的软件包,然后只需重新启动系统。
cat /etc/redhat-release
CVE-2019-0211 是一個針對 Apache HTTP Server 2.4.37 的嚴重漏洞,允許具有低權限的用戶執行提權攻擊,進而取得伺服器的完全控制權。以下是解決該問題的詳細步驟:
httpd -v (觀看httpd的版本)
升級httpd
從httpd-2.4.37-21(目前的)升級到httpd-2.4.37-65(Rocky Linux 8.1提供的最高版本)
dnf install httpd
但升級的版本還是httpd-2.4.37-65,不知是否還有CVE-2019-0211 嚴重漏洞?下次再能否升級到更高(如2.4.39)
[root@shsps ~]# rpm -qa |grep httpd
httpd-tools-2.4.37-65.module+el8.10.0+1842+4a9649e8.2.x86_64
httpd-2.4.37-65.module+el8.10.0+1842+4a9649e8.2.x86_64
httpd-filesystem-2.4.37-65.module+el8.10.0+1842+4a9649e8.2.noarch
rocky-logos-httpd-86.3-1.el8.noarch
重新安裝php
之前曾經移除掉 dnf remove php
後來又安裝了php-fpm
全部再重新安裝 dnf install php php-fpm php-mysqlnd php-opcache php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
# systemctl start php-fpm (啟動)
# systemctl enable php-fpm (設定開機自動執行 php)
# systemctl restart httpd (安裝及設定好 PHP 後需要重新啟動 Apache 才會生效)
結果升級到8.3.14版
可顯示info.php,但XOOPS、phpMyAdmin無法執行
下圖的https是後面處理才成功的
完全再執行上次的作法 09 使用 Let’s Encrypt 憑證
一直出問題,好像是因為少裝了 mod_ssl
[root@shsps conf.d]# sudo yum install mod_ssl
再重新跑如下動作就好了
[root@shsps conf.d]# sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or
space separated) (Enter 'c' to cancel): vm.shsps.kh.edu.tw
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
An RSA certificate named vm.shsps.kh.edu.tw-0003 already exists. Do you want to
update its key type to ECDSA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(U)pdate key type/(K)eep existing key type: K
Certificate not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/vm.shsps.kh.edu.tw-0003.conf)
What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Deploying certificate
We were unable to find a vhost with a ServerName or Address of vm.shsps.kh.edu.tw.
Which virtual host would you like to choose?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: ssl.conf | | HTTPS | Enabled
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press 1 [enter] to confirm the selection (press 'c' to cancel): 1
Successfully deployed certificate for vm.shsps.kh.edu.tw to /etc/httpd/conf.d/ssl.conf
Congratulations! You have successfully enabled HTTPS on https://vm.shsps.kh.edu.tw
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[root@shsps conf.d]# sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/vm.shsps.kh.edu.tw-0003.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for vm.shsps.kh.edu.tw
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/vm.shsps.kh.edu.tw.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Renewal configuration file /etc/letsencrypt/renewal/vm.shsps.kh.edu.tw.conf is broken.
The error was: target /etc/letsencrypt/archive/vm.shsps.kh.edu.tw/cert2.pem of symlink /etc/letsencrypt/live/vm.shsps.kh.edu.tw/cert.pem does not exist
Skipping.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
/etc/letsencrypt/live/vm.shsps.kh.edu.tw-0003/fullchain.pem (success)
Additionally, the following renewal configurations were invalid:
/etc/letsencrypt/renewal/vm.shsps.kh.edu.tw.conf (parsefail)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 renew failure(s), 1 parse failure(s)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
但xoops及phpMyAdmin 還是有問題
重新安裝phpMyAdmin-5.2.1
https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip
只是下載不同版本,其他作法與之前的講義都一樣
無法存取 $cfg['TempDir'] (/var/www/html/phpMyAdmin/tmp/)。phpMyAdmin 會無法快取模版,並且會因為此原因變得很慢。
mkdir tmp
chmod 777 tmp
尚未設定 phpMyAdmin 設定儲存空間,部份延伸功能將無法使用。 了解原因。
建立phpMyAdmin的資料庫(點一下就會建立了!!)
目前使用的 XOOPS 版本是2.5.10 使用的伺服器軟體及版本如下:
Apache/2.4.37
PHP Version 8.3.14、
mysql:MariaDB 10.11
請ChatGPT來解決問題:
chatGPT說:根據您提供的資訊,XOOPS 2.5.10 在 PHP 8.3 環境下可能無法完全兼容。XOOPS 2.5.10 官方建議的 PHP 版本上限通常是 PHP 7.x,因此 PHP 8.3 可能是問題的主要原因。
以下是解決方案的建議步驟:
XOOPS 2.5.10 對 PHP 8 支援有限,建議將 PHP 降級到官方推薦的穩定版本,例如 PHP 7.4 或更早的 PHP 7.3。
XOOPS 官方尚未釋出支援 PHP 8 的正式版,但有社群提供的補丁或解決方案:
到 XOOPS 官方網站 https://xoops.org/ 或 GitHub 頁面檢查是否有最新的補丁。
如果有升級路徑,嘗試使用支援 PHP 8 的開發版本(如 XOOPS 2.5.11RC)
上方資訊有錯:官網已釋出支援 PHP 8 的正式版( XOOPS 2.5.11 Final Released)
XOOPS 2.5.12 Beta-2 available for ...
13-Aug-2024 06:50 XOOPS Mamba
New Admin Theme for XOOPS (Beta)
28-May-2024 13:40 XOOPS Mamba
XOOPS 2.5.11 Final Released
24-Dec-2023 11:50 News Mamba
如果無法降級 PHP 或更新 XOOPS,可嘗試以下方法臨時解決問題:
但以下的方法好像都沒有用,先考慮上面2種方法來處理!!
方法二:升級xoops 2.5.10到2.5.11
方法一:把PHP從8.3.14版降為7.4版
執行以下指令確認目前安裝的 PHP 版本:
php -v
確認系統中是否有多個 PHP 版本:
dnf list installed | grep php
停止使用 PHP 8.3:
sudo dnf module reset php -y
移除 PHP 8.3 及其相關套件:
sudo dnf remove php*
Rocky Linux 提供官方模組倉庫支援 PHP 多個版本,也可以使用 Remi's Repository 提供的 PHP 7.4。
選擇 A:使用 Rocky Linux 官方倉庫
查看系統支援的 PHP 模組版本:
sudo dnf module list php
啟用 PHP 7.4 模組:
sudo dnf module enable php:7.4 -y
執行以下命令安裝 PHP 7.4 及其常見的擴展:
sudo dnf install -y php php-cli php-fpm php-mysqlnd php-pdo php-xml php-mbstring php-soap php-gd php-intl php-json
確認已成功安裝 PHP 7.4:
php -v
確保 PHP-FPM 正常啟動:
sudo systemctl enable php-fpm --now
sudo systemctl status php-fpm
清理系統中未使用的 PHP 8.3 套件:
sudo dnf autoremove
確認 PHP 7.4 是唯一有效版本:
which php
這次使用終端機的模式都是用如下的方法來做(root+新上我愛你)
httpd的版本還是使用2.4.37-65
OpenSSL 1.1.1還沒有升級 https://chatgpt.com/share/674d202e-50d0-8003-962e-6235ef433079
Excel檔可匯出,但檔案很小,明顯有問題
找以前的教材,就有此問題的解決方法
yum install -y php-zip
ystemctl restart httpd
問題解決