Net::Etcd::Auth
Authentication
Steps to enable authentication.
# add user $etcd->user({ name => 'root', password => 'toor' })->add; # add role $etcd->role({ name => 'root' })->add; # grant role $etcd->user_role({ user => 'root', role => 'root' })->grant; # enable auth $etcd->auth()->enable;
Defaults to $etcd->name
Defaults to $etcd->password
Returns token with valid authentication. The token must then be passed in the Authorization header. The module handles passing, storing and refreshing of the token for you as long as you define a name and password.
# authenticate etcd as root $etcd = Net::Etcd->new({ name => 'root', password => 'toor' }); # switch to non root user $etcd->auth({ name => $user, password => $pass })->authenticate;
Enable authentication.
$etcd->auth()->enable;
Disable authentication, this requires a valid root password.
$etcd->auth({ name => 'root', password => $pass })->disable;
To install Net::Etcd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Etcd
CPAN shell
perl -MCPAN -e shell install Net::Etcd
For more information on module installation, please visit the detailed CPAN module installation guide.