I'm a geek

Place to discuss anything, almost. No politics, religion, Microsoft, or anything else that I (the nazi censor) deem inappropriate.
phil
user
user
Posts: 5
Joined: Fri May 14, 2004 10:16 am

Post by phil » Fri May 14, 2004 10:44 am

Thanks for your answer.

Okay, i'll better wait, till you're back in the evening.
I don't want to crunch my box.
So please tell me which one you used, later. :)

Cheers, phil

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri May 14, 2004 11:02 am

Actually, now that I think about it, and after looking at the busybox source (specifically httpd.c) on the b4 source on my hard drive here I believe I am just using the httpd that comes with OpenWRT. Just add a "cgi-bin" directory to your web root (probably currently at /www). Create a file with a cgi extension (probably doesn't even have to have a cgi extension) and it probably has to be set executable (chmod +x file.cgi). I think you can do basic shell commands in a CGI file by putting them in this format:

$(ls -alp)

I could put the source for my CGI script up here when I get home.

phil
user
user
Posts: 5
Joined: Fri May 14, 2004 10:16 am

hmm ..

Post by phil » Fri May 14, 2004 12:42 pm

I discovered a bug which i had some times before..

The time before it was with the README-File of the httpd. It was in /www and I pointed my webbrowser to http://ipofmywrtg/README and got a 404. But this file definateivly existed!
The same situation now.. Look what it did:

Code: Select all

root@ap:/www# mkdir cgi-bin
root@ap:/www# cd cgi-bin/
root@ap:/www/cgi-bin# echo "ps -x" > foobar.cgi
root@ap:/www/cgi-bin# chmod +x foobar.cgi
When i try to open http://ipofmywrtg/cgi-bin/foobar.cgi, i get a 404. :(


Anyway, i hope i don't need cgi anymore.
I'm working with asp, now.
This works fine, till one point.. ;)
I'm using ASP, to get basical system infos. Getting the uptime etc. is a easy thing, because the output contains only one line.
But when I try to catch the output of "ifconfig", there's a problem. The output seems to be to big, so that i can't get the whole output. :(
It only grabs the half part of the output or so.
Do you have an idea what I can do, to get the *whole* output?

And yet another question ;)
How did you disable this htaccess-like password/username authentication?

Cheers

Tux
guru
guru
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Post by Tux » Fri May 14, 2004 3:39 pm

I'd bet good money that you wont get ASP tips around here :D

phil
user
user
Posts: 5
Joined: Fri May 14, 2004 10:16 am

Post by phil » Fri May 14, 2004 4:02 pm

Well, a cgi-solution would also be great.. ;)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri May 14, 2004 4:35 pm

Here's my stats.cgi script:
http://voidmain.is-a-geek.net/files/scripts/stats.txt

Notice the first 2 lines and the last line. It's just a shell script that uses the "cat" command with a label at the end to know where to stop sending text. Because of this you can add in commands using the shell variable syntax $(command param). Cheap way to do dynamic scripting. :)

Oh, and yes, I am using the httpd that comes with OpenWRT. I was going to stick that ASP version on there but got too busy playing with other things.

phil
user
user
Posts: 5
Joined: Fri May 14, 2004 10:16 am

Post by phil » Fri May 14, 2004 4:49 pm

Okay. Now I got everything up and running.

Thank you very much, guys.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Jun 16, 2004 6:11 pm

Sam over at the OpenWRT forums was nice enough to get a web server running with PHP support. I added it to my wireless web server so it is now running two different web servers on two different ports serving content from two different locations. Here's the new PHP based server:

http://voidmain.is-a-geek.net:82/

I have some "view source" links at the bottom of the page. Yep, it's pretty much the same as regular Void Main site.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jun 29, 2004 12:07 am

I created some net-snmp packages (ipkgs) for the WRT54G running OpenWRT. Cacti/rrdtool/MRTG graphing is now possible:
http://voidmain.is-a-geek.net/cacti/gra ... &leaf_id=9

The packages:
http://voidmain.is-a-geek.net/files/ipkg/

Thread at OpenWRT forums where it all came about:
http://openwrt.ksilebo.net/forum/viewtopic.php?t=163

dpcritchley
n00b
n00b
Posts: 4
Joined: Thu Jul 22, 2004 8:40 am

Post by dpcritchley » Thu Jul 22, 2004 8:49 am

Void Main wrote:And now I have plenty of disk space after NFS mounting a remote share:

http://voidmain.is-a-geek.net:81/cgi-bin/stats.cgi
Hello, after reading about how you turned your WRT54G into a webserver, I thought I just have to try it.
So I downloaded the OS, compiled it, installed it, added the nfs-modules, went to Sams site and installed lwhp, and interface-wrt.
I moved the interface over to port 81, and then started a second instance of httpd to be the webserver on port 80.
All worked great.

Now the part I am stuck on is getting the NFS to work. I have a RH 7.3 box that I configured an NFS directory on, tested by connecting my Suse box to it and all appeared to work fine, I could read files, etc.
But on the WRT54G, I cannot mount the NFS, is there some kernel adjusments or some daemon that needs to be started on the WRT54G to get it to mount to the NFS partition? Right now it errors out with device not available.

thanks in advance for any help on this.

Darren

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jul 22, 2004 10:21 am

There wasn't anything special that I had to do. I just added a few "insmod"s to the startup script to load the modules and then just mounted it like I do on any other NFS mount (mount myservernameorip:/nfsshare /mntdirectory), also added to the startup script. To be absolutely sure about that I will copy the commands out of my script when I get home for you. If this doesn't work I would assume that something on the server side is causing a problem. You might want to run "ethereal" on the server when you try to make the connection to see if the WRT is actually trying to communicate with it when you do the mount. You might also check the logs. You do have all the necessary services started on the server right (portmap, nfsd, mountd, etc)?

dpcritchley
n00b
n00b
Posts: 4
Joined: Thu Jul 22, 2004 8:40 am

Post by dpcritchley » Thu Jul 22, 2004 10:45 am

NFSD is running, Portmap is running, as for mountd, I see an rpc.mountd - would this be the correct mountd?

the lfs-modules came with three modules ending in .o, are those the ones that need to be insmod'd ?

I tried an insmod on the nfs modules last night and it failed, but I just noticed that there are two versions of it and I may have d/l'd the wrong one. I will double check that tonight as last night it was close to midnight and mistakes are easily made at that time of night :)

I look forward to see your init script.

Thanks
Darren

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jul 22, 2004 12:33 pm

If you can't insert the modules successfully then you surely are not going to be able to mount the NFS share. This is surely where the problem is. You might have to get the other modules, or compile your own from the same source that you already built your firmware from.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jul 22, 2004 5:51 pm

Here's toward the end of my /etc/rcS script:

Code: Select all

insmod sunrpc
insmod lockd
insmod nfs
mount nitro:/wrt54g /nfs -o nolock
I make sure it is before anything I want to run from the NFS share. Before I would add it to the rcS script I would make sure that you could successfully perform each line on the command line.

dpcritchley
n00b
n00b
Posts: 4
Joined: Thu Jul 22, 2004 8:40 am

Post by dpcritchley » Thu Jul 22, 2004 11:44 pm

Those little insmod commands did the trick!

I am now running a webserver from my WRT54G. :D

Now I can dump my full fledged one, I don't do anything fancy with my webserver anyways.

Now to see how much php3 functionality is in Sam's code.

Thanks for your help.

Darren

Post Reply