Date: Sun, 14 Apr 1996 12:52:45 +0200 (MET DST) From: Andreas Klemm <andreas@knobel.gun.de> To: barth <barth@sicmail.epfl.ch> Cc: hackers@freebsd.org Subject: how to bring the internet to you via push button Message-ID: <Pine.BSF.3.92.960414124041.226I-100000@knobel.gun.de> In-Reply-To: <9604132347.AA28533@ltidec3.epfl.ch>
index | next in thread | previous in thread | raw e-mail
-----BEGIN PGP SIGNED MESSAGE-----
On Sun, 14 Apr 1996, barth wrote:
> begin 644 su-tools.tgz
Thanks .. I solved it now doing the following...
fvwm95 has now an "internet" button...
The program 'internet' is suid root and calls a suid root script
internetswitch.
'internet' checks, if you are root or UID 1000 (that's me here on
my 1 user FreeBSD box). Then it sets UID to 0 so that the via execl
called shellscript really runs suid root, to do the desired tasks.
So I simply push the Internet Button of my fvwm95 desktop manager and
start everything I like
a) ppp -auto on demand
b) cached (the WWW proxy server)
c) ping ISP (initiate connection)
d) then start uucico to get mail and news, since we are just online
If you setup UUCP clever, then it looks first if he can callout
directly. But since the modem device is blocked, the alternate
rule is called, and the alternate rule tells UUCP to dialup
via TCP/IP ;-))
system easix
phone 02131xxx
alternate
phone 02131xxx
alternate
address easix.gun.de
port type tcp
protocol itGg
chat ogin: \L word: \P
If I push the butten again, I'm able to stop internet access via
modem.
internet.c:
- -----------
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
main()
{
uid_t t;
/* check authorization for this suid tool */
if (getuid() == 1000 || getuid() == 0) {
t=setuid(0);
t=seteuid(0);
execl("/home/andreas/bin/internetswitch", NULL, NULL);
}
}
internetswitch:
- ---------------
#! /bin/sh
PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin
if [ -f /var/spool/lock/internet.on ]; then
# we already enabled internet
# we only have to kill ppp -auto ondemand
kill -9 `ps -ax \
| egrep "ppp " \
| egrep -v "egrep" | \
sed 's/^\([ 0-9]*\) .*/\1'/`
# clean activity mark
rm -f /var/spool/lock/internet.on
# say it ;-)
echo "INET: closing connection to internet" > /dev/console
else
# set activity mark
touch /var/spool/lock/internet.on
# fire up PPP to dial on demand
/usr/sbin/ppp -auto ondemand > /dev/null 2>&1
echo "INET: initiating dialup to internet" > /dev/console
CACHED=`ps -ax | egrep cached | egrep -v egrep`
if [ ! "$CACHED" ]; then
/usr/local/harvest/bin/RunCache &
echo "INET: starting cached..." > /dev/console
fi
# start uucp transfer
/sbin/ping -c 5 xypl-02 > /dev/null 2>&1
/usr/libexec/uucp/uucico -r1 -Seasix
echo "INET: calling easix..." > /dev/console
fi
- --
andreas@knobel.gun.de /\/\___ Wiechers & Partner Datentechnik GmbH
Andreas Klemm ___/\/\/ $$ Support Unix - aklemm@wup.de $$
pgp p-key http://www-swiss.ai.mit.edu/~bal/pks-toplev.html >>> powered by <<<
ftp://sunsite.unc.edu/pub/Linux/system/Printing/aps-491.tgz >>> FreeBSD <<<
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMXDY/fMLpmkD/U+FAQEcwgQAif03F+Umn7m4UaA25TzlSaVSdJmzff26
/d+C8cB0vECJKnKoQ/JzrQghPK+tNB2TB27lGIwKUilFcZZZ5VsKscI2QuAs+vXH
CJD5q3rFFmxb4FfstnKlP+vlOGDCCMM6xyllrNgvXqehnYxszAFhCOsNDBhA3Q9Q
5UkBRPngUrA=
=Avbx
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.92.960414124041.226I-100000>
