Re: ip-up for each user?

1999-04-06 Thread Robbie Huffman
On Mon, Apr 05, 1999 at 02:14:37PM -0500, John Hasler wrote:
 I'm assuming that you have multiple users dialing into a single provider
 account.  Change 'pon' from
 
   /usr/sbin/pppd call ${1:-provider}
 
 to 
 
   /usr/sbin/pppd call ${1:-provider} ipparam $USER
 
 and have the behavior of the scripts in /etc/ppp/ip-up.d depend on the
 value of $6 .

Ahhh...that's something I was missing. The manpage explains it nicely.
Thanks for bringing it to my attention!

Robbie


Re: ip-up for each user?

1999-04-06 Thread Robbie Huffman
On Mon, Apr 05, 1999 at 10:19:13PM +0100, Oliver Elphick wrote:
 This is in /etc/diald/ip-up:
 ===
 #!/bin/sh
 
 # Set the time and date
 ntpdate  -s -t 5 ntp2c.mcc.ac.uk ntp4.strath.ac.uk 
 
 # Get mail
 fetchmail  mail.enterprise.net
 
 # Run the mail queue
 runq
 ===
 
 I presume you could do the same in /etc/ppp/ip-up/something.
 
 fetchmail won't allow 2 copies of itself to run, so you don't need to
 worry about that.

So how does fetchmail know who to run as? I'm supposing as the user who
called pppd, right? If that's the case, then my problem can be solved
simply. Otherwise more hacking will be necessary.

Thanks,
Robbie


Re: ip-up for each user?

1999-04-06 Thread John Hasler
Robbie Huffman writes:
 So how does fetchmail know who to run as? I'm supposing as the user who
 called pppd, right?

It will run as root, because that is what pppd runs as.

 Otherwise more hacking will be necessary.

The conventional thing to do is to have root's .forward push the incoming
mail through procmail or mailagent.  I do it slightly differently.  I have
a user named 'postman' that exists just to receive mail.  In ip-up.d I have

su -c fetchmail -v  postman

which runs fetchmail as postman.  postman's .forward pushes the mail
through mailagent, using rules that are conveniently located in postman's
home directory, which is named 'postoffice'.   This nicely centralizes all
the incoming mail stuff without cluttering root's home, and reduces the
number of daemons running as root.
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


Re: ip-up for each user?

1999-04-06 Thread Brian Servis
*- On  5 Apr, John Hasler wrote about Re: ip-up for each user?
 Robbie Huffman writes:
 So how does fetchmail know who to run as? I'm supposing as the user who
 called pppd, right?
 
 It will run as root, because that is what pppd runs as.
 
 Otherwise more hacking will be necessary.
 
 The conventional thing to do is to have root's .forward push the incoming
 mail through procmail or mailagent.  I do it slightly differently.  I have
 a user named 'postman' that exists just to receive mail.  In ip-up.d I have
 
 su -c fetchmail -v  postman
 
 which runs fetchmail as postman.  postman's .forward pushes the mail
 through mailagent, using rules that are conveniently located in postman's
 home directory, which is named 'postoffice'.   This nicely centralizes all
 the incoming mail stuff without cluttering root's home, and reduces the
 number of daemons running as root.

I missed the first post by Robbie but wouldn't it just be easier to use
a fetchmailrc that explicitly defines the relation of isp usernames to
local user names?  I have fetchmail start when ppp comes up with the
following script which is provided in the /usr/doc/fetchmail package.

#!/bin/sh
#/etc/ppp/ip-up.d/fetchmail-up

test -r /etc/fetchmailrc  \
fetchmail --syslog --invisible --fetchmailrc /etc/fetchmailrc


and my /etc/fetchmailrc is modified

set daemon 120
poll popserver.isp1 with timeout 60:
user isp1-username there has password isp1-passwd is local-name 
here
fetchall

poll popserer.isp2 with protocol pop3 timeout 60:
user ips2-username there has password isp2-passwd is local-name 
here
fetchall

postconnect exim -q


This is all run by root and fetchmail passes it directly to exim via
smtp and it is immediatly dropped in my mailbox by exim. No middle man
involved.

-- 
Brian 
-
Never criticize anybody until you have walked a mile in their shoes,  
 because by that time you will be a mile away and have their shoes. 
   - unknown  

Mechanical Engineering[EMAIL PROTECTED]
Purdue University   http://www.ecn.purdue.edu/~servis
-


Re: ip-up for each user?

1999-04-06 Thread John Hasler
 I missed the first post by Robbie but wouldn't it just be easier to use a
 fetchmailrc that explicitly defines the relation of isp usernames to
 local user names?

Maybe if you have more than one isp username.  My ISP won't let me have
more than one, and all my mail is relayed anyway.  Besides, by pushing
everything through one set of mailagent rules I can filter spam, post
mailing lists to local newsgroups, etc all in one place.
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


Re: ip-up for each user?

1999-04-06 Thread Bob Nielsen
Try this in your script:

su -c fetchmail username

This will run fetchmail using the .fetchmailrc in /home/username.  You
could do this multiple times for different users.

Bob

On Mon, 5 Apr 1999, Robbie Huffman wrote:

 On Mon, Apr 05, 1999 at 08:58:22AM +0100, Oliver Elphick wrote:
  It sounds as if you should use diald to bring the link up automatically
  whenever a program attempts to connect to an external site.  My own
  arrangement is for fetchmail to run whenever the link comes up, and for
  cron to do a single ping from time to time to ensure that the link does
  come up and collect mail, even if no-one is using it otherwise.
 
 What I'm looking for is your arrangement which allows for fetchmail to
 run when PPP is started. I'm guessing you just played with the systemwide
 ip-up script?
 
 Thanks,
 Robbie
 
 
 -- 
 Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED]  /dev/null
 
 


