LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-29-2008, 03:57 AM   #16
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15

One more small doubt.We have created a new chain and appended rules to it. When i used nmap port scanner i found the ports 135,137, 138, 139 and 445 ports STATE is filtered. But for ssh and others is open. How to do it in other machine?
 
Old 09-29-2008, 04:21 AM   #17
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by bkcreddy17 View Post
One more small doubt.We have created a new chain and appended rules to it. When i used nmap port scanner i found the ports 135,137, 138, 139 and 445 ports STATE is filtered. But for ssh and others is open. How to do it in other machine?
That's because those are the only ports you are filtering. You have no rules to filter packets for any other ports. So any other port that has something listening on it will show up as open. I'm not sure I understand your question about the "other machine".
 
Old 09-29-2008, 04:50 AM   #18
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15
You solved this doubt.
Code:
$ sudo /sbin/iptables -nvL  --line-numbers
Chain INPUT (policy ACCEPT 14393 packets, 1293K bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1       20  1652 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
2    17408 1706K LOG        all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_IN:' 
3        8   400 SAMBA_CLIENTS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:135 
4        8   400 SAMBA_CLIENTS  udp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:137 
5        8   400 SAMBA_CLIENTS  udp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:138 
6       27  1360 SAMBA_CLIENTS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:139 
7     2964  411K SAMBA_CLIENTS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:445 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1        0     0 LOG        all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_OUT:' 
2        0     0 LOG        all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_IN:' 
3        0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
4        0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
5        0     0 ACCEPT     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           
6        0     0 ACCEPT     all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 11538 packets, 1483K bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1       20  1652 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
2    11538 1483K LOG        all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_OUT:' 

Chain SAMBA_CLIENTS (5 references)
num   pkts bytes target     prot opt in     out     source               destination         
1        0     0 ACCEPT     all  --  *      *       192.168.0.7          0.0.0.0/0           
2     2661  367K ACCEPT     all  --  *      *       192.168.0.10         0.0.0.0/0           
3      271 41786 ACCEPT     all  --  *      *       192.168.0.207        0.0.0.0/0           
4       83  4621 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0
When i used nmap this is the result.
Code:
$ sudo nmap 192.168.0.88

Starting Nmap 4.20 ( http://insecure.org ) at 2008-09-29 14:36 IST
Interesting ports on localhost.localdomain (192.168.0.88):
Not shown: 1674 closed ports
PORT      STATE    SERVICE
21/tcp    open     ftp
22/tcp    open     ssh
23/tcp    open     telnet
25/tcp    open     smtp
80/tcp    open     http
110/tcp   open     pop3
111/tcp   open     rpcbind
135/tcp   filtered msrpc
137/tcp   filtered netbios-ns
138/tcp   filtered netbios-dgm
139/tcp   filtered netbios-ssn
143/tcp   open     imap
445/tcp   filtered microsoft-ds
697/tcp   open     unknown
730/tcp   open     netviewdm2
866/tcp   open     unknown
993/tcp   open     imaps
995/tcp   open     pop3s
2049/tcp  open     nfs
3306/tcp  open     mysql
8080/tcp  open     http-proxy
9090/tcp  open     zeus-admin
10000/tcp open     snet-sensor-mgmt
Nmap finished: 1 IP address (1 host up) scanned in 2.609 seconds
These are the rules.
Code:
$ sudo /sbin/iptables -nvL
Chain INPUT (policy ACCEPT 7737 packets, 884K bytes)
 pkts bytes target     prot opt in     out     source               destination         
  316 65513 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
 7758  887K LOG        all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_IN:' 
   21  2784 ACCEPT     tcp  --  *      *       192.168.0.88         0.0.0.0/0           tcp dpt:22 
    0     0 ACCEPT     tcp  --  *      *       192.168.0.201        0.0.0.0/0           tcp dpt:22 
    0     0 ACCEPT     tcp  --  *      *       192.168.0.204        0.0.0.0/0           tcp dpt:22 
    0     0 ACCEPT     tcp  --  *      *       192.168.1.152        0.0.0.0/0           tcp dpt:22 
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22 
    0     0 ACCEPT     icmp --  *      *       192.168.1.152        0.0.0.0/0           icmp type 8 
    0     0 DROP       icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 LOG        all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_IN:' 
    0     0 LOG        all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_OUT:' 
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 5845 packets, 512K bytes)
 pkts bytes target     prot opt in     out     source               destination         
  316 65513 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
 5845  512K LOG        all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 7 prefix `BANDWIDTH_OUT:' 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8
When i used
Code:
$ sudo nmap 192.168.0.28

Starting Nmap 4.20 ( http://insecure.org ) at 2008-09-29 15:10 IST
Interesting ports on localhost.localdomain (192.168.0.28):
Not shown: 1685 closed ports
PORT      STATE SERVICE
21/tcp    open  ftp
22/tcp    open  ssh
23/tcp    open  telnet
53/tcp    open  domain
80/tcp    open  http
111/tcp   open  rpcbind
443/tcp   open  https
768/tcp   open  unknown
1241/tcp  open  nessus
3306/tcp  open  mysql
5900/tcp  open  vnc
10000/tcp open  snet-sensor-mgmt
How do i get "filter" for the ssh, telnet ports? Either for 88 or 28 ips.

Last edited by bkcreddy17; 09-29-2008 at 05:17 AM.
 
Old 09-29-2008, 05:23 AM   #19
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Post the output of this command from both boxes please:
Code:
netstat -an --inet | grep LISTEN
 
Old 09-29-2008, 05:37 AM   #20
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15
This is from 192.168.0.88
Code:
$ netstat -an --inet | grep LISTEN
netstat: no support for `AF INET (sctp)' on this system.
netstat: no support for `AF INET (sctp)' on this system.
tcp        0      0 0.0.0.0:20000               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:866                 0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:10025             0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      
tcp        0      0 192.168.0.88:80             0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:23                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:697                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:730                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:36060               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN
This is from 192.168.0.28
Code:
$ netstat -an --inet | grep LISTEN
netstat: no support for `AF INET (sctp)' on this system.
netstat: no support for `AF INET (sctp)' on this system.
tcp        0      0 0.0.0.0:20000               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:768                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:46435               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:5900                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      
tcp        0      0 192.168.0.28:80             0.0.0.0:*                   LISTEN      
tcp        0      0 192.168.0.28:21             0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:53                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:23                  0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:1241                0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN
 
Old 09-29-2008, 08:34 AM   #21
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Not sure what to tell you, as I don't see anything listening on port 22.
 
Old 09-29-2008, 04:17 PM   #22
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
No, but telnet is, and you should avoid using this unless absolutely necessary.
 
Old 09-29-2008, 11:18 PM   #23
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15
Yep, I will be using telnet service now and then to log in to my machine from windows machines. Because there is no putty in all machines.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I block all traffic to port 110 to and IP using IPtables? abefroman Linux - Networking 8 11-16-2005 07:26 PM
Iptables help, block port to outside but open to inside. Brian1 Linux - Networking 2 09-27-2005 08:41 PM
iptables, block port 80? frank2 Linux - Security 4 09-12-2004 09:14 AM
Block incoming port Iptables cli_man Linux - Networking 5 08-11-2003 08:32 PM
iptables - howto block by a port and IP address -HELP! macnanc Linux - Networking 2 03-07-2003 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration