Webmin 2.670 配置参数详解

逐项详解 Webmin 2.670 配置体系:miniserv.conf 50 键(端口/SSL/会话/日志/防爆破)、全局 config 与模块级配置的查看修改实测,含生产加固模板与 start-limit-hit 等排障实录。

WebminWebmin服务器管理2026/10/21

Webmin 2.670 配置参数详解

目标:逐项讲清 Webmin 2.670 在 Ubuntu 22.04 上安装后的配置体系——核心服务配置 /etc/webmin/miniserv.conf、全局配置 /etc/webmin/config 与模块级配置的查看方法、参数含义、修改方式与生效验证,并给出可直接落地的生产加固模板。全部参数值取自真实安装环境实测,修改流程均经实测验证。

一、环境信息

  • 操作系统:Ubuntu 22.04.5 LTS(x86_64)
  • 软件版本:Webmin 2.670、Authentic Theme 26.70
  • 安装方式:官方 apt 仓库(apt-get install webmin --install-recommends)
  • 配置目录:/etc/webmin;运行时/日志:/var/webmin;程序:/usr/share/webmin
  • 服务单元:webmin.service(systemd,enabled)

版本自检实测:

/usr/share/webmin/bin/webmin --version
2.670

二、前置条件

  • 已按官方仓库方式装好 Webmin 2.670 并能通过 systemctl is-active webmin 确认 active;
  • 具备 root 权限;
  • 修改 miniserv.conf 的标准通道是官方 CLI(webmin set-config,保存后自动重启服务),直接手改文件则需要手动 systemctl restart webmin。

三、参数查看与修改方式

3.1 三棵配置树

文件/目录作用域内容
/etc/webmin/miniserv.confMiniServ Web 服务器本体端口、SSL、会话、日志、防爆破等
/etc/webmin/configWebmin 全局操作系统识别、语言、主题、路径、临时目录策略等
/etc/webmin/<模块名>/config单个模块如 acl/config、useradmin/config、apache/config

3.2 用 CLI 查看(推荐)

查看核心服务配置全量:

/usr/share/webmin/bin/webmin list-config miniserv.conf
port=10000
root=/usr/share/webmin
mimetypes=/usr/share/webmin/mime.types
addtype_cgi=internal/cgi
realm=Webmin Server
logfile=/var/webmin/miniserv.log
errorlog=/var/webmin/miniserv.error
pidfile=/var/webmin/miniserv.pid
logtime=168
ssl=1
no_ssl2=1
no_ssl3=1
ssl_honorcipherorder=1
no_sslcompression=1
env_WEBMIN_CONFIG=/etc/webmin
env_WEBMIN_VAR=/var/webmin
atboot=1
logout=/etc/webmin/logout-flag
listen=10000
denyfile=\.pl$
log=1
nolistdir=1
blockhost_failures=5
blockhost_time=60
syslog=1

(输出共 50 行,此处节选前 25 行;其余见 /etc/webmin/miniserv.conf 文件原文。)

查看单个键:

/usr/share/webmin/bin/webmin list-config --option ssl_enforce
2

查看模块配置(--module 指定模块名):

/usr/share/webmin/bin/webmin list-config --module acl
ssleay=/usr/bin/openssl
order=0
display=1

3.3 用 CLI 修改(保存即生效)

set-config 不带 --module 时写核心 miniserv.conf,保存后自动重启 Webmin 服务;带 --module 时写模块配置,无需重启。实测修改并回读:

/usr/share/webmin/bin/webmin set-config --option logtime --value 24
Restarting Webmin to apply miniserv.conf changes...
/usr/share/webmin/bin/webmin list-config --option logtime
24

恢复原值:

/usr/share/webmin/bin/webmin set-config --option logtime --value 168
Restarting Webmin to apply miniserv.conf changes...
/usr/share/webmin/bin/webmin list-config --option logtime
168

模块配置修改实测(改 acl 模块的 display 再还原):

/usr/share/webmin/bin/webmin set-config --module acl --option display --value 2 && echo set_ok
set_ok
/usr/share/webmin/bin/webmin list-config --module acl | grep display
display=2
/usr/share/webmin/bin/webmin set-config --module acl --option display --value 1 && echo revert_ok
revert_ok

