add svc_external
[freeside.git] / httemplate / docs / session.html
1 <head>
2   <title>Session monitor</title>
3 </head>
4 <body>
5 <h1>Session monitor</h1>
6 <h2>Installation</h2>
7 For security reasons, the client portion of the session montior may run on one
8 or more external public machine(s).  On these machines, install:
9 <ul>
10   <li><a href="http://www.perl.com/CPAN/doc/relinfo/INSTALL.html">Perl</a> (at l
11 east 5.004_05 for the 5.004 series or 5.005_03 for the 5.005 series.  Don't enable experimental features like threads or the PerlIO abstraction layer.)
12   <li><a href="man/FS/SessionClient.html">FS::SessionClient</a> (copy the fs_session/FS-SessionClient directory to the external machine, then: perl Makefile.PL; make; make install)
13 </ul>
14 Then:
15 <ul>
16   <li>Add the user `freeside' to the the external machine.
17   <li>Create the /usr/local/freeside directory on the external machine (owned by the freeside user).
18   <li>touch /usr/local/freeside/fs_sessiond_socket; chown freeside /usr/local/freeside/fs_sessiond_socket; chmod 600 /usr/local/freeside/fs_sessiond_socket
19     <li>Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the external machine(s).
20   <li>Run <pre>fs_session_server <i>user</i> <i>machine</i></pre> on the Freeside machine.
21   <ul>
22     <li><i>user</i> is a user from the mapsecrets file.
23     <li><i>machine</i> is the name of the external machine.
24   </ul>
25 </ul>
26 <h2>Usage</h2>
27 <ul>
28   <li>Web
29     <ul>
30       <li>Copy FS-SessionClient/cgi/login.cgi and logout.cgi to your web
31           server's document space.  
32       <li>Use <a href="http://www.apache.org/docs/suexec.html">suEXEC</a> or <a href="http://www.perl.com/CPAN-local/doc/manual/html/pod/perlsec.html#Security_Bugs">setuid</a> (see <a href="install.html">install.html</a> for details) to run login.cgi and logout.cgi as the freeside user.
33     </ul>
34   <li>Command-line
35     <br><pre>freeside-login username ( portnum | ip | nasnum nasport )
36 freeside-logout username ( portnum | ip | nasnum nasport )</pre>
37     <ul>
38       <li><i>username</i> is a customer username from the svc_acct table
39       <li><i>portnum</i>, <i>ip</i> or <i>nasport</i> and <i>nasnum</i> uniquely identify a port in the <a href="schema.html#port">port</a> database table.
40     </ul>
41   <li>RADIUS - One of:
42     <ul>
43       <li>Run the <b>freeside-sqlradius-radacctd</b> daemon to import radacct
44         records from all configured sqlradius exports:
45           <tt>freeside-sqlradius-radacctd username</tt>
46       <li>Configure your RADIUS server's login and logout callbacks to use the command-line <tt>freeside-login</tt> and <tt>freeside-logout</tt> utilites.
47       <li> <i>(incomplete)</i>Use the <b>fs_radlog/fs_radlogd</b> tool to
48         import records from a text radacct file.
49     </ul>
50 </ul>
51 <h2>Callbacks</h2>
52 <ul>
53   <li>Sesstion start - The command(s) specified in the <a href="config.html#session-start">session-start</a> configuration file are executed on the Freeside machine.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.
54   <li>Session end - The command(s) specified in the <a href="config.html#session-stop">session-stop</a> configuration file are executed on the Freeside machine.  The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.
55 </ul>
56 <h2>Dropping expired users</h2>
57 Run <pre>bin/freeside-session-kill username</pre> periodically from cron.
58 </body>
59 </html>