以往都習慣用 Rsyslog + logfmon 這樣的組合去做一些簡單網管小功能.
但 logfmon 這個好工具,已長久不再更新,故想改變一個方式,去取代這樣的組合.
https://xrcd2.blogspot.com/2016/11/logfmon.html
僅用 rsyslog 去做-->收到特定訊息的觸發動作
啟用 omprog 模組 在 rsyslog.conf 加上 module(load="omprog")
以往都習慣用 Rsyslog + logfmon 這樣的組合去做一些簡單網管小功能.
但 logfmon 這個好工具,已長久不再更新,故想改變一個方式,去取代這樣的組合.
https://xrcd2.blogspot.com/2016/11/logfmon.html
僅用 rsyslog 去做-->收到特定訊息的觸發動作
啟用 omprog 模組 在 rsyslog.conf 加上 module(load="omprog")
透過 Windows NPS 服務驗証 Cisco 設備登入機制
以往都習慣用 Linux + FreeRADIUS 去完成登入驗證(OTP)
https://xrcd2.blogspot.com/2016/01/cisco-radius-otp.html
這次換成 Windows NPS ,實驗截圖如下:
pfSense + FortiGate VPN 登入驗證使用 OTP
先前導讀相關 Blog
FreeRADIUS 搭配 Google Authenticator 完成 2FA [ 透過 pfSense ]
https://xrcd2.blogspot.com/2025/04/freeradius-google-authenticator-2fa.html
相關運用圖解如下 : PS: 圖左功能可由 pfSense 取代
相關問題參考:
透過 Apache log 可看看出目前 mod_wsgi (Web Server Gateway Interface [Python])的版本為何?
如 Python 3.9 的 wsgi 4.7.1 另 Python 3.12 則為 4.9.4 ,如下 log 所示:
Apache/2.4.62 (Oracle Linux Server) OpenSSL/3.2.2 mod_auth_gssapi/1.6.3 mod_wsgi/4.7.1 Python/3.9 configured -- resuming normal operations
Apache/2.4.62 (Oracle Linux Server) OpenSSL/3.2.2 mod_auth_gssapi/1.6.3 mod_wsgi/4.9.4 Python/3.12 configured -- resuming normal operations
相關資訊可以透過 dnf info 取得
[root@Oracle9 conf.modules.d]# dnf info mod_wsgi
Last metadata expiration check: 1:33:33 ago on Sun 27 Apr 2025 10:55:14 AM CST.
Available Packages
Name : mod_wsgi
Version : 4.7.1
Release : 11.el9
Architecture : src
Size : 705 k
Source : None
Repository : ol9_appstream
Summary : A WSGI interface for Python web applications in Apache
URL : https://modwsgi.readthedocs.io/
License : ASL 2.0
Description : The mod_wsgi adapter is an Apache module that provides a WSGI compliant
: interface for hosting Python based web applications within Apache. The
: adapter is written completely in C code against the Apache C runtime and
: for hosting WSGI applications within Apache has a lower overhead than using
: existing WSGI adapters for mod_python or CGI.
[root@Oracle9 conf.modules.d]# dnf info python3.12-mod_wsgi
Last metadata expiration check: 1:34:08 ago on Sun 27 Apr 2025 10:55:14 AM CST.
Installed Packages
Name : python3.12-mod_wsgi
Version : 4.9.4
Release : 2.el9
Architecture : x86_64
Size : 1.1 M
Source : python3.12-mod_wsgi-4.9.4-2.el9.src.rpm
Repository : @System
From repo : ol9_appstream
Summary : A WSGI interface for Python web applications in Apache
URL : https://modwsgi.readthedocs.io/
License : ASL 2.0 and CC-BY
Description : The mod_wsgi adapter is an Apache module that provides a WSGI compliant
: interface for hosting Python based web applications within Apache. The
: adapter is written completely in C code against the Apache C runtime and
: for hosting WSGI applications within Apache has a lower overhead than using
: existing WSGI adapters for mod_python or CGI.
指定安裝
# dnf install python3.12-mod_wsgi.x86_64
切換作業系統所使用的 Python 版本.
[root@Oracle9 conf.modules.d]# alternatives --config python3
There are 2 programs which provide 'python3'.
Selection Command
-----------------------------------------------
*+ 1 /usr/bin/python3.12
2 /usr/bin/python3.11
Enter to keep the current selection[+], or type selection number:
[root@Oracle9 conf.modules.d]# python -V
Python 3.12.5
[root@Oracle9 conf.modules.d]# cat /opt/privacyidea/requirements.txt | more
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt
#
alembic==1.14.1 \
--hash=sha256:1acdd7a3a478e208b0503cd73614d5e4c6efafa4e73518bb60e4f2846a37b1c5 \
--hash=sha256:496e888245a53adf1498fcab31713a469c65836f8de76e01399aa1c3e90dd213
# via flask-migrate
==> mod_wsgi-py312.cpython-312-x86_64-linux-gnu.so
# cp mod_wsgi-py312.cpython-312-x86_64-linux-gnu.so /etc/httpd/modules/
# vi /etc/httpd/conf.modules.d/10-wsgi-python3.conf
[root@Oracle9 httpd]# cat /etc/httpd/conf.modules.d/10-wsgi-python3.conf
# NOTE: mod_wsgi_python3 can not coexist in the same apache process as
# mod_wsgi (python2). Only load if mod_wsgi is not already loaded.
<IfModule !wsgi_module>
#LoadModule wsgi_module modules/mod_wsgi_python3.so
LoadModule wsgi_module modules/mod_wsgi-py312.cpython-312-x86_64-linux-gnu.so
</IfModule>
Apache log
=> Apache/2.4.62 (Oracle Linux Server) OpenSSL/3.2.2 mod_auth_gssapi/1.6.3 mod_wsgi/5.0.2 Python/3.12 configured -- resuming normal operations
[root@Oracle9 httpd]#
PrivacyIDEA 整合 Apache + mod_wsgi 能否正常運行
要確定 Apache 內的 privacyidea.conf 是否正確.
# vi /etc/httpd/conf.d/privacyidea.conf
Continue
privacyIDEA [ 2FA/OTP Test ]
https://xrcd2.blogspot.com/2025/04/privacyidea.html
privacyIDEA [ 2FA/RDP Test ]
使用軟體 pfsense
關於這個主題我之前寫的筆記
https://xrcd2.blogspot.com/2015/03/vyos-openvpn-plugin-otp-sop.html
https://xrcd2.blogspot.com/2016/01/cisco-radius-otp.html
https://xrcd2.blogspot.com/2016/09/vyosopenvpnmfa.html
https://xrcd2.blogspot.com/2024/06/how-to-use-otp-login-windows-vyos.html
以往都透過 Linux 安裝 FreeRADIUS 搭配 Google Authenticator 完成 2FA
後來在網上發現使用 pfsense 更簡單些,以下實驗內網IP為 192.168.100.0/24 GW 254
先將 pfsense 的 WAN Port 設定為 192.168.100.x , 系統預設 LAN Port IP 192.168.1.1/24
更新 pfsense 後,安裝 FreeRADIUS 後,刪除 WAN port IP 再將 LAN Port IP 設定成 192.168.1.254
重要設定畫面節錄如下:
透過 CLI 變更 IP 設定後