3.12. ssh

3.12.1. NAME

ssh - Guardian Digital WebTool module interface to the Secure Shell (SSH) service.

3.12.2. SYNOPSIS

use ssh;
my $ssh  = new ssh($page);

3.12.3. DESCRIPTION

This Guardian Digital WebTool module provides an interface to manipulating the Secure Shell service. This module allows you to manage the sshd_config configuration file and to generate SSH keys.

3.12.4. METHODS

config_read()

This function reads sshd-server systemwide configuration file (/etc/ssh/sshd_config), and returns hash reference containing options and their respective values as key-value pairs.

Example Usage:

$ssh_opts = $ssh->config_read();

config_write($)

This function updates /etc/ssh/sshd_config file, it receives a hash reference containing keys and values(set of directives to update).

Example Usage:

$ssh->config_write($newopts);

generate_key($)

This function is used to generate ssh keys, it creates .ssh directory under root if its not there, remove old keys if any, generates keys, put in appropriate folder and sets permission. It receives hash reference as argument containing information like keyfilename, passphrase, description etc.

Example Usage:

my $userinfo  = {
      'keyfilename'   => $keyfilename,
      'description'   => $description,
      'passphrase'    => $passphrase,
   }
my $keyfile = $ssh->generate_key($userinfo);

restart()

This function is used to restart the sshd service.

Example Usage:

$services->restart('sshd');

3.12.5. AUTHORS

Ryan W. Maple <ryan@guardiandigital.com>

3.12.6. COPYRIGHT AND LICENSE

Copyright Guardian Digital, Inc., All Rights Reserved