⚠️ 注意:核心 miniserv.conf 的修改在服务重启后才生效(set-config 已自动完成);模块配置多数在下次页面刷新时生效,个别模块需在界面点「保存/应用」。

3.4 直接改文件

手改 /etc/webmin/miniserv.conf 后必须手动重启:

systemctl restart webmin && systemctl is-active webmin
active

两种方式写的是同一文件,混用时注意后者会覆盖前者。

四、参数总览

miniserv.conf(deb/apt 安装后的出厂值,Ubuntu 22.04 实测全量 50 键,按主题归类):

分类参数(出厂值)一句话作用
监听与进程port=10000, listen=10000, ipv6=1服务端口与监听栈
监听与进程root=/usr/share/webmin程序根目录
监听与进程server=MiniServ/2.670, realm=Webmin Server服务标识与 HTTP Basic 域名
监听与进程pidfile=/var/webmin/miniserv.pid, atboot=1PID 文件与开机自启
监听与进程mimetypes=..., addtype_cgi=internal/cgi, premodules=WebminCoreMIME 表、CGI 前缀、会话预加载模块
监听与进程env_WEBMIN_CONFIG=/etc/webmin, env_WEBMIN_VAR=/var/webmin注入子进程的环境变量
SSL/TLSssl=1启用 HTTPS
SSL/TLSno_ssl2=1, no_ssl3=1, no_sslcompression=1, ssl_honorcipherorder=1, cipher_list_def=1旧协议与压缩、加密套件策略
SSL/TLSssl_hsts=1, ssl_enforce=2, no_trust_ssl=1HSTS 与强制 HTTPS 等级
SSL/TLSkeyfile=/etc/webmin/miniserv.pem证书/私钥文件
会话与认证session=1启用 Cookie 会话模式
会话与认证userfile=/etc/webmin/miniserv.usersWebmin 用户文件
会话与认证passwd_file=/etc/shadow, passwd_uindex=0, passwd_pindex=1, passwd_cindex=2, passwd_mindex=4, passwd_mode=0Unix 账号映射规则
会话与认证sudo=1, passdelay=1, preroot=authentic-themesudo 支持与失败延时、登录前主题
会话与认证login_script=/etc/webmin/login.pl, logout_script=/etc/webmin/logout.pl, logout=/etc/webmin/logout-flag会话生命周期挂钩
日志与审计logfile=/var/webmin/miniserv.log, errorlog=/var/webmin/miniserv.error访问日志与错误日志
日志与审计log=1, logtime=168, logclear=1操作日志开关、保留小时数、定期清理
日志与审计syslog=1关键事件写 syslog
访问控制blockhost_failures=5, blockhost_time=60失败 N 次封锁来源 IP
访问控制denyfile=.pl$, nolistdir=1禁止直接访问 .pl、禁止目录列举
访问控制failed_script=/etc/webmin/failed.pl, error_handler_403/401/404=*.cgi失败钩子与错误页

/etc/webmin/config(全局配置出厂值实测):

参数(出厂值)作用
os_type=debian-linux, os_version=13.0Webmin 内部使用的发行版代号(模块按此适配)
real_os_type=Ubuntu Linux, real_os_version=22.04.5界面显示用真实发行版名与版本
lang=en界面语言(可在 Web 界面切换为 zh_CN.UTF-8)
theme=authentic-theme, preroot=authentic-theme当前主题与登录前主题
product=webmin产品标识(Usermin 为 usermin)
path=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin模块执行命令时的 PATH
ld_env=LD_LIBRARY_PATH需要传递的动态库环境变量名
find_pid_command=ps auwwwx ...找进程 PID 的兜底命令
tempdelete_days=7临时文件保留天数
md5pass=0用户口令哈希策略开关
referers_none=1拒绝外部来源引用
by_view=0视图分组显示开关
noselfwebminup=1禁止 Webmin 通过自身界面自我升级(交由包管理器)
log=1, logclear=1操作审计日志开关与清理
passwd_file=/etc/shadow 及 passwd_*index 系列与 miniserv.conf 同义的账号映射副本

