inetd für nur ein interface

chaos

*nix'ler
Hallo,

ich hab einen Serverdienst (einen kleinen Newsserver/leafnode) über inetd laufen.
Jetzt fände ich es aber toll, wenn inetd nur auf Anfragen über das loopback-device hört und nicht auf Anfragen über die Netzwerkkarte.

inetd selbst scheint man nicht passend konfigurieren zu können?

Meine nächste Idee war über /etc/hosts.allow zu gehen
Folgende Zeilen habe ich in /etc/hosts.allow
Code:
ALL : localhost 127.0.0.1 [::1] : allow
nntp : 192.168.1.0/255.255.255.0 : deny
ALL : ALL : allow
Außerdem die entsprechende Zeile in /etc/inetd.conf:
Code:
nntp    stream  tcp     nowait  news    /usr/libexec/tcpd /usr/local/sbin/leafnode

Nahc einem restart von inetd ergibt ein nmap noch immer:
Code:
thomas@chaos ~ % nmap 192.168.1.42

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2005-04-06 18:49 CEST
Interesting ports on chaos (192.168.1.42):
(The 1660 ports scanned but not shown below are in state: closed)
PORT     STATE SERVICE
22/tcp   open  ssh
119/tcp  open  nntp

Oder sind andere Klimmzüge notwendig, daß eine geänderte hosts.allow eingelesen wird?

Und gibt es eine Möglichkeit meinen Wunsch, daß inetd nur auf einem Interface lauscht, zu verwircklichen?

Danke schon mal
chaos
 
Lösung:
Es funktioniert:
inetd baut zwar die Verbindung auf, tcpd schließt sie aber gleich wieder:
Code:
 thomas@chaos ~ % nmap 192.168.1.42      

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2005-04-06 20:03 CEST
Interesting ports on chaos (192.168.1.42):
(The 1660 ports scanned but not shown below are in state: closed)
PORT     STATE SERVICE
22/tcp   open  ssh
119/tcp  open  nntp
6000/tcp open  X11

Nmap finished: 1 IP address (1 host up) scanned in 21.945 seconds
Mi 06.04.2005  20:04  (ttyp3)
 thomas@chaos ~ % telnet 192.168.1.42 119
Trying 192.168.1.42...
Connected to chaos.
Escape character is '^]'.
Connection closed by foreign host.
 
Du kommst besser und sicherer, wenn Du in die inetd.conf dieses reinschreibst:

< 127.0.0.1:nntp stream tcp nowait _news /usr/local/sbin/leafnode leafnode >


Gruss :cool:
 
Arjan schrieb:
Du kommst besser und sicherer, wenn Du in die inetd.conf dieses reinschreibst:

< 127.0.0.1:nntp stream tcp nowait _news /usr/local/sbin/leafnode leafnode >


Gruss :cool:
zu früh gefreut:
Das geht hier nicht.
inetd meldet:
Apr 6 20:35:15 chaos inetd[14248]: 127.0.0.1:nntp/tcp: unknown service
 
Du solltest vielleicht erstmal die manpages lesen ...
SYNOPSIS
inetd [-d] [-l] [-w] [-W] [-c maximum] [-C rate] [-a address | hostname]
[-p filename] [-R rate] [-s maximum] [configuration file]

du willst also inetd_flags="-a localhost" in /etc/rc.conf

Die Syntax mit
127.0.0.1:nntp stream tcp nowait _news /usr/local/sbin/leafnode leafnode
steht so auch nirgends in der manpage zu inetd.conf. Da aber ein User namens "_news" angegeben wurde, tippe ich hier mal auf OpenBSD, da mag sowas gehen.

Deine Hosts.allow ist auch halb-falsch, du solltest eher sowas einsetzen
ALL : localhost 127.0.0.1 [::1] : allow
nntp : ALL : deny
ALL : ALL : allow
 
Die Syntax mit
127.0.0.1:nntp stream tcp nowait _news /usr/local/sbin/leafnode leafnode
steht so auch nirgends in der manpage zu inetd.conf. Da aber ein User namens "_news" angegeben wurde, tippe ich hier mal auf OpenBSD, da mag sowas gehen.
Ich weiß, trotzdem wurde sie als Tipp gegeben.
 
MrFixit schrieb:
Die Syntax mit
127.0.0.1:nntp stream tcp nowait _news /usr/local/sbin/leafnode leafnode
steht so auch nirgends in der manpage zu inetd.conf. Da aber ein User namens "_news" angegeben wurde, tippe ich hier mal auf OpenBSD, da mag sowas gehen.

Congratulations! In der OBSD-Manpage steht es auch so drin und funktioniert. Es funktioniert auch auf vielen anderen Systemen(war schon Diskussion im Usenet darüber) - find ich jetzt merkwürdig, dass es ausgerechnet bei FBSD nicht gehen soll.

Ich habe natürlich vorausgesetzt, dass der OP den NNTP-User anpasst ;)

Vielleicht testet der OP es nochmal? ;)


Gruss :cool:
 
Nein es funktioniert nicht.
Aus meiner /etc/inetd.conf:
Code:
 thomas@chaos ~ % grep nntp /etc/inetd.conf
# example entry for the optional nntp server
nntp    stream  tcp     nowait  news    /usr/libexec/tcpd /usr/local/sbin/leafnode      
#127.0.0.1:nntp stream  tcp     nowait  news    /usr/libexec/tcpd /usr/local/sbin/leafnode      
#nntp   stream  tcp     nowait  news    /usr/local/libexec/nntpd        nntpd
 
Zurück
Oben