Felitaur Site
Offerings
|
   
|
|
Portsentry Start/Stop Script
Lecture Overview Index | Linux SysAdmin Homepage
Portsentry is a program that helps you detect "Port scans" against your
system. For this assignment you mustinstall portsentry version 2.01 or
newer, from source code (no rpms)
Program requirements
- Must behave just like the start/stop scripts in /etc/rc.d/init.d
(feel free to look at them for ideas).
- Using a "case" statement, your script should respond to the following
via $1 (the command line argument)
- start
- stop
- restart
- status
- and a default (shown as * in the case statement)
- You will need to find the PID
of portsentry (pgrep -x)
- You must determine if the process is already running before starting
it, (and if already running then let the user know) and if already stopped
let them know that as well.
- restart needs to do all of the options for start and stop
- status must give the output:
portsentry (pid #) is running.
portsentry is NOT running.
- If they fail to type a valid option, or just give a bad option:
Usage: portsentry {start|stop|status|restart}
- Finally, put the script into /etc/rc.d/init.d (set permissions
and
owner/group to the same as the other scripts in that directory
- Create a checkconfig comment line for runlevels 2345 where portsentry
is set as S95 for a start and a K18 for a kill. (See the /etc/rc.d/init.d/sshd script for idea)
- Go into /etc/rc.d/rc3.d and do
ln -s ../init.d/portsentryd S95portsentryd
OR use chkconfig --level 3 portsentryd on
- Remember to Comment Out the /usr/local/psionic/portsentry2/portsentry
line from the file /etc/rc.d/rc.local so you don't have portsentry
started multiple times (but don't remove it, so I know you did it)
|
|