💡 说明:os_version=13.0 并非笔误——Webmin 内部把 Ubuntu 系按 Debian 代际编号适配模块,real_os_* 才是真实版本;这也是排障时判断「模块适配合错发行版」的第一检查点。

五、核心参数分类详解

5.1 服务监听与端口(port / listen / ipv6)

出厂值:

/usr/share/webmin/bin/webmin list-config --option port && /usr/share/webmin/bin/webmin list-config --option listen && /usr/share/webmin/bin/webmin list-config --option ipv6
10000
10000
1
  • port:MiniServ 实际监听的 TCP 端口;
  • listen:与 port 成对出现,控制监听行为(两键必须同时改,实测只改一个会出现配置与监听不一致);
  • ipv6=1:同时监听 IPv6(实测 ss -ltn 可见 0.0.0.0:10000 与 [::]:10000 两条监听)。

改端口完整实测(改到 10001 → 验证 → 改回):

/usr/share/webmin/bin/webmin set-config --option port --value 10001
Restarting Webmin to apply miniserv.conf changes...
/usr/share/webmin/bin/webmin set-config --option listen --value 10001
Restarting Webmin to apply miniserv.conf changes...
ss -ltn | grep -E ":1000[01]"
LISTEN 0      4096         0.0.0.0:10001      0.0.0.0:*
curl -sk https://localhost:10001/ -o /dev/null -w "http=%{http_code}\n"
http=200

改回默认:

/usr/share/webmin/bin/webmin set-config --option port --value 10000
/usr/share/webmin/bin/webmin set-config --option listen --value 10000
Restarting Webmin to apply miniserv.conf changes...
Restarting Webmin to apply miniserv.conf changes...
ss -ltn | grep ":10000"
LISTEN 0      4096         0.0.0.0:10000      0.0.0.0:*

5.2 SSL 与传输安全(ssl / ssl_enforce / ssl_hsts / keyfile)

参数出厂值详解
ssl1启用 HTTPS;改 0 后为明文 HTTP,公网严禁
no_ssl2 / no_ssl31 / 1禁用 SSLv2/SSLv3(POODLE 类历史漏洞协议)
no_sslcompression1禁用 TLS 压缩(防 CRIME 攻击)
ssl_honorcipherorder1服务端优先决定加密套件顺序
cipher_list_def1使用内置默认套件列表
ssl_hsts1响应头下发 HSTS,浏览器记住强制 HTTPS
ssl_enforce2强制 HTTPS 等级:1=重定向 HTTP 请求,2=直接拒绝
no_trust_ssl1Webmin 访问自身/其他服务器时不信任系统 CA(自签场景)
keyfile/etc/webmin/miniserv.pem自签名证书与私钥;换正规证书即替换此文件

证书文件实测确认:

ls -la /etc/webmin/miniserv.pem
-rw------- 1 root root 3243 Oct 21 06:57 /etc/webmin/miniserv.pem

💡 技术拓展:ssl_enforce 的取值是「HTTP 明文请求怎么处理」的策略选择——常见取法对比:0 = 接受明文(最不安全,等于关闭强制);1 = 301/302 重定向到 HTTPS(兼容旧书签);2 = 直接拒绝明文请求(最严格,彻底杜绝降级探测)。本方案出厂值 2,配合 ssl_hsts=1 已是公网推荐水位,无需调整。

5.3 会话与账号(session / userfile / passwd_* / sudo)

参数出厂值详解
session1登录后发 Cookie 会话(session_login.cgi 流程);0 时退化为 HTTP Basic
userfile/etc/webmin/miniserv.usersWebmin 自有账号文件,一行一个用户
passwd_file/etc/shadowWebmin 用户到 Unix 账号的校验来源
passwd_uindex/pindex/cindex/mindex0/1/2/4在 Unix 账号记录中取「用户名/口令/全名/其他」的字段下标(适配不同 shadow 格式)
passwd_mode00=Webmin 用户与 Unix 用户联动(改 Webmin 密码即改 Unix 密码)
sudo1允许有 sudo 权限的用户登录
passdelay1失败登录后加延时(拖慢暴力破解)

