- OpenResty Hello World
- Nginx 数据结构和方法
- Vim 写 C、Lua 配置
- C Common Fuction
- C Debug
- SystemTap Tips
- Compilers Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ $cfg := .Cfg }} | |
{{ $IsIPV6Enabled := .IsIPV6Enabled }} | |
{{ $healthzURI := .HealthzURI }} | |
{{ $backends := .Backends }} | |
{{ $proxyHeaders := .ProxySetHeaders }} | |
daemon off; | |
worker_processes {{ $cfg.WorkerProcesses }}; | |
pid /run/nginx.pid; | |
{{ if ne .MaxOpenFiles 0 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://github.com/openresty/lua-nginx-module#nginx-api-for-lua | |
-- https://www.nginx.com/resources/wiki/modules/lua/ | |
-- http://www.staticshin.com/programming/definitely-an-open-resty-guide/ | |
-- access_by_lua_file /path/to/waf.lua; | |
-- examine request | |
ngx.req.read_body() | |
local request_method = ngx.req.get_method() | |
local get_args = ngx.req.get_uri_args() | |
local post_args, err = ngx.req.get_post_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" mysql中增加一数据库,名为nginx,编码为utf8 | |
" 增加一表,名为 uploadfile 结构为 | |
CREATE TABLE `uploadfile` ( | |
`id` int(20) NOT NULL AUTO_INCREMENT, | |
`filehash` varchar(50) DEFAULT NULL, | |
`filename` varchar(100) DEFAULT NULL, | |
`filelen` varchar(50) DEFAULT NULL, | |
`contenthash` varchar(80) DEFAULT NULL, | |
PRIMARY KEY (`id`) |
本來打算試著用 ngx_lua 取代原本用 C 實作的 access control,可是看完了「基本語法」想要找一些相關會用到的 library 都找不太到,像 lua-aws 雖然有人寫,但看起來不太完整。這樣就不能透過 lua script 存取 aws service 取得認證的資訊。
不過,想了想它網頁上 access_by_lua 的例子也沒有直接寫在裡面,就以 deleagte 的形式問了其它 uri:
location / {
deny 192.168.1.1;
allow 192.168.1.0/24;
allow 10.1.1.0/16;
deny all;
总有那么些蛋疼的机房,为了所谓的这安全,将NTP 服务器一刀切了。这时候时间同步就是一个问题,不过我们还可以使用
rdate
来解决。
yum -y install rdate
rdate -s time.nist.gov
cat > /etc/cron.daily/rdate << "EOF"
#!/bin/sh
rdate -s time.nist.gov
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
# FRONT | |
chronograf: | |
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/ | |
image: chronograf | |
deploy: | |
replicas: 1 | |
placement: | |
constraints: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Setup and enable auditd | |
# MUST REBOOT AFTER SETUP | |
# | |
# FUNCTIONALITIES: | |
# | |
# * Auditing user TTY | |
# aureport --tty | |
# | |
# * Auditing root commands (real uid) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module("resty.consul", package.seeall) | |
_VERSION = '0.1.0' | |
function service_nodes(service) | |
local http = require "resty.http" | |
local json = require "cjson" | |
local hc = http:new() | |
local upstream = "" |
This installation is going to require 2 servers one acts as kerberos KDC server
and the other machine is going to be client. Lets assume the FQDN's are (here
cw.com
is the domain name, make a note of the domain name here):
- Kerberos KDC Server: kdc.cw.com
- Kerberos Client: kclient.cw.com
Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in