| Voir le sujet précédent :: Voir le sujet suivant |
armstrong Tricks Hunter
Inscrit le: 30 Aoû 2004 Messages: 3
|
Posté le: Mar Aoû 31, 2004 12:19 am Sujet du message: whois.ph - setting up a response on port 43 |
|
|
|
Hello Matt,
Just signed up.
From the NP thread http://www.namepros.com/showthread.php?goto=lastpost&t=45003 :
| Citation: | | I just acquired whois.ph, which now points to my server. I would like to setup port 43 on my server to respond to any whois queries with a fixed text response, something to the effect that "this is not the official .ph whois server, etc. etc.". Is this possible? |
I tried your solution :
| Citation: | Here's the simplest way to do what you want to do.
edit /etc/inetd.conf file
add this line
whois stream tcp nowait root /root/whois.php
whois.php should look like this
#!/usr/local/bin/php -q
<?php
/*#############################################
whois.php v1.0
Written by Mathieu Landry <matt@utsn.net>
http://www.utsn.net/
This simple code use inetd to output a
string to everyone that connect to the
whois port on a server.
##############################################
*/
$message = "We're sorry but we do not provide whois service on this server\r\nDomain name and whois service are available at http://www.dotsavenue.com/";
print($message);
?>
You need to made whois.php a binary file
chmod +x whois.php
You then need to restart your inetd deamon
ps -aux | grep inetd
kill -HUP <inetd_pid> |
But when I try to query my server, it returns the error "Whois Lookup Error: Whois server refused connection.". Maybe I need to do something else to enable requests via port 43?
Oh, I made one small change to your instructions. The line I entered in inetd.conf was:
whois stream tcp nowait root /home/proph/whois.php
This is so it will be easier for the pro.ph webmaster to maintain whois.php later on. This should not cause a problem, right?
I like the idea of using php, as I do a little php. So I'll stick to this for now.
Thanks for your help!
Apollo aka armstrong |
|
| Revenir en haut de page |
|
|
matt Web Admin

Inscrit le: 06 Avr 2004 Messages: 157 Localisation: Trois-Rivières
|
Posté le: Mar Aoû 31, 2004 11:25 am Sujet du message: |
|
|
|
Hi armstrong,
A couple of things to checkup...
- Did you chmod +x yourfile.php ?
- Did you restart your inetd ?
- Maybe you need to open inbound connection on port 43 on your firewall ?
If It still didn't work, just came back and we're gonna investigate elsewhere.
Cheers,
Matt |
|
| Revenir en haut de page |
|
|
armstrong Tricks Hunter
Inscrit le: 30 Aoû 2004 Messages: 3
|
Posté le: Mar Aoû 31, 2004 11:41 am Sujet du message: |
|
|
|
| matt a écrit: | - Did you chmod +x yourfile.php ?
- Did you restart your inetd ?
- Maybe you need to open inbound connection on port 43 on your firewall ? |
- yes
- yes
- I can query www.utsn.net:43 fine, so I don't think its my PC. Perhaps there's a setting on the server that needs to be changed? I have a RedHat system.
TIA! |
|
| Revenir en haut de page |
|
|
matt Web Admin

Inscrit le: 06 Avr 2004 Messages: 157 Localisation: Trois-Rivières
|
Posté le: Mar Aoû 31, 2004 1:44 pm Sujet du message: |
|
|
|
| armstrong a écrit: | | matt a écrit: | - Did you chmod +x yourfile.php ?
- Did you restart your inetd ?
- Maybe you need to open inbound connection on port 43 on your firewall ? |
- yes
- yes
- I can query www.utsn.net:43 fine, so I don't think its my PC. Perhaps there's a setting on the server that needs to be changed? I have a RedHat system.
TIA! |
Yeah, Thats what I mean your server firewall. It depends on how it has been setup.
Maybe your firewall strategy is to block everything unless it has been openned ?
It's weird. Check that up.
Cheers,
Matt |
|
| Revenir en haut de page |
|
|
matt Web Admin

Inscrit le: 06 Avr 2004 Messages: 157 Localisation: Trois-Rivières
|
Posté le: Mar Aoû 31, 2004 1:45 pm Sujet du message: |
|
|
|
ps -aux | grep inetd
gives you what ? Maybe are you using xinetd ? |
|
| Revenir en haut de page |
|
|
armstrong Tricks Hunter
Inscrit le: 30 Aoû 2004 Messages: 3
|
Posté le: Mar Aoû 31, 2004 9:21 pm Sujet du message: |
|
|
|
Yes, it appears my server is using xinetd:
| Citation: | root@server [/]# ps -aux | grep inetd
root 956 0.0 0.0 2168 648 ? S Mar14 0:15 xinetd -stayalive
root 25355 0.0 0.0 1772 612 pts/1 S 22:11 0:00 grep inetd |
|
|
| Revenir en haut de page |
|
|
matt Web Admin

Inscrit le: 06 Avr 2004 Messages: 157 Localisation: Trois-Rivières
|
Posté le: Mer Sep 01, 2004 12:46 pm Sujet du message: |
|
|
|
| armstrong a écrit: | Yes, it appears my server is using xinetd:
| Citation: | root@server [/]# ps -aux | grep inetd
root 956 0.0 0.0 2168 648 ? S Mar14 0:15 xinetd -stayalive
root 25355 0.0 0.0 1772 612 pts/1 S 22:11 0:00 grep inetd |
|
Right, so we've got the problem.
edit/create /etc/xinetd.d/whois
and put
service whois
{
socket_type = stream
wait = no
user = root
server = /path/to/whois.php
disable = no
}
Don't forget to kill -HUP xinetdpid
so that RedHat refresh his xinetd configuration.
It should work.
Cheers,
Matt |
|
| Revenir en haut de page |
|
|
armstrong Tricks Hunter
Inscrit le: 30 Aoû 2004 Messages: 3
|
Posté le: Mer Sep 01, 2004 9:23 pm Sujet du message: |
|
|
|
Thanks, Matt. At first I couldn't restart xinetd. Searched goodle and found out that i had to:
/etc/rc.d/init.d/xinetd reload
and
/etc/rc.d/init.d/xinetd restart
Now it appears to run, as there are logged entries of attempts to access whois:
| Citation: | root@server [/]# more var/log/whoisphp
04/9/1@22:04:55: START: whois pid=19384 from=127.0.0.1
04/9/1@22:09:37: START: whois pid=19554 from=210.5.117.91 |
The first log entry is when I'm logged in as root, and do # whois -h localhost something.ph
The second is when I run from my PC the whois query # whois -h whois.ph something.ph
However, no data is passed back in answer to the queries. It just runs, logs the attempt, then ends. I shall still try several things, including perhaps changing user to nobody, and changing the location of whois.php. But if you have any more ideas, I'd appreciate it very much.
Apollo |
|
| Revenir en haut de page |
|
|