Skip to main content

Installation

CasWAF uses Casdoor to manage members. So you need to create an organization and an application for CasWAF in a Casdoor instance.

Requirements

OS

All major operating systems including Windows, Linux and macOS are supported.

Environments

info

We strongly suggest you use Yarn 1.x to run & build CasWAF frontend, using NPM might cause UI styling issues, see more details at: casdoor#294

caution

For Chinese users, in order to download the Go dependency packages successfully, you need to use a Go proxy by Configuring the GOPROXY environment variable. We strongly recommend: https://goproxy.cn/

Download

The source code of CasWAF is hosted at GitHub: https://github.com/casbin/caswaf. Both the Go backend code and React frontend code are inside the single repository.

NameDescriptionLanguageSource code
FrontendWeb frontend UI for CasWAFJavascript + Reacthttps://github.com/casbin/caswaf/tree/master/web
BackendRESTful API backend for CAsWAFGolang + Beego + MySQLhttps://github.com/casbin/caswaf

CasWAF supports Go Modules. To download the code, you can just simply clone the code both via go get and git:

go get github.com/casbin/casdoor
go get github.com/casbin/caswaf

or

git clone https://github.com/casbin/casdoor
git clone https://github.com/casbin/caswaf

Necessary configuration

Set up database

CasWAF will store its users, nodes and topics information in a MySQL database named: caswaf. CasWAF will create it if not existed. The DB connection string can be specified at: https://github.com/casbin/caswaf/blob/master/conf/app.conf

dataSourceName = root:123@tcp(localhost:3306)/

CasWAF uses XORM to connect to DB, so all DBs supported by XORM can also be used.

Configure Casdoor

info

In order not to affect Docker users, we temporarily chose to embed the WAF rules into the binary, if you need to change the default rules (conf/waf.conf), please do so before compiling.

After creating an organization and an application for CasWAF in a Casdoor, you need to update clientID, clientSecret, casdoorOrganization and casdoorApplication in app.conf and Conf.js to change the configuration.

  • Backend (conf/app.conf)
casdoorEndpoint = <Your Casdoor endpoint>
clientId = <Your Casdoor application's client ID>
clientSecret = <Your Casdoor application's client secret>
casdoorOrganization = <Your Casdoor organization name>
casdoorApplication = <Your Casdoor application name>
  • Frontend (web/src/Conf.js)
serverUrl: "<Your Casdoor endpoint>"
clientId: "<Your Casdoor application's client ID>"
appName: "<Your Casdoor application name>"
organizationName: "<Your Casdoor organization name>"

More details about Casdoor configuration can be found at: casdoor-sso

Run CasWAF

  • Build backend of CasWAF
    • go build github.com/casbin/caswaf
  • Build frontend of CasWAF
    • yarn start
  • Now you can visit CasWAF configuration website at:
    • http://localhost:16001/

Optional configuration

Set up your WAF to enable some third-party login platform

CasWAF uses Casdoor to manage members. If you want to log in with oauth, you should see casdoor oauth configuration.

OSS, Mail, and SMS services

CasWAF uses Casdoor to upload files to cloud storage, send Emails and send SMSs. See Casdoor for more details.