DebianNet

Section: User Contributed Perl Documentation (3)
Updated: 2018-09-29
Page Index
 

NAME

DebianNet - create, remove, enable or disable entry in /etc/inetd.  

DESCRIPTION

You can use the functions in DebianNet to to add, remove, enable or disable entries in the /etc/inetd.conf file. After the /etc/inetd.conf file has been changed, a SIGHUP signal will be sent to the inetd process to make sure that inetd will use the new /etc/inetd.conf file. The functions can also be used to add entries that are commented out by default. They will be treated like normal entries. That also means that if you already have an entry that is commented out you can't add an entry for the same service without removing the old one first.

The DebianNet functions treat entries that are commented out by a single '#' character as entries that have been commented out by a user. It will not change such entries.

For shell scripts you can also use the update-inetd command. See update-inetd(8) for further information.  

VARIABLES

$DebianNet::INETD_CONF
Contains a scalar filename to use as the inetd config file (e.g. for testing purposes).

Defaults to /etc/inetd.conf.

$DebianNet::SEP
Contains the entry comment characters. This is only necessary if you have to deal with two (or more) services of the same name.

Defaults to "#<off># " as the comment characters.

$DebianNet::MULTI
Contains a boolean that decides whether to disable/remove more than one entry at a time. If you try to remove more than one entry at a time without using this option the program will show a warning and will ask the user whether to continue.

Defaults to false.

$DebianNet::VERBOSE
Contains a boolean to select whether to explain verbosely what is being done.

Defaults to false.

 

FUNCTIONS

$rc = DebianNet::add_service($newentry, $group)
Add $newentry to the group $group of the /etc/inetd.conf file. If the entry already exist it will be enabled (it will also detect entries with different program options). Using $group is optional (the default group is the group OTHER). If the group does not exist the entry will be placed at the end of the file.

Returns 1 on success, and -1 on failure. This function might call exit() due to debconf prompt answers.

$rc = DebianNet::remove_service($entry)
Remove $entry from /etc/inetd.conf. You can use a regular expression to remove the entry.

Returns 1 on success, and -1 on failure.

$rc = DebianNet::disable_service($service, $pattern)
Disable $service (e.g. "ftp") in /etc/inetd.conf. Using $pattern is optional (see enable_service()).

Returns 1 on success, and -1 on failure.

$rc = DebianNet::enable_service($service, $pattern)
Enable $service (e.g. "ftp") in /etc/inetd.conf. Using $pattern is optional. It can be used to select a service. You only need this option if you have two (or more) services of the same name.

An example: you have three ftp entries in the /etc/inetd.conf file (all disabled by default) and you want to enable the entry which uses the vsftpd daemon. To do this, use the pattern "vsftpd" (or any other regular expression that matches this entry).

Returns 1 on success, and -1 on failure.

 

CHANGES

 

Version 1.13

New variables: $VERSION, $VERBOSE, $MULTI, $SEP, $INETD_CONF.

Deprecated variables: $version, $verbose, $multi, $sep, $inetdcf.


 

Index

NAME
DESCRIPTION
VARIABLES
FUNCTIONS
CHANGES
Version 1.13
LinuxReviews : manual page archive : man3