- OpenResty Hello World
- Nginx 数据结构和方法
- Vim 写 C、Lua 配置
- C Common Fuction
- C Debug
- SystemTap Tips
- Compilers Notes
This file contains 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 | |
# Copyright (c) 2013 The Bitcoin Core developers | |
# Distributed under the MIT software license, see the accompanying | |
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
#network interface on which to limit traffic | |
IF="wlan0" | |
#limit of the network interface in question | |
LINKCEIL="5mbit" | |
#limit outbound Bitcoin protocol traffic to this rate |
This file contains 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
server { | |
listen 80; | |
{{range services}} | |
{{if and (ne .Name "consul") (ne .Name "nginx")}} | |
{{range service .Name}} | |
location /{{.Name}}/v{{.ID}} { | |
rewrite /{{.Name}}/v(\d+)\.\d+\.\d+(.*) /{{.Name}}/v$1$2 break; | |
proxy_pass http://{{.Address}}:{{.Port}}; | |
} | |
{{end}} |
This file contains 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 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;
This file contains 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 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 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