Un jour, en cherchant je ne sais plus quoi dans le net, je suis tombé sur un "client quote-of-the-day" pour ouine95. Intrigué, j'ai testé le machin et j'ai cherché à en savoir davantage. J'ai vite découvert qu'il n'y avait pas le serveur ad-hoc dans mon Linux, et que le protocole était très simple. Une action immédiate s'imposait.
Network Working Group J. Postel
Request for Comments: 865 ISI
May 1983
Quote of the Day Protocol
This RFC specifies a standard for the ARPA Internet community. Hosts on
the ARPA Internet that choose to implement a Quote of the Day Protocol
are expected to adopt and implement this standard.
A useful debugging and measurement tool is a quote of the day service.
A quote of the day service simply sends a short message without regard
to the input.
TCP Based Character Generator Service
One quote of the day service is defined as a connection based
application on TCP. A server listens for TCP connections on TCP port
17. Once a connection is established a short message is sent out the
connection (and any data received is thrown away). The service
closes the connection after sending the quote.
UDP Based Character Generator Service
Another quote of the day service is defined as a datagram based
application on UDP. A server listens for UDP datagrams on UDP port
17. When a datagram is received, an answering datagram is sent
containing a quote (the data in the received datagram is ignored).
Quote Syntax
There is no specific syntax for the quote. It is recommended that it
be limited to the ASCII printing characters, space, carriage return,
and line feed. The quote may be just one or up to several lines, but
it should be less than 512 characters.
|
Voila comment j'ai mis la chose en service dans mon Linux. Pour fabriquer ce
"short message" requis par le protocole, je vais utiliser un grand
classique fortune, il suffit juste de l'emballer un peu.
Première étape: dégainez votre vi et créez ce fichier (qui
s'appelera /usr/local/bin/qotd, appartient à l'utilisateur nobody
et est executable):
#!/bin/sh /usr/bin/fortune -a -n 500
Les options utilisées assurent que la doctorale sentence ne dépassera pas 500 caractères comme requis par le RFC.
Deuxième étape: le lancement du programme. Nous voici quasiment dans un cas
d'école pour l'utilisation du démon inetd. Rajoutons donc cette
ligne dans le fichier /etc/inetd.conf:
qotd stream tcp nowait nobody /usr/local/bin/qotd QOTD
Ensuite, il faut demander à inetd de rafraichir sa configuration.
La commande kill -HUP `cat /ou/se/trouve/donc/inetd.pid`
fera très bien l'affaire.
Troisième étape: Comment utiliser ce nouveau service tout neuf?
On peut simplement faire telnet nom.de.ma.machine 17,
et, ô joie sublime, nous nous faisons apostropher par notre nouvelle
création:
titi@leon /etc $ telnet leon 17 Trying 192.168.31.31... Connected to leon. Escape character is '^]'. Wharbat darbid yarbou sarbay? Connection closed by foreign host. titi@leon /etc $
Ya pas à dire, l'informatique moderne du siècle dernier, ça décoiffait déja pas mal.