GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MOJOLICIOUS::PLUGIN::SETUSERGROUP (3)

.ds Aq ’

NAME

Mojolicious::Plugin::SetUserGroup - Mojolicious plugin to set unprivileged credentials

CONTENTS

SYNOPSIS



  # Mojolicious
  $self->plugin(SetUserGroup => {user => $user, group => $group});
 
  # Mojolicious::Lite
  plugin SetUserGroup => {user => $user, group => $group};
 
  # Production mode only
  plugin SetUserGroup => {user => $user, group => $group}
    if $self->mode eq production;
 
  # Root only
  plugin SetUserGroup => {user => $user, group => $group}
    if $< == 0 or $> == 0;



DESCRIPTION

This plugin is intended to replace the setuidgid functionality of Mojo::Server. It should be loaded in application startup and it will change the user and group credentials of the process when Mojo::IOLoop is started, which occurs in each worker process of a Mojo::Server::Prefork daemon like hypnotoad.

This allows an application to be started as root so it can bind to privileged ports such as port 80 or 443, but run worker processes as unprivileged users. However, if the application is not started as root, it will most likely fail to change credentials. So, you should only set the user/group when the application is started as root.

This module requires Unix::Groups and thus will only work on Unix-like systems like Linux, OS X, and BSD.

METHODS

Mojolicious::Plugin::SetUserGroup inherits all methods from Mojolicious::Plugin and implements the following new ones.

    register



  $plugin->register(Mojolicious->new, {user => $user, group => $group});



Install callback to change process credentials on the next Mojo::IOLoop tick. If option user is undefined, no credential change will occur. If option group is undefined but user is defined, the group will be set to a group matching the user name. If credential changes fail, an error will be logged and the process will be stopped.

AUTHOR

Dan Book, dbook@cpan.org

CONTRIBUTORS

Jan Henning Thorsen (jhthorsen)
Lee Johnson (leejo)

COPYRIGHT AND LICENSE

Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.

SEE ALSO

Mojolicious, POSIX, Unix::Groups
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MOJOLICIOUS::PLUGIN::SETUSERGROUP (3) 2015-11-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.