Bob Nielsen Internet: [EMAIL PROTECTED]
Tucson, AZ  AMPRnet:  [EMAIL PROTECTED]
DM42nh  http://www.primenet.com/~nielsen


ip-up for each user?

1999-04-05 Thread Robbie Huffman

I'm currently looking for a way to have a per-user version of ip-up.
For example, I'd like to start fetchmail if it isn't running already
and execute a few pilot programs. But this sort of thing doesn't seem
to belong in the systemwide ip-up file. I know I can hack together something
which would allow for this, but I wanted to see if there was a standard
way to do it which I just can't find. So, that's my question. FAQ or hack?

Thanks,
Robbie
[EMAIL PROTECTED]


Re: ip-up for each user?

1999-04-05 Thread Oliver Elphick
Robbie Huffman wrote:
  
  I'm currently looking for a way to have a per-user version of ip-up.
  For example, I'd like to start fetchmail if it isn't running already
  and execute a few pilot programs. But this sort of thing doesn't seem
  to belong in the systemwide ip-up file. I know I can hack together something
  which would allow for this, but I wanted to see if there was a standard
  way to do it which I just can't find. So, that's my question. FAQ or hack?
 
It sounds as if you should use diald to bring the link up automatically
whenever a program attempts to connect to an external site.  My own
arrangement is for fetchmail to run whenever the link comes up, and for
cron to do a single ping from time to time to ensure that the link does
come up and collect mail, even if no-one is using it otherwise.

-- 
Oliver Elphick[EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
   PGP key from public servers; key ID 32B8FAA1
 
 My dear brothers, take note of this: Everyone should  
  be quick to listen, slow to speak and slow to become  
  angry, for man's anger does not bring about the   
  righteous life that God desires.  James 1:19,20  



Re: ip-up for each user?

1999-04-05 Thread Robbie Huffman
On Mon, Apr 05, 1999 at 08:58:22AM +0100, Oliver Elphick wrote:
 It sounds as if you should use diald to bring the link up automatically
 whenever a program attempts to connect to an external site.  My own
 arrangement is for fetchmail to run whenever the link comes up, and for
 cron to do a single ping from time to time to ensure that the link does
 come up and collect mail, even if no-one is using it otherwise.

What I'm looking for is your arrangement which allows for fetchmail to
run when PPP is started. I'm guessing you just played with the systemwide
ip-up script?

Thanks,
Robbie


Re: ip-up for each user?

1999-04-05 Thread John Hasler
Robbie Huffman writes:
 I'm currently looking for a way to have a per-user version of ip-up.

I'm assuming that you have multiple users dialing into a single provider
account.  Change 'pon' from

/usr/sbin/pppd call ${1:-provider}

to 

/usr/sbin/pppd call ${1:-provider} ipparam $USER

and have the behavior of the scripts in /etc/ppp/ip-up.d depend on the
value of $6 .

 I'd like to start fetchmail if it isn't running already...

It won't start if it is running already.  In any case, how could it be
running already?  Do you have multiple modems?
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


Re: ip-up for each user?

1999-04-05 Thread Oliver Elphick
Robbie Huffman wrote:
  On Mon, Apr 05, 1999 at 08:58:22AM +0100, Oliver Elphick wrote:
   It sounds as if you should use diald to bring the link up automatically
   whenever a program attempts to connect to an external site.  My own
   arrangement is for fetchmail to run whenever the link comes up, and for
   cron to do a single ping from time to time to ensure that the link does
   come up and collect mail, even if no-one is using it otherwise.
  
  What I'm looking for is your arrangement which allows for fetchmail to
  run when PPP is started. I'm guessing you just played with the systemwide
  ip-up script?
 
This is in /etc/diald/ip-up:
===
#!/bin/sh

# Set the time and date
ntpdate  -s -t 5 ntp2c.mcc.ac.uk ntp4.strath.ac.uk 

# Get mail
fetchmail  mail.enterprise.net

# Run the mail queue
runq
===

I presume you could do the same in /etc/ppp/ip-up/something.

fetchmail won't allow 2 copies of itself to run, so you don't need to
worry about that.


-- 
Oliver Elphick[EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
   PGP key from public servers; key ID 32B8FAA1
 
 My dear brothers, take note of this: Everyone should  
  be quick to listen, slow to speak and slow to become  
  angry, for man's anger does not bring about the   
  righteous life that God desires.  James 1:19,20  



Re: ip-up for each user?

1999-04-05 Thread John Hasler
Robbie writes:
 What I'm looking for is your arrangement which allows for fetchmail to
 run when PPP is started. I'm guessing you just played with the systemwide
 ip-up script?

Just put the appropriate fetchmail command in a file in /etc/ppp/ip-up.d,
put #!/bin/sh at the top, and make it executable.
-- 
John HaslerThis posting is in the public domain.
[EMAIL PROTECTED]  Do with it what you will.
Dancing Horse Hill Make money from it if you can; I don't mind.
Elmwood, Wisconsin Do not send email advertisements to this address.


Re: ip-up for each user?

1999-04-05 Thread John Hasler
Oliver Elphick writes:
 I presume you could do the same in /etc/ppp/ip-up/something.

Make that /etc/ppp/ip-up.d/something.
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI