Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I ran a web scan from Derkeiler.com and it came up with these results on my firewall:
Starting nmap 3.77 ( http://www.insecure.org/nmap/ ) at 2006-03-31 20:24 CEST
Initiating Connect() Scan against xx-xxx-xx-xx.ashbva.mindyourbizz.net (xx.xxx.xx.xx) [1663 ports] at 20:24
Discovered open port 443/tcp on xx.xxx.xx.xx
Discovered open port 23/tcp on xx.xxx.xx.xx
Discovered open port 513/tcp on xx.xxx.xx.xx
The Connect() Scan took 18.82s to scan 1663 total ports.
Host xx-xxx-xx-xx.ashbva.mindyourbizz.net (xx.xxx.xx.xx) appears to be up ... good.
Interesting ports on xx-xxx-xx-xx.ashbva.mindyourbizz.net (xx.xxx.xx.xx):
(The 1651 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
23/tcp open telnet
80/tcp filtered http
113/tcp filtered auth
135/tcp filtered msrpc
136/tcp filtered profile
137/tcp filtered netbios-ns
138/tcp filtered netbios-dgm
139/tcp filtered netbios-ssn
443/tcp open https
445/tcp filtered microsoft-ds
513/tcp open login
27374/tcp filtered subseven
Nmap run completed -- 1 IP address (1 host up) scanned in 19.293 seconds
On my firewall I ran netstat -pantu,ps -aux, and nmap and found nothing listen on those ports or anything suspicious. I ran the latest chkrootkit and found nothing.I check my firewall rules and there is nothing referencing any of those ports to allow them to be open. I am confused. How reliable are these web based port scanning sites. I am using SSH on that port but only internal. port 23 for telnet, I dont have the telnet service on any of my boxes, I use ssh.? Help!
Last edited by metallica1973; 04-05-2006 at 12:52 PM.
make sure that before you post you run the test again after you do your adjustments cuz if not it would defeat the purpose of posting...
BTW, i tried the grc.com scan thing and it worked fine for me... i could see the scan happening in my /var/log/syslog using "tail -f" with no problems... my result was:
Quote:
Your system has achieved a perfect "TruStealth" rating. Not a single packet — solicited or otherwise — was received from your system as a result of our security probing tests. Your system ignored and refused to reply to repeated Pings (ICMP Echo Requests). From the standpoint of the passing probes of any hacker, this machine does not exist on the Internet. Some questionable personal security systems expose their users by attempting to "counter-probe the prober", thus revealing themselves. But your system wisely remained silent in every way. Very nice.
I will certainly do that. It must be something in my firewall. Let me ask you this:
If I have lets say sshd running on a machine behind my firewall, how can I allow only my internal machines to connect to that sshd dameon and if my firewall is set to filter related or established connection comming in but allow most connections going out could it be something in the sshd_config file that is allowing connection from outside the firewall in and I guess maybe that would be the same for telnet? What programs other than telnet would use port 23?
I found out what had opened ports. It is my VOIP modem/router that is causing issues. But how can my voip router/modem do that? I can telnet to it thus port 23 open. The VOIP/Router is set to gateway mode, should I change it to bridge mode thus giving my firewall full control?
Last edited by metallica1973; 04-01-2006 at 11:21 AM.
TruStealth: PASSED - ALL tested ports were STEALTH,
- NO unsolicited packets were received,
- NO Ping reply (ICMP Echo) was received.
This was a lesson well learned.
Know everything about you equipment and test test test (stressing security) until your fingers drop off. I had a VOIP modem/Router that had several services on and I believe because it was used in GATEWAY mode is why my firewall was not blocking these services and ports(I am still a little confused about that) including ICMP requests, telnet and mirroring some of my services (SSHD). But one questions still remains, how could this VOIP Modem/Router(my IPtables blocking ssh externally) still have allow external people to connect to my system. I block every dog gone thing and still the web test failed me. ?
I am going to post it very shorty. I am making some minor adjustments. I disconnected my VOIP modem/router and connected my firewall to the cable modem directly and passed with flying colors,my firewall was doing what it is designed to do. Everything was blocked but the minute I connected back my VOIP modem/router then the services were allowed through. I very confused. I will post shortly.
Here is my network
VOIP Modem (They are two different models. This one has telnet and http access thus port 23 and 80 open)
|
|
|
VOIP Modem (The older original VOIP modem, only web access)
|
|
|
Linux Firewall
|
|
|
LAN
Last edited by metallica1973; 04-05-2006 at 12:56 PM.
#CHECKBADFLAG - Kill any Inbound/Outbound TCP-Packets with impossible flag-combinations (Some port-scanners use these, eg. nmap Xmas,Null,etc.-scan)
$IPTABLES -N CHECKBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags ALL FIN,URG,PSH -j LBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j LBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags ALL ALL -j LBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags ALL NONE -j LBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags SYN,RST SYN,RST -j LBADFLAG
$IPTABLES -A CHECKBADFLAG -p tcp --tcp-flags SYN,FIN SYN,FIN -j LBADFLAG
#Inbound/Outbound SILENTDROPS/REJECTS (Things we don't want in our Logs)
#SMB-Traffic
$IPTABLES -N SMB
$IPTABLES -A SMB -p tcp --dport 137 -j DROP
$IPTABLES -A SMB -p tcp --dport 138 -j DROP
$IPTABLES -A SMB -p tcp --dport 139 -j DROP
$IPTABLES -A SMB -p tcp --dport 445 -j DROP
$IPTABLES -A SMB -p udp --dport 137 -j DROP
$IPTABLES -A SMB -p udp --dport 138 -j DROP
$IPTABLES -A SMB -p udp --dport 139 -j DROP
$IPTABLES -A SMB -p udp --dport 445 -j DROP
$IPTABLES -A SMB -p tcp --sport 137 -j DROP
$IPTABLES -A SMB -p tcp --sport 138 -j DROP
$IPTABLES -A SMB -p tcp --sport 139 -j DROP
$IPTABLES -A SMB -p tcp --sport 445 -j DROP
$IPTABLES -A SMB -p udp --sport 137 -j DROP
$IPTABLES -A SMB -p udp --sport 138 -j DROP
$IPTABLES -A SMB -p udp --sport 139 -j DROP
$IPTABLES -A SMB -p udp --sport 445 -j DROP
#################
## INPUT-Chain ## (everything that is addressed to the firewall itself)
#################
##GENERAL Filtering
# Kill INVALID packets (not ESTABLISHED, RELATED or NEW)
$IPTABLES -A INPUT -m state --state INVALID -j LINVALID
# Check TCP-Packets for Bad Flags
$IPTABLES -A INPUT -p tcp -j CHECKBADFLAG
##Packets FROM FIREWALL-BOX ITSELF
#Local IF
$IPTABLES -A INPUT -i lo -j ACCEPT
#
#Kill connections to the local interface from the outside world (--> Should be already catched by kernel/rp_filter)
$IPTABLES -A INPUT -d 127.0.0.0/25 -j LREJECT
$IPTABLES -A INPUT -m tcp -p tcp -s ! 127.0.0.1 --dport 3128 -j DROP
$IPTABLES -A INPUT -m tcp -p tcp -s ! 127.0.0.1 --dport 80 -j DROP
##Packets FROM INTERNAL NET
##Allow unlimited traffic from internal network using legit addresses to firewall-box
##If protection from the internal interface is needed, alter it
$IPTABLES -A INPUT -i $INTIF -s $INTLAN -j ACCEPT
#Kill anything from outside claiming to be from internal network (Address-Spoofing --> Should be already catched by rp_filter)
$IPTABLES -A INPUT -s $INTLAN -j LREJECT
##Packets FROM EXTERNAL NET
##ICMP & Traceroute filtering
#Filter ICMP
$IPTABLES -A INPUT -i $EXTIF -p ICMP -j DROP
##Silent Drops/Rejects (Things we don't want in our logs)
#Drop all SMB-Traffic
$IPTABLES -A INPUT -i $EXTIF -j SMB
#Silently reject Ident (Don't DROP ident, because of possible delays when establishing an outbound connection)
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 113 -j REJECT --reject-with tcp-reset
##Public services running ON FIREWALL-BOX (comment out to activate):
###########- From DMZ Interface to DMZ firewall IP########################
##################################################################
##Allow all other forwarding (from Ports > 1024) from Internal Net to External Net
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -s $INTLAN -p tcp --sport $UNPRIVPORTS -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -s $INTLAN -p udp --sport $UNPRIVPORTS -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -s $INTLAN -p icmp -j ACCEPT
##Filtering FROM EXTERNAL NET
##Silent Drops/Rejects (Things we don't want in our logs)
#SMB
# $IPTABLES -A FORWARD -i $EXTIF -j SMB
##Allow replies coming in
$IPTABLES -A FORWARD -i $EXTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $EXTIF -p tcp --dport $UNPRIVPORTS -m state --state RELATED -j TCPACCEPT
$IPTABLES -A FORWARD -i $EXTIF -p udp --dport $UNPRIVPORTS -m state --state RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $EXTIF -p icmp -m state --state RELATED -j ACCEPT
######################################## DMZ ################################################
$IPTABLES -A FORWARD -i $EXTIF -o $DMZ_IFACE -j WAN2DMZ
$IPTABLES -A FORWARD -i $DMZ_IFACE -o $EXTIF -j DMZ2WAN
################################## VOIP or PS2 -Forwarding #########################
#################### ################## WAN to PS2 ###########################################
#$IPTABLES -A WAN2DMZ -p tcp -d $DMZ_VOIP_PHONE --dport 80 -m state --state NEW -j ACCEPT
#$IPTABLES -A WAN2DMZ -p tcp -d $DMZ_VOIP_PHONE --dport 443 -m state --state NEW -j ACCEPT
$IPTABLES -A WAN2DMZ -p udp -d $DMZ_VOIP_PHONE --dport 1024:1030 -m state --state NEW -j ACCEPT
$IPTABLES -A WAN2DMZ -p udp -d $DMZ_VOIP_PHONE --dport 5050:5065 -m state --state NEW -j ACCEPT
$IPTABLES -A WAN2DMZ -p udp -d $DMZ_VOIP_PHONE --dport 10000:20000 -m state --state NEW -j ACCEPT
#$IPTABLES -A WAN2DMZ -p tcp -d $DMZ_VOIP_PHONE --dport 26300:26399 -m state --state NEW -j ACCEPT
#$IPTABLES -A WAN2DMZ -p tcp -d $DMZ_VOIP_PHONE --dport 30000:30099 -m state --state NEW -j ACCEPT
$IPTABLES -A WAN2DMZ -j RETURN
################################### PS2 to WAN #################################################################################################### #########################################
#$IPTABLES -A DMZ2WAN -p tcp -s $DMZ_VOIP_PHONE --dport 80 -m state --state NEW -j ACCEPT
#$IPTABLES -A DMZ2WAN -p tcp -s $DMZ_VOIP_PHONE --dport 443 -m state --state NEW -j ACCEPT
$IPTABLES -A DMZ2WAN -p udp -s $DMZ_VOIP_PHONE --dport 1024:1030 -m state --state NEW -j ACCEPT
$IPTABLES -A DMZ2WAN -p udp -s $DMZ_VOIP_PHONE --dport 5050:5065 -m state --state NEW -j ACCEPT
$IPTABLES -A DMZ2WAN -p udp -s $DMZ_VOIP_PHONE --dport 10000:20000 -m state --state NEW -j ACCEPT
#$IPTABLES -I DMZ2WAN -p tcp -s $DMZ_VOIP_PHONE --dport 26300:26399 -m state --state NEW -j ACCEPT
#$IPTABLES -I DMZ2WAN -p tcp -s $DMZ_VOIP_PHONE --dport 30000:30099 -m state --state NEW -j ACCEPT
$IPTABLES -I DMZ2WAN -j RETURN
I will shorten it up.WINSUX32 there it finally is after a million posts. I know it is huge but I am still learning IPTABLES and I am experimenting. Can you see what I might be doing wrong in my rules. I used your recommendations and I still cannot get my VOIP phones to work. I called the VOIP company and they say that those are the correct ports 5060-5065 UDP, 1020-1030 UDP and 10000-20000 UDP. I am will not let this beat me.
Last edited by metallica1973; 04-06-2006 at 11:21 AM.
I will shorten it up.WINSUX32 there it finally is after a million posts. I know it is huge but I am still learning IPTABLES and I am experimenting. Can you see what I might be doing wrong in my rules. I used your recommendations and I still cannot get my VOIP phones to work. I called the VOIP company and they say that those are the correct ports 5060-5065 UDP, 1020-1030 UDP and 10000-20000 UDP. I am will not let this beat me.
huh?? how did this thread go from a web scan to VOIP problems??
also, what recommendations are you talking about?? i don't believe i've made any...
anyhow, the VOIP issue has nothing to do with this thread, so we really should take the VOIP discussion to the other thread... i'll see you over there...
BTW, it would be great if you could use the code tags when you post scripts as it makes things much easier for people and it also avoids having the page's layout affected...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.