LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-22-2004, 09:53 AM   #1
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Rep: Reputation: 32
Automating lynx prompt enties - Firewall Authentication


A couple of us on campus use shh tuneling to access our private e-mail accounts on our home machine. Recently, "The Man" installed some firewall software that requires us to authenticate a connection to the 'net. If using Windows or Linux GUI, a standard dialog box pops up, you enter your username and password info click 'OK' and you're good to go.

From command line Linux, if you run something that needs access to the net, no prompt is displayed and the system hangs until a connection time out.

We found a way around this by running lynx and requesting a common sit like www.somesite.com.
Code:
$ lynx www.yahoo.com
lynx launches, requests the site, the firewall says "Hey, you're not authorized" then askes for a username.
Code:
Username for 'FW-1.      Reason: no user      FW-1 ' at server 'XXX.XXX.XXX.XXX':
You enter your user name then...
Code:
Password:
You enter your password and your in.

You now have an authenticated connection to the net to use as you please.

The session expires after X minutes or X minutes of inactivity. (Haven't figured that one out yet.

What we want to do is run a cron job that will automate the above process.
1) Launch lynx and request a site
2) Enter username and password when and if prompted

We're stuck on how to automate the entry of the username and password.

Anyone have any ideas?

Last edited by cmfarley19; 01-22-2004 at 10:02 AM.
 
Old 01-22-2004, 10:32 AM   #2
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
After seaching some related posts, I decided to read the lynx man page.
Code:
$lynx -auth=username:password www.somesite.com
will do the trick.
 
Old 01-22-2004, 12:21 PM   #3
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Or you might consider putting it in a conf file so that anyone who does a ps won't see your password.
 
Old 01-22-2004, 12:31 PM   #4
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
Stickman...
Unfamiliar with the conf file.
Do tell...
 
Old 01-22-2004, 09:52 PM   #5
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
From the man page for lynx:
-cfg=FILENAME specifies a Lynx configuration file other than the default lynx.cfg.

Find the lynx.cfg (probably somewhere in /etc), and use it as a basis for a personal config file.
 
Old 01-23-2004, 08:09 AM   #6
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
Stickman... thanks. Will try.

All...
New question...
I worte two small shell scripts
tunnel_start.sh
Code:
#!/bin/bash

lynx -auth=uname:password www.yahoo.com
and tunnel_stop.sh
Code:
#!/bin/bash

kill `ps aux | grep  lynx |  grep -v grep | awk '{print $2}'`
I've mad the following crontab entries:
Code:
0 7-16 * * 1-5 /home/cfarley/lynx/tunnel_start.sh #> /dev/null 2> /dev/null 
1 7-16 * * 1-5 /home/cfarley/lynx/tunnel_stop.sh #> /dev/null 2> /dev/null
The first script executes and dies immediately. Here is the output:
Code:
  Your Terminal type is unknown!

  Enter a terminal type: [vt100] 
TERMINAL TYPE IS SET TO vt100
(B)0[?7h[?1h=Looking up www.yahoo.com first
Getting http://www.yahoo.com/ 
Looking up www.yahoo.com     
www.yahoo.com           
Making HTTP connection to www.yahoo.com
Sending HTTP request.                  
HTTP request sent; waiting for response.


[?1l>
I would expect that the first script would launch lynx, run for 1 minute, then the second script would kill lynx.

I would also expect lynx to have authenticated the firewall prompt as it does if you execute the command from the command line.

It did not.

Any thoughts?
 
Old 01-23-2004, 03:23 PM   #7
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
You could use -dump or -source so that Lynx exits after it grabs the page the you don't need the second script to kill Lynx.

Last edited by stickman; 01-23-2004 at 03:26 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automating lynx in a shell script yimboli Programming 15 04-04-2007 02:15 AM
Automating Swaret nny0000 Slackware 2 10-13-2005 06:14 PM
Automating Modprobe gauntalus Linux - Wireless Networking 4 01-14-2005 10:57 AM
Automating modprobe? r_jensen11 Linux - Hardware 3 09-07-2003 08:30 PM
Automating the install Tijoux Linux - Software 2 01-20-2002 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration