View on GitHub

Web Chroot Manager

Web Chroot Manager (WCM) - chroot made easy. It's a small, easy to use application with a built in wizard

Download this project as a .zip file Download this project as a tar.gz file

Web Chroot Manager (WCM)

Revision History

0.1 - First release
0.2 - Installer script added, readme updated

Web Chroot Manager (WCM) aims to simplify the management of chroot in Linux. It's a small easy to use application with a built in wizard which creates chroot environments suitable for PHP-FPM.

WCM supports adding additional binaries to chroot, updating of chroot with new packages, and generating and comparing blueprints of files contained inside the chroot.

Limitations

WCM has been designed for Ubuntu 12.04+ LTS. Debian and CentOS/Redhat support are due with the next release.

Installation

Run ./install.sh script

By default, WCM assumes that the configuration directory is located at /etc/buckhill-wcm.

You may change the CFGDIR variable in order to move the configuration directory.

WCM Workflow

1. Use wizard to generate primary and secondary user(s) configuration
2. Use wizard to generate site(s) configuration
3. Or, edit template file(s) manually
4. Create user account(s) and site(s) using create command
5. After site is completely deployed, generate blueprints as required 

How to use WCM

Note: Starting WCM without any arguments specified will print help text detailing a list of roles and available options.

WCM has several roles and commands:-

1. Wizard
2. Create
3. Install Extra Binaries
4. Update Binaries
5. Binary Blueprint Manager

1. Wizard Overview

The wizard is used to generate configuration files which are later used when creating chroot accounts and sites.

There are three sections:

- Primary account
- Secondary account
- Site

To run, type: web-chroot-manager.sh wizard

1.1 Wizard - Primary Account

The primary account is the account under which the chroot is installed. Its UID and GID are used by PHP-FPM.

The wizard asks for:

To run, type: web-chroot-manager.sh wizard

1.2 Wizard - Secondary Account

The account for the site administrator. Access is allowed via SFTP. It inherits the GID of the primary account.
Since PHP is also run under the primary account you are free to deny access to the files by changing group permissions.

The wizard asks for:

The Primary and Secondary account will be automatically added to primary and secondary groups, which are used for SSH access policy enforcing.

Groups are defined in /etc/buckhill-wcm/general.conf under PRIMARY_GROUP and SECONDARY_GROUP variables.

Groups have to be setup on the server and the SSH server already configured, in order for the SSH access policy to work.

You may use the linux-package-installer (LPI) to configure the SSH server, if required.

To run, type: web-chroot-manager.sh wizard

1.3 Wizard - Site

This generates a configuration for an Apache vhost which uses the PHP-FPM pool configured for the Primary account. The wizard requires the Primary account username.

The wizard asks for:

To run, type: web-chroot-manager.sh wizard

2. Create

Creates a chroot account (Primary account), Secondary account and site

The configuration file for each action has to exist within /etc/buckhill-wcm/

Options:

To create chroot user, type: web-chroot-manager.sh create -u testuser

To create site under chroot user, type: web-chroot-manager.sh create -s testdomain.com

3. Install Extra Binaries

Installs extra binaries into the chroot and updates the configuration file of the Primary account

Options (mandatory):

To run, type: web-chroot-manager.sh install -u testuser -p wget,ntp,nano

4. Update Binaries

Updates binaries within a chroot. The binary has to be specified in the Primary account configuration file

Options (mandatory):

Optionally you may specify which binaries will be updated with -p flag

If the flag is not provided then all binaries from the configuration file will be updated

To update all binaries, type: web-chroot-manager.sh update -u testuser

To update specific binaries, type: web-chroot-manager.sh update -u testuser -p wget,ntp,nano

5. Binary Blueprint Manager

With this function you can check your files against potentially unauthorised changes

The blueprint report provides a list of changed, missing, or new files

Options:

A file exclusion list can be defined within "full_bp_exclusions", which has to be saved into the configuration directory of the primary account.

To run, type: web-chroot-manager.sh blueprint -u testuser -g

To compare against previous state, type: web-chroot-manager.sh blueprint -u testuser -c

To compare against previous state, type: web-chroot-manager.sh blueprint -u testuser -c -f /path/to/blueprintfile

Directory structure and configuration files

Main configuration file:

/etc/buckhill-wcm/general.conf

Configuration file for the user generated with wizard:

/etc/buckhill-wcm/accounts/[Account Name]/user.conf

Binary blueprint exclusions list for the user:

/etc/buckhill-wcm/accounts/[Account Name]/full_bp_exclusions

The Linux Grep utility is used for matching patterns within this file, therefore the file format should be understandable to grep. For further informations check the grep documentation, specifically under "option -f"

Binary blueprint files for the user:

/etc/buckhill-wcm/accounts/[Username]/blueprints

Any binaries or file in this directory will be installed in chroot:

/etc/buckhill-wcm/accounts/[Account Name]/custom/

Website configuration:

/etc/buckhill-wcm/accounts/sites/domain_name.conf

Templates for php-fpm and Apache:

/etc/buckhill-wcm/apache_vhost_template.conf

/etc/buckhill-wcm/apache_php-fpm.conf

/etc/buckhill-wcm/fpm_pool_template.conf