Bob Hartung <[EMAIL PROTECTED]> writes:

> Hi again,
>   I have my RH 6.2 machine reinstalled, all scripts restored
> and all updates applied.  I have what I think is a workable
> firewall script.  Now, what I cannot figure out is where can
> I insert a line of code that will call my firewall script
> everytime pppd opens up a new connection.

One technique that is normally used is to create an
/etc/ppp/ip-up.local script. The redhat setup will pass certain
variables to that script if it exists.  This script will fire whenever
a connection is made.

Variable $4 will contain the newly assigned address.  This would be a
good place to put a call to a firewall I think.  I am not on ppp
anymore so haven't done it myself.

An /etc/ppp/ip-up.local script collects other useful information too.
I don't recall all the info that is passed to an ip-up.local script but
Here is a good way to find out.

Create a script called ip-up.local in /etc/ppp.  Make it executable of
course (chmod 755).

cat /etc/ppp/ip-up.local
^^^^^^^^^^^^^^^^^^^^^
  #!/bin/sh
  ## $4 will be the major one here:
  ## I don't recall how many have values but its between 1 and 8 I think.
  echo -e "var \$1=<$1>\nvar \$2=<$2>\nvar \$3=<$3>\nvar \$4=<$4>
  var \$5=<$5>\nvar \$6=<$6>\nvar \$7=<$7>\nvar \$8=<$8>" 

After putting this little script in place disconnect and reconnect via ppp

You should find a file in ~/var.file that looks like:

(some will be blank and just appear as `<>')

  Var 1=<somevalue>
  var 2=<somevalue>
  etc .. up to 8

Once you see what is available, change the script to print the current
address somewhere and a line in the firewall script to source that
information.

cat ip-up.local
^^^^^^^^^^^^^^
  echo $4 > /var/run/current.add
  echo "Connection established at $4 - starting firewall"
  /etc/rc.d/rc.firewall

Line in firewall script to set external address:

   EXTERNAL_INTERFACE=`cat /var/run/current.add`  <== Note those are
                                                      back ticks  

Its also a common practice to do something similar for things that
need to be done when a connection goes down, by creating a script
called /etc/ppp/ip-down.local

Documentation: 
Some of this is  documented in a HOWTO.  I don't recall its
name but do recall where I found it.  It used to be one of the
`unmaintained HOWTOS'

Do a search on google like `LDP HOWTO'.  That will turn up some links
leading to a repository of the HOWTOS look for the ones under
`unmaintained'.  Hopefully it is still included.

I may turn up a link later today.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to