GNU Rush |
|
Restricted User Shell |
Sergey Poznyakoff |
In this subsection we will show how to set up a mail notification for
Rush rules. Let’s suppose we wish to receive emails for each upload
by scp-to
rule (see scp). To do so, we add the following
fall through rule to the beginning of rush.rc:
rule default post-socket "inet://localhost" fall-trough
This will enable notifications for each rule located below this one.
Missing port in post-socket
statement means rush
will
be using the default ‘tcpmux’ port.
To receive and process these requests, you will need an
inetd
capable to handle TCPMUX. We recommend the
one from GNU Inetutils package
(GNU Inetutils). In
/etc/inetd.conf file, we add:
# Enable TCPMUX handling. tcpmux stream tcp nowait root internal # Handle ‘scp-to’ service. tcpmux/+scp-to stream tcp nowait root \ /usr/sbin/tcpd /bin/rushmail
The program /bin/rushmail
does the actual notification.
Following is its simplest implementation:
#! /bin/sh read user command /usr/sbin/sendmail -oi -t <<EOT From: GNU Rush Notification <devnull@localhost> To: <root@localhost> Subject: GNU Rush notification Be informed that $user executed $command. EOT
This document was generated on June 29, 2019 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.