Skip to content

honeybot/wtf

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

WTF

WTF is a Web Tailoring Framework built on top of Nginx/OpenResty.

Quick Start

Before install WTF you need OpenResty, lua-rocks and git installed. Please follow this guide to add OpenResty repo to your system.

To install packages in Debian-based system run:

$ sudo apt-get update
$ sudo apt-get install openresty luarocks git
  1. Install core framework with luarocks:
$ luarocks install wtf
  1. Install demo package containing action, plugin and solver:
$ luarocks install wtf-demo
  1. Clone demo policy repo to directory containing OpenResty configuration (i.e. /etc/openresty)
$ cd /etc/openresty
$ sudo git clone https://github.com/honeybot/wtf-demo-policy
  1. Set up WTF for your nginx.conf:
http {
    ...
    include wtf-demo-policy/nginx/bootstrap.conf;
    ...
    server {
        ...
        location / {
          set $wtf_policies "demo";
          include wtf-demo-policy/nginx/policy/proxy.conf;
          ...
        }
      ...
    }
    ...
}
  1. Restart OpenResty and test your deployment:
$ sudo service openresty restart
$ curl -s http://localhost:8080/ > /dev/null && tail -n 5 /usr/local/openresty/nginx/logs/error.log

You should see log records from WTF:

2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This is direct action"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): Second says: "Hello, world! This is direct action"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This action was postponed"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): Second says: "Hello, world! This action was postponed"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/02/16 13:38:20 [error] 88091#15451556: *7 [lua] log.lua:14: act(): First says: "Hello, world! This is a  solver". Second says: "Hello, world! This is a  solver"., client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"

About

WTF is a Web Tailoring Framework built on top of Nginx/OpenResty

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages