# Signup server

For security reasons, the signup server should run on an external public webserver. On this machine, install:

- A web server, such as Apache-SSL or Apache
- SSH
- Perl (at least 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.)
- Text::Template
- Storable
- Business-CreditCard
- HTTP::BrowserDetect
- FS::SignupClient (copy the fs_signup/FS-SignupClient directory to the external machine, then: perl Makefile.PL; make; make install)

Then:

- Add the user `freeside' to the the external machine.
- Copy or symlink fs_signup/FS-SignupClient/cgi/signup.cgi into the web server's document space.
- When linking to signup.cgi, you can include a referring custnum in the URL as follows: `http://public.web.server/path/signup.cgi?ref=1542`
- Enable CGI execution for files with the `.cgi' extension. (with Apache)
- Create the /usr/local/freeside directory on the external machine (owned by the freeside user).
- touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket
- Use suEXEC or setuid (see install.html for details) to run signup.cgi as the freeside user.
- 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).
- Run

      fs_signup_server user machine agentnum refnum

  on the Freeside machine.
  - user is a user from the mapsecrets file.
  - machine is the name of the external machine.
  - agentnum and refnum are the agent and referral, respectively, to use for customers who sign up via this signup server.

Optional:

- If you create a /usr/local/freeside/ieak.template file on the external machine, it will be sent to IE users with MIME type application/x-Internet-signup. This file will be processed with Text::Template with the variables listed below available. (an example file is included as fs_signup/ieak.template) See the section on internet settings files in the IEAK documentation for more information.
- If you create a /usr/local/freeside/success.html file on the external machine, it will be used as the success HTML page. Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html. An example file is included as fs_signup/FS-SignupClient/cgi/success.html
- Variable substitutions available in ieak.template, cck.template and success.html:
  - $ac - area code of selected POP
  - $exch - exchange of selected POP
  - $loc - local part of selected POP
  - $username
  - $password
  - $email_name - first and last name
  - $pkg - package name
- If you create a /usr/local/freeside/signup.html file on the external machine, it will be used as a template for the form HTML. This requires the template to be constructed appropriately; probably best to start with the example file included as fs_signup/FS-SignupClient/cgi/signup.html.
- If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, and/or the time specified in the seconds column (for use with the session monitor), after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. The bin/generate-prepay script can be used to populate the prepay_credit table.