VacCon - 0.2.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Whom: Steve Mertz Date: 2005.12.30 This set of programs is for activating and de-activating /usr/bin/vacation from a web page. This allows people who are technically challenged to setup their own auto-response messages and turn it on and off as they need it, without bothering their busy system administrator. Development Platform: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RedHat WS: 3.4 Perl: v5.8.0 gcc: 3.2.3 Tested Platforms: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RedHat WS: 3.4 Perl: v5.8.0 OpenBSD: 3.1 Perl: 5.6.1 gcc: 2.95.3 Requirements: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Perl Module: CGI::Form (Apart of the cvswebedit module) Perl Module: Authen::PAM (Linux Only) INSTALL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 01) Setup your web server to allow CGI scripts. 02) Create an area for the scripts to be installed 03) In this new area create 2 directories. 'bin' and 'tmp' 04-Linux) Copy files: adjust_procmailrc.pl, move_file.pl, user_okay.pl to the newly created bin directory. 04-OpenBSD) Copy files: adjust_procmailrc.pl, move_file.pl, user_okay.c to the newly created bin directory. 05-Linux) Rename user_okay.pl to user_okay 05-OpenBSD) Compile user_okay: gcc -o user_okay user_okay.c 06-Linux) Nothing... 06-OpenBSD) Change group of user_okay to 'auth': chgrp auth user_okay 07-Linux) Nothing... 07-OpenBSD) Change permissions of user_okay to be setguid: chmod +s user_okay 08) Change permissions of programs: chmod 755 adjust_procmailrc.pl move_file.pl user_okay 09) Change permissions of bin directory for security: chmod 111 bin 10) Change owner of tmp directory. Change the owner to that of the webserver user. chown www tmp OR you could just chmod 777 tmp and let everyone read/write to that directory which is not such a good idea security wise. 11) Copy login.cgi and vacation.cgi to the root directory of the area you created for this. 12) Change permissions to login.cgi and vacation.cgi chmod 755 login.cgi vacation.cgi 13) Edit Config.pm to your liking. 14) Change permissions to the root directory chmod 111 root_directory 15) Edit the sudoers file to include these lines: User_Alias VACATIONERS = %vacation Cmnd_Alias PROCMAILFIX = /var/www/htdocs/vacation/bin/adjust_procmailrc.pl Cmnd_Alias MOVEFILE = /var/www/htdocs/vacation/bin/move_file.pl Cmnd_Alias VACATION = /usr/bin/vacation Runas_Alias VACATIONERS = %vacation VACATIONERS machine_name = (VACATIONERS) NOPASSWD: PROCMAILFIX VACATIONERS machine_name = (VACATIONERS) NOPASSWD: MOVEFILE VACATIONERS machine_name = (VACATIONERS) NOPASSWD: VACATION 16) Create a new group in /etc/group: vacation:*:500:users. 500 will be a unique group number that has not been used by the system yet. users, is the list of users that will have access to use the vacation program. 17) Make sure Perl module CGI::Form is installed. Download cvswebedit from cpan, and copy the CGI directory in to your Perl modules area. 18) That's all! Suggestions: Setup the web page for this to be secure (ie. https) because you are going to be transferring passwords over the web. Change login.cgi to index.cgi and make the configuration for this area use that as the Directory Index, so you don't have to have the script in the url. USAGE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Usage is quite simple. You goto the page the login.cgi page and go from there. Enter in your user name and password. Then you are wisked away to the page that actually does the work, if your user pass combo are valid. Description: Name: This is what your name is, and will show up as in the from line in the email. Email Address: This is what your email address will be in the from line. This line is important. If your email address is different than your username, then you need to make sure this is reflected here as there is an alias created from the email address to make sure everyone who sends email to you, gets the reply. Subject: Quite simply the subject of the email. Message: This is the actual message that will be sent when you activate the auto-reply. Signature: This is what shows up at the end of your email, usually your name and some other information like company, position, etc. Active: This is where you activate or de-activate the auto-reply. Username: This is your username again. Password: This is your password again. Reset: cleans out the form of what you typed in there. Save: Save what you filled out and either activates or de-activates the auto- reply, depending on if you have 'Yes' or 'No' clicked on the Activate field. LICENSE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Copyright (c) 2005, Steve Mertz # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * The names of its contributors may not be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # TODO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Make it Prettier - Add ability to set it, in the future. So you don't have to do it when you are just about to go. Like set it to activate on July 17 and deactivate on August 1. Probably us the at command for that. - Add popup help. -