miniserv.users 实测内容(一行一个 Webmin 用户:用户名:口令哈希:Unix UID;口令哈希为系统 shadow 的 Yescrypt 哈希,本例对应示例口令):

cat /etc/webmin/miniserv.users
root:$y$j9T$NTWD.63TztB1r0UKYoajL.$rDFwj0b.CNaY7Q46kdHD3Tq34juxrTcRd4ft6U/wHD2:0

💡 技术拓展:Webmin 账号有两种模式可选——「与 Unix 用户联动」(passwd_mode=0,本方案默认,root 即系统 root)与「独立 Webmin 账号」(在 miniserv.users 建独立口令,适合最小权限分发)。联动模式省心但等于把系统口令暴露在登录框;独立模式更适合给协作者开只读账号,配合 ACL(/etc/webmin/webmin.acl 控制每个 Webmin 用户可用的模块清单)实现分权。

5.4 日志与审计(logfile / errorlog / log / logtime / logclear)

参数出厂值详解
logfile/var/webmin/miniserv.logHTTP 访问日志(Apache combined 风格)
errorlog/var/webmin/miniserv.error错误与关键事件日志
log1记录「谁在 Webmin 里做了什么操作」到 webmin.log
logtime168webmin.log 保留小时数(168h = 7 天)
logclear1允许按 logtime 自动清理旧日志
syslog1登录/登出等事件同步写 syslog(journalctl 可查)

三类日志实测样例(同一环境的真实回显):

tail -1 /var/webmin/miniserv.log
127.0.0.1 - root [21/Oct/2026:06:58:36 +0000] "GET / HTTP/1.1" 200 82448
tail -1 /var/webmin/webmin.log
1792565916.5126.0 [21/Oct/2026 06:58:36] root 63dc72c87d0f2d4e106055836646b063 127.0.0.1 global record-login.pl "login" "-" "-"
grep "Successful login" /var/log/syslog | tail -1
Oct 21 06:58:36 webmin.example.com webmin[5084]: Successful login as root from 127.0.0.1

审计建议:生产把 logtime 调大(如 720 = 30 天)以保住审计窗口;syslog=1 保持开启,日志可被 rsyslog 集中采集。

5.5 访问控制与防爆破(blockhost_* / denyfile / nolistdir / referers_none)

参数出厂值详解
blockhost_failures5同一来源连续失败达到该次数即封锁
blockhost_time60失败计数与封锁的时间窗(秒)
denyfile.pl$URL 正则匹配 .pl 结尾的直接拒绝(保护脚本不被直连)
nolistdir1禁止目录列举
referers_none1拒绝 Referer 不为本站点的请求(CSRF 基线防护)
failed_script/etc/webmin/failed.pl失败登录的钩子脚本(可自定义告警)

防爆破行为实测(60 秒窗口内连续错误口令 POST 登录接口):第 1~4 次失败返回 Login failed. Please try again.,第 5 次开始返回:

too many authentication failures.

封锁记录落在 /var/webmin/blocked/ 目录,等待 blockhost_time 后自动解封。生产加固建议:blockhost_failures 收紧到 3、blockhost_time 拉长到 300(改法见第七节模板)。

5.6 全局配置与发行版识别(os_type / real_os_* / lang / theme)

Webmin 的模块适配完全由 os_type/os_version 驱动。Ubuntu 22.04 实测识别结果:

grep -E "os_type|os_version|real_os" /etc/webmin/config
os_type=debian-linux
os_version=13.0
real_os_type=Ubuntu Linux
real_os_version=22.04.5

排障含义:若发现某模块(如软件包管理)行为怪异,先查这四个值是否与实际发行版相符;tar.gz 方案安装时若自动识别失败,可手工修正后重启服务。

界面语言与主题:

参数出厂值详解
langen界面语言;zh_CN.UTF-8 为简体中文
themeauthentic-theme登录后主题
prerootauthentic-theme登录页主题
noselfwebminup1关闭 Webmin 自升级(apt 场景必须保持 1,升级权交给包管理器)

语言切换:lang 属全局 /etc/webmin/config,直接编辑该文件把 lang=en 改为 lang=zh_CN.UTF-8(或用 Web 界面 Change Language and Theme 向导),重新登录会话后生效(详见 Q7)。

5.7 模块级配置详解(以五个常用模块为例)

模块配置位于 /etc/webmin/<模块>/config,全部可用 webmin list-config --module <名> 查看。实测出厂值:

acl(用户/ACL 模块):

ssleay=/usr/bin/openssl
order=0
display=1

ssleay 指定 openssl 可执行文件路径(口令哈希生成用);order/display 控制用户列表的排序与展示方式。

useradmin(用户与组管理模块)(节选核心键):

homedir_perms=0750
home_base=/home
base_gid=1000
display_max=400
shadow_file=/etc/shadow
md5=1

homedir_perms 是新建用户家目录权限(出厂 0750);home_base 是家目录根;base_gid 是新用户组的起始 GID;display_max 限列表单页最多渲染 400 条防卡页面。

init(开机服务管理模块)(节选):

init_base=/etc/
init_dir=/etc/init.d
boot_levels=2 3 5
shutdown_command=poweroff
reboot_command=reboot
status_check=0

init_dir 指向 SysV 兼容脚本目录(systemd 场景仍保留该目录兼容);boot_levels 是传统 runlevel 概念的展示项。

cron(计划任务模块)(节选):

cron_dir=/var/spool/cron/crontabs
cron_deny_file=/var/spool/cron/deny
max_jobs=400
system_crontab=/etc/crontab
show_time=0

cron_dir 是 Ubuntu 系 crontab 的真实存放目录;max_jobs 限列表渲染量;show_time=1 可在列表显示下次执行时间。

system-status(系统状态采集模块):

collect_interval=5
collect_pkgs=1

collect_interval=5 表示后台每 5 分钟采集一次 CPU/内存/磁盘水位(Webmin 首页仪表盘数据源);collect_pkgs=1 同时采集可用更新数。降配机器可把间隔调大到 15。

5.8 服务文件参数(webmin.service)

systemd 托管层的参数在 /lib/systemd/system/webmin.service(全文见安装指南篇 4.5 节),运维最常用的两处:

  • ExecStart=/usr/share/webmin/miniserv.pl --nofork /etc/webmin/miniserv.conf——MiniServ 以 --nofork 前台运行、由 systemd 托管生命周期(Type=simple);
  • Restart=on-failure + RestartSec=2s——异常退出 2 秒后自动拉起;
  • Environment="PERLLIB=/usr/share/webmin"——为 Perl 脚本注入模块搜索路径。

⚠️ 注意:systemctl daemon-reload 前直接改 unit 文件不会生效;改完 unit 必须 reload 再 restart。

六、生产配置模板

适用场景:2 vCPU / 4GB 内存 / 40GB 盘的托管服务器,管理面不对公网开放、仅运维网段可达,需要 30 天操作审计与更紧的防爆破。

# —— 端口与监听(避开常见扫描段的 5 位端口)——
/usr/share/webmin/bin/webmin set-config --option port --value 20001
/usr/share/webmin/bin/webmin set-config --option listen --value 20001

# —— 防爆破收紧:5 分钟窗口内 3 次失败即封 ——
/usr/share/webmin/bin/webmin set-config --option blockhost_failures --value 3
/usr/share/webmin/bin/webmin set-config --option blockhost_time --value 300

# —— 审计窗口拉长到 30 天 ——
/usr/share/webmin/bin/webmin set-config --option logtime --value 720

⚠️ 注意:全局配置文件 /etc/webmin/config 不在 webmin set-config 的作用域内(CLI 只覆盖 miniserv.conf 与各模块 config,实测对全局键执行 list-config --option lang 报 Unable to retrieve value of lang)。noselfwebminup 出厂即 1 无需改动;如需中文界面,直接编辑 /etc/webmin/config 把 lang=en 改为 lang=zh_CN.UTF-8,保存后 systemctl restart webmin 生效。

