Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache + Telekom
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
Tadashi
n00b
n00b


Joined: 12 Dec 2003
Posts: 26
Location: Germany

PostPosted: Fri Sep 23, 2005 2:10 pm    Post subject: Apache + Telekom Reply with quote

Hallo erstmal.

Nach längerer Zeit habe ich endlich einen Software-router mit Gentoo zusammegebaut, der auch gut funktioniert.
Hab noch den Apache server installiert und im Netz funktioniert der auch sehr gut. Wenn man allerdings von Aussen direkt auf die IP oder die dynDNS adresse zugreifen will, gibt es nur einen timeout.
Der Anschluss ist T-DSL 1000.

IPTables:
Quote:

router ~ # iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
REJECT tcp -- anywhere anywhere tcp dpt:ftp reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:ssh reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere state NEW tcp dpts:0:10000
REJECT tcp -- anywhere anywhere state NEW tcp dpt:http reject-with icmp-port-unreachable
ACCEPT udp -- anywhere anywhere state NEW udp dpts:0:10000

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Jetzt weiss ich nicht warum man von Aussen nicht zugreifen kann, obwohl der Port 80 frei sein müsste :?
Adresse ist http://newsky.servegame.org

Danke im Vorraus.
Back to top
View user's profile Send private message
tango
Apprentice
Apprentice


Joined: 24 Jan 2005
Posts: 251

PostPosted: Fri Sep 23, 2005 2:29 pm    Post subject: Reply with quote

Funktioniert es komplett ohne Firewall ?

Was passiert wenn direkt die Ip angegeben wird ?

tango
Back to top
View user's profile Send private message
Mr_Maniac
Guru
Guru


Joined: 10 Jun 2004
Posts: 546

PostPosted: Fri Sep 23, 2005 2:34 pm    Post subject: Reply with quote

Quote:
REJECT tcp -- anywhere anywhere state NEW tcp dpt:http reject-with icmp-port-unreachable

kommt mir doch sehr komisch vor...

