Git Product home page Git Product logo

craft.patrol's Introduction

Patrol

Patrol 1.1.0

Lovingly crafted by Selvin Ortiz for Craft CMS

Patrol simplifies maintenance and SSL for sites built with Craft

Support Craft Plugin Development By Selvin Ortiz

Features

  • Put your site on maintenance mode quickly and easily
  • Force SSL globally or on specific pages with fine grain control
  • Uses IP based authentication to bypass maintenance mode
  • Allows IP based authentication even if behind CloudFlare
  • Allows logged in admins to bypass maintenance mode
  • Allows logged in users with proper permissions to bypass maintenance mode
  • Fully configurable via environment configs

Installation

  1. Download the latest release
  2. Extract the archive and place patrol inside your craft/plugins directory
  3. Adjust file permissions as necessary

Setup

Patrol offers a pretty straight forward but fully featured UI to adjust settings as needed.
Additionally, you can fully configure Patrol via environment configs which will take priority.

Environment Driven Configuration

You can configure Patrol and all of its settings from any environment definition. Here is an example of how you could go about setting that up...

// config/general.php
return array(
	'*'	=> array(
		'environmentVariables' => array()
	),
	'.dev'	=> array(
		'patrol'				=> array(
			'forceSsl'			=> false,
		)
	),
	'.com' => array(
		'patrol'				=> array(
			'forceSsl'			=> true,
			'restrictedAreas'	=> array(
				'/{cpTrigger}',
				'/members'
			),
			'maintenanceMode'	=> false,
			'maintenanceUrl'	=> '/offline.html',
			'authorizedIps'		=> array(
				'127.0.0.1',
			),
			'enableCpTab'		=> false
			'pluginAlias'		=> '',
		)
    )
);

Notes

  • If no maintenance URL is set, Patrol will default to throwing a 403 HTTP error
  • The Control Panel is accessible by logged in admins if maintenance mode is ON
  • The Control Panel is accessible by users with proper permissions if maintenance mode is ON

FAQ

1. How do I give users access when maintenance mode is ON?
  • You can add their IP to the list of Authorized IPs
  • You can give them permission (Patrol > Access the site when maintenance is on
  • Logged in users with admin privileges have full access by default
2. Will IP authentication work if my site is behind CloudFlare?
  • Yes, CloudFlare provides the requesting IP via a header that Patrol understands
3. Doesn't Craft have a maintenance mode setting?
  • Yes, but it's meant for internal use only to handle updates

SSL Rules FAQ

Please note that these questions/answers only apply if you don't want to enable SSL everywhere for whatever reason. However, forcing SSL everywhere is now standard practice and it is what I would recommended you do.

1. How do I force secure connections on the Control Panel?
  • You can simply add the URL for it (/admin) or use /{cpTrigger} so that it works even if you change that setting later
2. How do I force secure connections on a specific URL, like my login page?
  • You can add something like /members/login to the Restricted Areas
3. How do I force secure connections on a specific section, like the members area?
  • You can add the section URL /members and URLs on that scope will be protected as well

Help & Feedback

If you have questions, comments, or concerns feel free to reach out to me on twitter @selvinortiz

License

Patrol for craft is open source software licensed under the MIT License

Open Source Initiative

craft.patrol's People

Contributors

selvinortiz avatar

Watchers

James Cloos avatar Webremote avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.