执行后验证(逐条真实回显;端口 20001 实测后已恢复出厂 10000):

ss -ltn | grep 20001
LISTEN 0      4096         0.0.0.0:20001      0.0.0.0:*
curl -sk https://localhost:20001/ -o /dev/null -w "http=%{http_code}\n"
http=200
grep -E "^(blockhost_failures|blockhost_time|logtime)=" /etc/webmin/miniserv.conf
logtime=720
blockhost_failures=3
blockhost_time=300

配套的服务器层加固(与本配置模板配套,不替代):防火墙/安全组仅对运维网段放行 Webmin 端口;用 Webmin 内置 ACL 为协作者建最小权限账号;ssl_enforce=2、ssl_hsts=1 保持出厂值不动。

七、常见问题(FAQ)

Q1:改了 miniserv.conf 但访问行为没变? 核心配置要重启服务才生效。用 CLI set-config 会自动重启(实测输出 Restarting Webmin to apply miniserv.conf changes...);手改文件的情况必须 systemctl restart webmin。验证手段:ss -ltn | grep <端口>。

Q2:port 改了还是访问老端口? port 与 listen 两键必须同时改(5.1 节实测:两键都改后监听立即切换,HTTP 200 验证通过)。只改其一会出现「配置是新的、监听是旧的」的不一致。

Q3:登录接口报 Cache issue or no cookies support? 请求没带合法会话 Cookie。浏览器场景按日志提示清缓存/无痕窗口;脚本场景必须先 GET 登录页拿 Cookie 再 POST 凭据(实测 miniserv.error 原文与复现方法见 《Ubuntu 22.04 安装 Webmin 2.670 指南》 Q2)。

Q4:被 too many authentication failures. 拒绝? blockhost_failures/blockhost_time 防爆破触发(实测 60 秒内第 5 次失败即封)。等待时间窗自动解封;应急可临时调大 blockhost_time 之外的策略(如把失败阈值回调),或清理 /var/webmin/blocked/。

Q5:手改配置文件被 CLI 覆盖了? set-config 是「保存即写盘」的原子操作,手改未落盘的部分会被其覆盖。团队协作时统一走 webmin set-config(可脚本化、有回显),避免两种通道交叉。

Q6:连续执行多条 set-config 后服务起不来,systemctl status 显示 start-limit-hit? 每条 set-config(核心键)都会触发一次服务重启,短时间连续重启会命中 systemd 的启动频率限制(StartLimitBurst),实测现象:

Restarting Webmin to apply miniserv.conf changes...
Job for webmin.service failed.
See "systemctl status webmin.service" and "journalctl -xeu webmin.service" for details.
Active: failed (Result: start-limit-hit)

配置值本身已写入成功(可用 grep 键名 /etc/webmin/miniserv.conf 确认),只需解除限制并手动启动:

systemctl reset-failed webmin && systemctl start webmin && sleep 2 && systemctl is-active webmin
active

Q7:想改界面语言,改 lang 键为什么 CLI 报错? lang、theme、noselfwebminup 等属于全局配置 /etc/webmin/config,它不在 webmin list-config/set-config 的作用域内(实测 list-config --option lang 报 Unable to retrieve value of lang)。正确做法:直接编辑 /etc/webmin/config 把 lang=en 改为 lang=zh_CN.UTF-8(或用 Web 界面 Change Language and Theme 向导),保存后重新登录会话生效。

八、参考链接

  1. Webmin 官方文档站(MiniServ 与模块手册):https://doxfer.webmin.com/Webmin/Main_Page
  2. 官方下载页(版本与源):https://www.webmin.com/download.html
  3. 官方 GitHub 仓库(miniserv 源码与 issue 跟踪):https://github.com/webmin/webmin
  4. 安装与三种部署方案的完整流程见本专栏《Ubuntu 22.04 安装 Webmin 2.670 指南》篇;本文涉及的 webmin list-config/set-config 命令全集见《Webmin 2.670 常用 CLI 命令与工具详解》篇。