Mir kommt die GANZE Konfiguration komisch vor...
Denn warum bitte akzeptierst du per default ALLES?
Dir ist schon klar, dass z.B. deine Samba-Ports und RPC-Ports offen sind (sogar in's Internet!)?

Code:
# nmap newsky.servegame.org -v

Starting nmap 3.83.DC13 ( http://www.insecure.org/nmap/ ) at 2005-09-23 16:27 CEST
Initiating SYN Stealth Scan against p54A3CFCA.dip.t-dialin.net (84.163.207.202) [1667 ports] at 16:27
Discovered open port 445/tcp on 84.163.207.202
Increasing send delay for 84.163.207.202 from 0 to 5 due to 344 out of 1145 dropped probes since last increase.
Discovered open port 139/tcp on 84.163.207.202
Discovered open port 111/tcp on 84.163.207.202
The SYN Stealth Scan took 98.06s to scan 1667 total ports.
Host p54A3CFCA.dip.t-dialin.net (84.163.207.202) appears to be up ... good.
Interesting ports on p54A3CFCA.dip.t-dialin.net (84.163.207.202):
(The 1664 ports scanned but not shown below are in state: closed)
PORT    STATE SERVICE
111/tcp open  rpcbind
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds

Nmap finished: 1 IP address (1 host up) scanned in 98.835 seconds
               Raw packets sent: 2627 (105KB) | Rcvd: 1760 (81KB)


Eigentlich sollte man die iptables genau ANDERSRUM konfigurieren.
Also erstmal ALLES verbieten und schließen und dann die Ausnahmen konfigurieren.
GERADE bei der FORWARD-Chain! Oder sehe ich das falsch?
_________________
AMD Ryzen 5900X
64 GB DDR4 RAM
GeForce RTX 3080
Gentoo Linux (most recent stable kernel - amd64)
Windows 11 x64
Back to top
View user's profile Send private message
Tadashi
n00b
n00b


Joined: 12 Dec 2003
Posts: 26
Location: Germany

PostPosted: Fri Sep 23, 2005 2:59 pm    Post subject: Reply with quote

Dann werde ich erstmal an meiner IPTables config pfeilen.
Zu blöd dass mein Vater ein heavy-ebay-user ist und ich eigentlich nur dran arbeiten kann, er definitv mit was anderem beschäftigt ist.
Zudem ist er auch der einzigste im Haus, der noch Windows benutzt.

-e-
So, hab mal das ganze neu gemacht.

Bitte Verbesserungsvorschläge geben, wenn nötig, und vielleicht nochmal mit Nmap drüber gehen:

Code:

router ~ # iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED tcp dpt:http
REJECT     tcp  --  anywhere             anywhere            state NEW reject-with icmp-port-unreachable
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpts:0:10000

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpts:6881:6900
DROP       tcp  --  anywhere             anywhere            multiport dports sunrpc,netbios-ssn,microsoft-ds
REJECT     tcp  --  anywhere             anywhere            state NEW reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Back to top
View user's profile Send private message
tango
Apprentice
Apprentice


Joined: 24 Jan 2005
Posts: 251

PostPosted: Fri Sep 23, 2005 7:07 pm    Post subject: Reply with quote

Der Ansatz ist einfach falsch:

Code:
Chain INPUT (policy ACCEPT)

Chain FORWARD (policy ACCEPT)

Chain OUTPUT (policy ACCEPT)


Stelle das auf DROP und akzeptiere dann alles benötigte...

tango
Back to top
View user's profile Send private message
Mr_Maniac
Guru
Guru


Joined: 10 Jun 2004
Posts: 546

PostPosted: Sun Sep 25, 2005 12:35 pm    Post subject: Reply with quote

Mal eine ganz dumme Frage meinerseits:
Warum gibt es eigentlich keine REJECT oder DENY Policy?
DROP sorgt ja evtl. nur für lange Wartezeiten.
Ich hätte es eigentlich ganz gerne, dass alles, was nicht durchgelassen wird rejected wird anstatt einfach nur fallengelassen...
_________________
AMD Ryzen 5900X
64 GB DDR4 RAM
GeForce RTX 3080
Gentoo Linux (most recent stable kernel - amd64)
Windows 11 x64
Back to top
View user's profile Send private message
Tadashi
n00b
n00b


Joined: 12 Dec 2003
Posts: 26
Location: Germany

PostPosted: Mon Sep 26, 2005 9:11 am    Post subject: Reply with quote

Mr_Maniac wrote:
Mal eine ganz dumme Frage meinerseits:
Warum gibt es eigentlich keine REJECT oder DENY Policy?
DROP sorgt ja evtl. nur für lange Wartezeiten.
Ich hätte es eigentlich ganz gerne, dass alles, was nicht durchgelassen wird rejected wird anstatt einfach nur fallengelassen...


Vielleicht wegen der DoS Gefahr?
Reject heisst ja auf die Anfrage antworten. Bei einem Drop fällt das weg.


Zu meinem Problem, ich bräuchte nur noch zu weissen welche Ports ich jetzt explizit freigeben kann.
Portlisten zählen die Ports leider meist nur sehr nüchtern auf.
Back to top
View user's profile Send private message
dakjo
Veteran
Veteran


Joined: 31 Jan 2004
Posts: 1544

PostPosted: Mon Sep 26, 2005 9:18 am    Post subject: Reply with quote

Schaust du in /etc/services, ausserdem solltest du evtl. mal hier lesen http://www.gentoo.org/doc/en/home-router-howto.xml
_________________
'Dieselben Naturkräfte, die uns ermöglichen, zu den Sternen zu fliegen, versetzen uns auch in die Lage, unseren Stern zu vernichten.' - Wernher von Braun
http://www.mpsna.de
Back to top
View user's profile Send private message
Tadashi
n00b
n00b


Joined: 12 Dec 2003
Posts: 26
Location: Germany

PostPosted: Sun Oct 02, 2005 5:25 pm    Post subject: Reply with quote

So, habe jetzt einen Config, die recht sicher zu sein scheint und die hoffentlich auch HTTP-Verbindungen zum Server zulässt. Zum. funktioniert der HTML Check von W3.org

Wäre nett, wenn ihr sie mal prüfen könntet.

Code:

router ~ # iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
REJECT     udp  --  anywhere             anywhere            udp dpt:bootps reject-with icmp-port-unreachable
REJECT     udp  --  anywhere             anywhere            udp dpt:domain reject-with icmp-port-unreachable
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     udp  --  anywhere             anywhere            udp dpt:http
DROP       tcp  --  anywhere             anywhere            tcp dpts:0:1023
DROP       udp  --  anywhere             anywhere            udp dpts:0:1023

Chain FORWARD (policy DROP)
target     prot opt source               destination
DROP       all  --  anywhere             192.168.0.0/16
ACCEPT     all  --  192.168.0.0/16       anywhere
ACCEPT     all  --  anywhere             192.168.0.0/16

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Sun Oct 02, 2005 6:57 pm    Post subject: Reply with quote

Irgendwie ne schwere Geburt bei dir ...

Quote:
Chain INPUT (policy ACCEPT)


Gerade diese solltest du auf DROP setzen und dann nur die Ports erlauben die wirklich sein müssen!
Dann kannst du dir auch die Reject und Drop zeilen sparen.

Allerdings musst du dann noch statefull firewalling an machen (auch in der Forward Regel):

Code:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -i $INET       # aktive verbindungen erlauben


Quote:
Chain FORWARD (policy DROP)
target prot opt source destination
DROP all -- anywhere 192.168.0.0/16
ACCEPT all -- 192.168.0.0/16 anywhere
ACCEPT all -- anywhere 192.168.0.0/16


Die 3. Regel kommt nie zum Einsatz weil die erste Regel genau das verbietet was die 3. erlaubt. Es sei denn es wurden noch andere Optionen eingestellt die hier nicht zum Ausdruck kommen.

Nimm lieber die Ausgabe von iptables -L -v
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
Tadashi
n00b
n00b


Joined: 12 Dec 2003
Posts: 26
Location: Germany

PostPosted: Sun Oct 02, 2005 10:19 pm    Post subject: Reply with quote

Danke, habe jetzt alles auf drop gesetzt.
Leider musste ich manchmal den Rechner neu starten, weil ich mich selber ausgesperrt habe und habe vergessen die Verbindung neu zu starten. Hat mir einige Male Kopfzerbrechen bereitet -.-

Der HTTP-Server funktioniert ja nun hoffentlich auch, wenn der HTML-Validator der W3 drauf zugreifen kann.

Nun hoffentlich der letzte Auszug:
Code:

router ~ # iptables -L -v
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere
   12   816 ACCEPT     all  --  eth1   any     anywhere             anywhere
    0     0 ACCEPT     tcp  --  ppp0   any     anywhere             anywhere            tcp dpt:http
    0     0 ACCEPT     udp  --  ppp0   any     anywhere             anywhere            udp dpt:http
    0     0 ACCEPT     all  --  ppp0   any     anywhere             anywhere            state RELATED,ESTABLISHED

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
   27 23426 ACCEPT     all  --  eth1   any     192.168.0.0/16       anywhere
   19  5767 ACCEPT     all  --  ppp0   any     anywhere             192.168.0.0/16

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  any    lo      anywhere             anywhere
    8   656 ACCEPT     all  --  any    eth1    anywhere             anywhere
    0     0 ACCEPT     tcp  --  any    ppp0    anywhere             anywhere            tcp dpt:http
    0     0 ACCEPT     udp  --  any    ppp0    anywhere             anywhere            udp dpt:http
    0     0 ACCEPT     all  --  any    ppp0    anywhere             anywhere            state NEW,RELATED,ESTABLISHED


Nochmals Danke :)

-e-
Die überflüssige SSH Regel rausgeschmissen.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum