tinycms

command module
v0.0.0-...-26ccd28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

TinyCMS

cms system

基本运行

tinycms -version             # 显示服务程序的当前版本
tinycms                      # 运行服务程序

身份验证(中间件)

基本意义
# 身份认证模式分为Red与Blue两个等级,都是通过request的head中 Authorization 进行传递
"Authorization": "Red dXNlcjE6cGFzc3dvcmQ="
# 或
"Authorization": "Blue dXNlcjE6cGFzc3dvcmQ="

无论Red或Blue,后面内容格式被base64解码后,都应为 user:token

Red表示后面内容中 user应该存在有意义用户id

Blue则表明后面格式中用户名部分无意义或无人登录。该部分主要用于核定客户端发回的token是否有效,用于简易判断是否爬虫程序还是正常的浏览器访问

相关配置

第30行决定是否进行token校验(审计)。同时需要redis服务配合,redis服务配置位于第8行 - 11行

publishing:
  server: "127.0.0.1:9000"
redis:
  local:
    server: "127.0.0.1:6379"
    pwd: 
    db: 0
  audit_auth_token:   
    server: "127.0.0.1:6379" 
    pwd:
    db: 0
mariadb:
  tcms:
    server: "172.16.1.250"
    port: 3306
    uid: root
    pwd: "123"
    db: tinycms
    timeout: 10
  logclientip:
    server: "172.16.1.250"
    port: 3306
    uid: root
    pwd: "123"
    db: clientiplog
    table: tcms
    timeout: 10    
audit:
  auth_token:  # 审计auth_token策略
    allow: true # 是否允许审计auth_token
    expire_ms: 60000  # token保存有效时间(毫秒)
    jam_ms: 10000  # 请求被审计后,每次请求都会被卡住jam_ms毫秒数,然后才能继续
    repeat: 1 # token被重复n次后会被触发审计
  log_clientip:
    allow: true 

ip记录(中间件)

相关配置

第35行决定是否进行来访ip记录。同时需要MariaDB服务配合,配置位于第20行 - 27行。需要注意由于请求由Nginx转发过来,需要注意配置Nginx的转发内容,以确保客户端ip的真实有效。

publishing:
  server: "127.0.0.1:9000"
redis:
  local:
    server: "127.0.0.1:6379"
    pwd: 
    db: 0
  audit_auth_token:   
    server: "127.0.0.1:6379" 
    pwd:
    db: 0
mariadb:
  tcms:
    server: "172.16.1.250"
    port: 3306
    uid: root
    pwd: "123"
    db: tinycms
    timeout: 10
  logclientip:
    server: "172.16.1.250"
    port: 3306
    uid: root
    pwd: "123"
    db: clientiplog
    table: tcms
    timeout: 10    
audit:
  auth_token:  # 审计auth_token策略
    allow: true # 是否允许审计auth_token
    expire_ms: 60000  # token保存有效时间(毫秒)
    jam_ms: 10000  # 请求被审计后,每次请求都会被卡住jam_ms毫秒数,然后才能继续
    repeat: 1 # token被重复n次后会被触发审计
  log_clientip:
    allow: true 

Documentation

Overview

* @Author: wang * @Date: 2021-11-10 12:05:18 * @LastEditTime: 2021-11-10 13:52:59 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/main.go

Directories

Path Synopsis
* @Author: your name * @Date: 2021-11-10 12:03:01 * @LastEditTime: 2021-11-10 12:03:53 * @LastEditors: your name * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/config/config.go * @Author: your name * @Date: 2021-11-10 12:17:55 * @LastEditTime: 2021-11-10 13:50:48 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/config/mariadb.go
* @Author: your name * @Date: 2021-11-10 12:03:01 * @LastEditTime: 2021-11-10 12:03:53 * @LastEditors: your name * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/config/config.go * @Author: your name * @Date: 2021-11-10 12:17:55 * @LastEditTime: 2021-11-10 13:50:48 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/config/mariadb.go
* @Author: your name * @Date: 2021-11-10 12:29:18 * @LastEditTime: 2021-11-10 12:31:55 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/middleware/cross.go
* @Author: your name * @Date: 2021-11-10 12:29:18 * @LastEditTime: 2021-11-10 12:31:55 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /tinycms/middleware/cross.go
routes
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址