Skip to content

Code-Egg/ols-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OLS CLI

ols-cli

CI Status Release Status Go Release

Ubuntu CentOS CPU amd64 CPU arm64

Installation

Use the one-line installer to install ols cli binary:

bash <(curl -fsSL https://raw.githubusercontent.com/Code-Egg/ols-cli/master/install_olscli.sh)

Install runtime once

Install OpenLiteSpeed, PHP, Database.

sudo ols install

Usage

Create a wordprss site

sudo ols site create example.com --wp

Create a site with WordPress + Let's Encrypt

sudo ols site create example.com --wp --le

Update a site to a target PHP version

sudo ols site update example.com --php85

Update CLI binary to latest release

sudo ols update

Security

Enable OWASP + reCAPTCHA and add security headers on a site

sudo ols site update example.com --enable-owasp --enable-recaptcha --hsts

Enable namespace

sudo ols site update example.com --enable-ns

Control

Show site information

ols site info example.com

Show OpenLiteSpeed virtual host config

ols site show example.com

List managed sites

ols site list

Preview mode

ols --dry-run site create example.com --wp --le --php85 --enable-owasp --hsts --enable-ns
ols --dry-run site update example.com --enable-recaptcha --disable-owasp --disable-ns --le
ols --dry-run site info example.com
ols --dry-run site show example.com
ols --dry-run site list
ols --dry-run update

Command overview

The ols commands:

ols (command) [options]
Command Purpose Options
install Install/align OpenLiteSpeed runtime and related packages --php81 --php82 --php83 --php84 --php85 --database --config --http-port --https-port --ssl-cert --ssl-key --no-listeners
site Manage sites (create, update, enable, disable, info, show, list, delete) --wp --le --php81 --php82 --php83 --php84 --php85 --enable-owasp --disable-owasp --enable-recaptcha --disable-recaptcha --enable-ns --disable-ns --hsts --keep-db
update Update installed ols binary to latest GitHub release for current platform

Global options (apply to all commands): --dry-run, --color

site

ols site (command) [options]
Subcommand Purpose Options
create Create a new site/vhost --wp --le --php81 --php82 --php83 --php84 --php85 --enable-owasp --disable-owasp --enable-recaptcha --disable-recaptcha --enable-ns --disable-ns --hsts
update Update an existing site (PHP target optional when only WordPress/security/LE flags are used) optional --wp, optional --le, optional PHP target: --php81 --php82 --php83 --php84 --php85, or security flags: --enable-owasp --disable-owasp --enable-recaptcha --disable-recaptcha --enable-ns --disable-ns --hsts
enable Enable site from server-level
disable Disable site from server-level
info Show site metadata and detected status
show Print OLS virtual host config
list List managed sites discovered from OLS vhost directory
delete Remove site config/files and optionally keep DB --keep-db

Development

Build locally

go build -o ols ./cmd/ols

Run tests

go test ./...

For verbose output:

go test -v ./...

FAQ

Custom the default config file

Use config file defaults (recommended for first-run bootstrap):

sudo mkdir -p /etc/ols-cli
sudo cp docs/install.example.json /etc/ols-cli/install.json
sudo ols install

install.json also supports:

  • owasp_crs_version (for example, "4.21.0") for OWASP CRS setup during ols install
  • vh_recaptcha_type and vh_recaptcha_reg_conn_limit (defaults: 1 and 500) used when enabling vhost reCAPTCHA via site create/update --enable-recaptcha

By default, ols install prepares server-level security blocks as:

  • module mod_security with ls_enabled 0
  • lsrecaptcha with enabled 1 and type 0
  • namespace with 1

Override config values with flags when needed:

sudo ols install --config /etc/ols-cli/install.json --php85 --database mysql --http-port 80 --https-port 443
sudo ols install --no-listeners

About

A CLI tool for managing OpenLiteSpeed and WordPress.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors