i-doit 38 配置参数详解
i-doit open 38 四层配置体系逐项实测:src/config.inc.php 全部常量、isys_settings 应用设置与 system-set-settings CLI 改法、PHP 8.2-8.4 版本矩阵与必装扩展、.htaccess/AllowOverride 安全拦截、LDAP/AD 落库表结构、cron 的 ini 配置文件法。
i-doit 38 配置参数详解
i-doit open 38 的配置并不集中在一个文件里,而是分四层:系统级 PHP 常量文件 src/config.inc.php(数据库连接、加密算法、更新开关)、应用级设置表 idoit_system.isys_settings(会话、邮件、SSO、时区等,Web 界面与 CLI 都能改)、租户库业务配置表(LDAP 目录、权限等按租户存放)、运行时环境(php.ini 与 Apache)。本文逐层拆解,所有文件内容、表结构与参数修改均为实测输出,环境为 Ubuntu 22.04 + Apache 2.4.52 + MariaDB 10.6.23 + PHP 8.3.36,安装过程见《Ubuntu 22.04 安装 i-doit 38 指南》。
一、src/config.inc.php:系统级常量
先澄清一个常见误区:i-doit 38 的源码包与安装后目录树中没有 sysconf 目录(实测 ls /var/www/html/i-doit/sysconf 报 No such file or directory),配置文件就一个,位于应用根目录下的 src/config.inc.php,由安装器按 setup/config_template.inc.php 模板生成(共 76 行)。当前环境全文如下(实测 cat src/config.inc.php,哈希值为本环境真实生成值):
<?php
/**
* i-doit
*
* Basic configuration
*
* @package i-doit
* @subpackage General
* @copyright synetics GmbH
* @license http://www.gnu.org/licenses/agpl-3.0.html GNU AGPLv3
*/
/*
* Database configuration
*
* This configuration is for the system database. Don't forget to use MySQL with the InnoDB table-driver.
* Only TCP/IP Hosts are supported here, no UNIX sockets!
*/
$g_db_system = [
'type' => 'mysqli',
'host' => 'localhost',
'port' => '3306',
'user' => 'idoit',
'pass' => 'q1w2e3r4',
'name' => 'idoit_system'
];
/*
* Security configuration
*/
$g_security =[
'passwords_encryption_method' => 'argon2i'
];
/*
* This login is used for the i-doit administration GUI. Note that an empty password will not work.
* Leave the password empty to disable the admin center.
*
* Use the GUI or bcrypt to crypt your password.
*
* Syntax: 'username' => 'bcrypt-encrypted-password'
*/
$g_admin_auth = [
'admin' => '$2y$10$rFfVx9dOKmHvoPp3waodY.QekeAFSIATPp2aYehZTgAd1r4311XL6',
];
/*
* Crypto hash used as key for encryption with phpseclib.
*/
$g_crypto_hash = 'c367602ca852ecfd6b87760ca765c9eff2b40276';
/*
* It is possible to deactivate add-on uploads for the admin-center.
*/
$g_disable_addon_upload = '0';
/*
* It is possible to deactivate update procedure for the GUI.
*/
$g_enable_gui_update = '1';
/*
* i-doit License token.
*/
$g_license_token = '';
/**
* Is cloud indicator
*/
$g_is_cloud = '0';
/**
* Active features
*/
$g_active_features = [''];
逐项说明:
| 参数 | 生成值(实测) | 作用与调整建议 |
|---|---|---|
$g_db_system | type mysqli / host localhost / port 3306 / user idoit / pass … / name idoit_system | 系统库连接。模板注释明确 只支持 TCP/IP,不支持 UNIX socket;name 库只存"元数据"(租户注册表 isys_mandator、应用设置 isys_settings、许可证 isys_licence 等 9 张表),CMDB 业务数据全在租户库。密码明文存放,务必依赖第四节的 .htaccess 拦截与文件权限保护 |
$g_security['passwords_encryption_method'] | argon2i | CMDB 用户口令哈希算法。改 bcrypt 后旧口令仍可验证,但新口令用新算法,迁移期注意 |
$g_admin_auth | 'admin' => '$2y$10$…' | Admin Center(/i-doit/admin/)的准入哈希表,语法为 '用户名' => 'bcrypt 密文',与租户用户体系无关,由安装器写入。模板注释:空密码无效,置空即整体禁用 Admin Center(安全加固可考虑)。忘记口令的重置方法见运维篇,但注意其 -n 陷阱 |
$g_crypto_hash | 40 位十六进制串 | phpseclib 加密密钥,用于加密应用设置里的敏感值(LDAP 绑定密码、SMTP 密码等)。不要随意更换:更换后已加密入库的凭据将无法解密 |
$g_disable_addon_upload | '0' | '0' 表示允许在 Admin Center 上传插件;改 '1' 关闭。open 可用插件远少于 Pro |
$g_enable_gui_update | '1' | '1' 表示允许 Web 界面执行更新流程;生产环境建议改 '0',升级统一走 CLI(见运维篇) |
$g_license_token | '' | Pro 的许可证令牌;open 留空 |
$g_is_cloud | '0' | SaaS 托管模式标记,自建保持 '0' |
$g_active_features | [''] | 特性开关数组,open 默认无有效项 |
改完此文件无需重启任何服务(PHP 每次请求读取)。注意安装器以 root 运行时生成的文件属主是 root,需 chown www-data:www-data 并收紧权限(本文环境为 664,建议 640),同时依赖第四节的 .htaccess 拦截兜底。
二、isys_settings:应用级设置(Web/CLI 双通道)
会话时长、SSO、邮件网关、时区这类"系统设置"不在 config.inc.php,而是存在系统库表 isys_settings(key/value 按租户隔离,isys_mandator__id=0 为全局)。实测节选:
isys_settings__key isys_settings__value
admin.active_license_distribution 1
api.authenticated-users-only 0
api.status 1
api.strip-tags 0
api.validation 1
session.sso.active 0
session.sso.mandator-id 1
session.sso.use-domain-part 0
session.time 3600
system.csv-export-delimiter ;
system.default-language -1
system.email.from i-doit@example-domain.int
system.email.connection-timeout
system.email.smtp-auto-tls 0
system.email.smtp-host
system.email.port
system.email.username
system.email.subject-prefix [i-doit]
system.login.welcome-message
system.security.csrf 1
system.show-proc-time 0
system.timezone Europe/Berlin
重点参数:
session.time = 3600:Web 会话空闲超时(秒),改小更安全,改小后长时间填单会被踢回登录页。session.sso.active / session.sso.use-domain-part / session.sso.mandator-id:SSO 开关三件套。开启后可配合 Windows 域账号免密登录(use-domain-part=1表示接受DOMAIN\user形式)。system.email.smtp-host / system.email.port / system.email.username / system.email.password / system.email.smtp-auto-tls:SMTP 网关配置,密码字段加密后入库。不配 SMTP 时notifications-send等命令无实际投递对象。system.timezone = Europe/Berlin:出厂默认值,与 php.ini 的date.timezone是两回事,前者管界面显示与报表时区,后者管 PHP 进程时间戳。国内部署建议两处都改成Asia/Shanghai。system.security.csrf = 1:CSRF 防护开关,保持 1。api.status / api.validation / api.strip-tags / api.authenticated-users-only:JSON-RPC 接口行为开关(open 版 API 能力远少于 Pro 插件版)。
CLI 修改用 system-set-settings,参数是 JSON 映射(不是 --key/--value)。实测改时区:
root@idoit-server:/var/www/html/i-doit# php console.php system-set-settings -n \
-s '{"system.timezone": "Asia/Shanghai"}' -u admin -p q1w2e3r4
------------------------------- --------
Message Result
------------------------------- --------
Set system settings OK
Set system settings: 'system.timezone' set to 'Asia/Shanghai' OK
------------------------------- --------
回读数据库确认已生效:
root@idoit-server:~# mysql -uroot -pq1w2e3r4 -N -e "SELECT isys_settings__value FROM idoit_system.isys_settings WHERE isys_settings__key='system.timezone';"
+---------------+
| Asia/Shanghai |
+---------------+
坑(实测):system-set-settings 同样受 Symfony 交互模式影响,不加 -n 会重新弹 Please, enter i-doit Admin Username 并在非终端环境下以 Authorisation: failed → Undo 收场,配置不落库。所有走 AbstractConfigurableCommand 的命令(install、tenant-create、system-set-settings……)无人值守都要 -n。
三、PHP 运行时:版本矩阵与必装扩展
src/constants.inc.php 实测定义:
const PHP_VERSION_MINIMUM = '8.2';
const PHP_VERSION_MAXIMUM = '8.4.99';
const PHP_VERSION_RECOMMENDED = '8.4';
Ubuntu 22.04 自带 PHP 8.1 不满足下限,必须 PPA 装 8.3/8.4(安装篇第一步已处理)。必装扩展实测清单(php8.3 -m 过滤):
bcmath ctype curl dom fileinfo ftp gd intl ldap libxml mbstring memcached
mysqli pdo_mysql pdo_pgsql pgsql SimpleXML soap xml xmlwriter zip
其中 ldap 是 LDAP/AD 集成前提,imagick 来自 php8.3-imagick 包(官方扩展清单要求,用于图像处理),ctype/fileinfo/session/json 编译进核心无需单独装。
php.ini 关键值(对 apache2 与 cli 两个 SAPI 都要改):
| 参数 | Ubuntu 默认 | 本文实测取值 | 原因 |
|---|---|---|---|
max_input_vars | 1000 | 10000 | 安装器检查阈值为 ≥10000;CMDB 对象单表单字段数极多,超限会被静默截断导致"字段丢失" |
post_max_size | 2M | 128M | 安装器检查阈值为 ≥128M;大表单与附件 |
upload_max_filesize | 2M | 100M | 文档/图纸附件上传 |
memory_limit | 128M | 512M | 报表导出、搜索索引重建留余量 |
date.timezone | 空(UTC) | Asia/Shanghai | 与 system.timezone 保持一致 |
调优前后安装器行为差异实测:默认值时 install 输出 Ini Setting: max_input_vars: failed OK、Ini Setting: post_max_size: failed OK(不阻断),调优后两行消失、九步全 OK。
四、Apache 层:.htaccess 与模块
应用根目录自带 .htaccess(实测 head -20):
Options -Indexes
php_flag engine off
<Files ~ "\.(tpl|sql|log|ini|conf|bak|sh|tpl|old|new)$">
Order allow,deny
Deny from all
Satisfy All
</Files>
<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Content-Type-Options "nosniff"
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 days"
ExpiresByType image/gif "access plus 1 days"
</IfModule>
它做四件事:禁止目录列表、拦截 *.sql/*.ini/*.conf/*.sh 等敏感后缀、关闭敏感子目录的 PHP 执行、加安全响应头与静态缓存。前提是 Apache 允许覆盖:
a2enmod rewrite expires headers——Header/ExpiresByType指令分别在 headers、expires 模块存在时才生效;- 站点目录必须
AllowOverride All——Ubuntu 默认对/var/www是AllowOverride None,此时.htaccess整体被忽略。
实测对比(同一 URL src/config.inc.php):
AllowOverride None:curl 返回 200(数据库密码可被明文下载)
AllowOverride All :curl 返回 403
vhost 推荐写法(本文实验采用):
<VirtualHost *:8137>
DocumentRoot /var/www/html
<Directory /var/www/html/i-doit>
Options -Indexes +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/idoit-error.log
CustomLog ${APACHE_LOG_DIR}/idoit-access.log combined
</VirtualHost>
五、LDAP/AD 集成:配置入口与落库位置
LDAP 目录配置在 Web 界面完成(Admin Center → 导入与接口 → LDAP,官方文档 kb.i-doit.com/en/administration/management/import-and-interfaces/ldap/,查询日期 2026-11-03),数据落在租户库两张表:isys_ldap_directory(目录服务器)与 isys_ldap(搜索规则)。实测 DESCRIBE idoit_data.isys_ldap 关键字段:
| 字段 | 类型/默认 | 含义 |
|---|---|---|
isys_ldap__hostname / isys_ldap__port | varchar / int | 域控地址与端口(389/636) |
isys_ldap__dn / isys_ldap__password | varchar | 绑定账号 DN;密码经 $g_crypto_hash 加密存储 |
isys_ldap__user_search / isys_ldap__group_search | varchar | 用户/组搜索基准 DN(OU 路径) |
isys_ldap__filter / isys_ldap__filter_array | text | 用户过滤器(如 (&(objectClass=user)(sAMAccountName=%s))) |
isys_ldap__version | int | LDAP 协议版本(AD 用 3) |
isys_ldap__tls / tls_certificate / tls_certificate_check_strategy | int / FK / demand | StartTLS 与证书校验策略,默认 demand(强制校验) |
isys_ldap__timelimit | int | 单次搜索时限(秒) |
isys_ldap__recursive | int | 是否递归子 OU |
isys_ldap__enable_paging / isys_ldap__page_limit | 0 / 500 | 大目录分页拉取(AD 万级用户建议开启) |
isys_ldap__unique_attribute | varchar | 用户唯一标识属性(AD 用 distinguishedName 或 objectGUID) |
isys_ldap__use_admin_only | 0 | 仅允许管理员组映射 |
注意两点:
- open 版没有
ldap-sync命令(实测php console.php list全表无此项),LDAP 用户同步属 Pro 能力;open 中 LDAP 主要用于登录认证与用户目录展示。 - 开启 TLS 校验失败时先查
tls_certificate_check_strategy(demand要求证书链完整,测试环境可临时改allow,生产勿关)。官方排障页:kb.i-doit.com/en/administration/troubleshooting/ldap-via-tls.html。
六、cron 定时任务:ini 配置文件法
i-doit 官方推荐把周期性维护挂到系统 crontab(kb.i-doit.com/en/maintenance-and-operation/set-up-cron-jobs.html,查询日期 2026-11-03),并且支持用 ini 配置文件替代命令行传凭据。实测配置文件格式(注意节名必须是 [commandOptions]):
[commandOptions]
user = admin
password = q1w2e3r4
tenantId = 1
任何接受 --user/--password/--tenantId 的命令都能用 -c 加载:
root@idoit-server:/var/www/html/i-doit# php console.php auth-cleanup -c auth-cleanup.ini
Processing config file
Auth paths cleanup initialized (2026-11-03 11:42:11)
Cleanup done.
本文实验环境已挂入 www-data 的 crontab(实测 crontab -u www-data -l):
5 1 * * * php /var/www/html/i-doit/console.php search-index -c /var/www/html/i-doit/auth-cleanup.ini > /var/www/html/i-doit/log/search-index.log 2>&1
open 38 实测可用、值得入 cron 的命令:
| 命令 | 作用 | 建议频率 |
|---|---|---|
search-index | 重建/增量维护搜索索引(--dry-run 可先看规模) | 每日一次 |
logbook:archive | 归档 90 天前的变更日志(实测输出 Archiving 90 days old entries) | 每周 |
system-objectcleanup | 清理指定状态的残留对象(实测 --objectStatus 1) | 按需 |
contracts-outdated / extend-contracts | 合同到期检查/自动续约(实测均正常退出) | 每日 |
auth-cleanup | 清理过期会话/令牌 | 每日 |
notifications-send / notifications-list | open 版实测抛 Class "isys_notifications_dao" not found——通知模块属 Pro/插件,open 不要挂 | — |
凭据文件含明文密码,权限务必收紧:chmod 600 auth-cleanup.ini,或统一用 sudo -u www-data 执行并让文件属主为 www-data。
七、多租户(mandator)配置
租户注册表在系统库 isys_mandator(实测):
id mandator_title mandator_db mandator_db_host mandator_db_user
1 quzuo-lab idoit_data localhost idoit
每个租户一个独立数据库(本文 idoit_data,建库实测 460 张表),业务配置(LDAP、权限组、类别等)全部在租户库内。tenant-list / tenant-disable / tenant-enable / tenant-remove / system:tenant-export / system:tenant-import 等命令围绕该表工作(详见运维篇)。
open 版限制(实测):创建第二个租户直接报 i-doit open does not include multi tenancy feature and supports only a single tenant.——多租户是 Pro 特性,open 上 isys_mandator 永远只有一行。
常见问题
Q1:改了 src/config.inc.php 里的 DB 密码,Web 报连接失败?
该文件只管系统库连接;租户库账号密码存在 isys_mandator,DB 侧改密后需同步 ALTER USER 并更新两处。
Q2:system-set-settings 显示 Authorisation: failed?
漏了 -n,凭据被交互提示覆盖(见第二节实测)。
Q3:cron 里用 -c 指定 ini 仍打印 usage?
节名写错——必须是 [commandOptions],user/password/tenantId 之外的键会被忽略。
Q4:LDAP 配置保存后测试连接超时?
先确认 php8.3-ldap 已装(php8.3 -m | grep ldap),再查 isys_ldap__port 与 tls 组合(636 隐式 TLS 与 389+StartTLS 不能混配)。
小结
i-doit 的配置哲学是"连接信息进文件、业务开关进数据库、租户数据进独立库":src/config.inc.php 保持最小改动(DB 凭据、admin center 哈希、两个 update/addon 开关),日常运维参数优先用 Web 系统设置或 system-set-settings -n 改 isys_settings,LDAP 与权限在租户库内按 GUI 配置。命令层的完整用法、备份恢复与升级流程,见《i-doit 38 常用 CLI 命令与运维实操》;产品定位与选型对比见《i-doit 介绍与选型指南》。