Deployment checklist
A repeatable pre-flight flow built from the previous sections.
Build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8
cd ..
lsof -i :80
./bin/paozhu conf/server.conf
curl -I http://127.0.0.1/
tail -f log/*Release build
Confirm
-DCMAKE_BUILD_TYPE=Releaseand checkbin/paozhu.Database
Import SQL and update credentials in
conf/orm.conf; verify each tag.Models
After schema or template changes, rerun
paozhu_cli orm <tag>for each tag.Ports and directories
Check port 80 with
lsof -i :80; ensurewwwpath,logpathandtemppathexist and are writable.Sites
Check
wwwpath, certificate keys, HTTP/2 andacme_autoper[domain]section.Permissions
Masked routes have
install_route_guard()installed and grants registered and assigned.Observability
Watch
log/; verify HTTPS and h2 withcurl -Iandh2load.
Runtime mode
Keep deamon_enable = 0 in development so logs stay in the foreground. Set it to 1 in production to fork into the background. The docs also describe touch log/restart_server as a restart trigger.
3. Security hardening
Paozhu ships with working example credentials and legacy MD5 hashes in docs so you can get up and running fast. Before you ship, walk through these four items — they are never auto-generated or enforced by the framework itself.
3.1 Replace sample credentials & MD5 hashing
Both conf/orm.conf and conf/server.conf use short, predictable values for development. MD5 appears in the test controller and some tutorial examples. Swap them before go-live.
[cms]
host = 127.0.0.1
port = 3306
dbtype = mysql
dbname = benchmark
user = benchmarkuser
password = CHANGE_ME # was "benchmarkdbpass"For password hashes in your own auth flows, prefer bcrypt / argon2 over MD5. If MD5 stays because of a legacy requirement, run it through a per-user salt: md5(salt + password), never a plain MD5 of the password alone.
3.2 Review ownership checks on superadmin endpoints
The /superadmin/rbac/* route family is guarded by superadmin_islogin which only checks that a valid session is present. It does not confirm that the session subject is actually a superadmin user. Add one ownership check on POST handlers so that a compromised admin account cannot escalate to the superadmin ROC.
// Before — only session presence:
// if (!superadmin_rbac::check_csrf(client)) ...
// After — session role + ownership:
auto role_id = client.session["role_id"].to_int();
if (role_id != SUPERADMIN_ROLE_ID) {
client.set_http_code(403);
client << "{\"err\":\"forbidden\"}";
return "";
}3.3 Add CSRF to superadmin login and POST routes
The regular admin panel registers its login with admin_csrf_issue / admin_csrf_check. The superadmin controllers already issue and check CSRF in RBAC handlers — superadmin_rbac::issue_csrf(client) / superadmin_rbac::check_csrf(client) — but make sure your superadmin-facing login/POST routes mirror that pattern.
// Admin login — CSRF is wired:
reg_raw("", "/admin/login", admin_csrf_issue, nullptr, admin_login, nullptr, 0, 0, 0, "");
reg_raw("", "/admin/loginpost", admin_csrf_check, nullptr, admin_loginpost, nullptr, 0, 60, 5, "");
// Your superadmin POST routes should do the same:
reg_raw("", "/superadmin/rbac/user/editpost",
superadmin_rbac::issue_csrf,
nullptr,
superadmin_rbac_user_editpost,
superadmin_rbac::check_csrf, // guard on POST
0, 0, 0, "");3.4 Cross-process grant-cache invalidation (multi-instance)
When you run multiple paozhu workers or instances behind a load balancer, one worker's local RBAC grant cache can drift from the others after an admin role change. Publish an invalidation event through Redis pub/sub or a relational table so every worker drops its grant cache within a second.
// After saving a role-change:
auto json = make_invalidate_json(role_id, user_id);
redis::client rc("redis://127.0.0.1:6379/0");
rc.set_connect_timeout_ms(100);
rc.connect();
rc.publish("paozhu:rbac:invalidate", json.dump());