Pages

Thursday, August 21, 2014

FTP Active mode vs Passive Mode

Traffic flow for Active mode and Passive mode:

 1. Active FTP :

     command : client >1023 -> server 21
     data    : client >1023 <- server 20

Running ftp command from client 10.94.200.28 to connect server 10.94.200.14:
C:\Users\j>ftp 10.94.200.14
Connected to 10.94.200.14.
220-FileZilla Server version 0.9.41 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (10.94.200.14:(none)): test
331 Password required for test
Password:
230 Logged on
ftp> debug
Debugging On .
ftp> mput C:\Users\john\Documents\a1.txt
mput C:\Users\john\Documents\a1.txt?
---> PORT 10,94,200,28,255,15 
200 Port command successful
---> STOR a1.txt
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 30348 bytes sent in 0.00Seconds 30348000.00Kbytes/sec.
ftp> ls
---> PORT 10,94,200,28,255,121
(Port number is 255*256+121=65401)
200 Port command successful
---> NLST
150 Opening data channel for directory list.
a1.txt
Tekradius DB.bak
226 Transfer OK
ftp: 26 bytes received in 0.00Seconds 26000.00Kbytes/sec.
ftp>

On server 10.94.200.14, checked the port number 65401 with netstat -na command

 2. Passive FTP :

     command : client >1023 -> server 21
     data    : client >1024 -> server >1023


ftp> literal pasv
---> pasv
227 Entering Passive Mode (10,94,200,14,233,114)
ftp>

Notes:
FTP communications use two port number values – one for commands (port 21 by default) and one for data transfer (this is where the PORT command comes into play).

The PORT command is sent by an FTP client to establish a secondary connection (address and port) for data to travel over. In some FTP implementations port 20 is used for data, but that is the exception rather than the rules. Typically in a trace you will see data crossing over a dynamic port number (IANA states that this range should be between 49152 through 65535, but most likely you’ll see your application using something just above 1024 – the area that used to be the dynamic port number area).

Friday, August 15, 2014

Close Cisco IOS TCP Ports 23, 2002, 4002, 6002, and 9002 from Network Ports Scanning

Just found my Cisco 1921 has same problem on ports 2002, 4002, 6002 and 9002, as described on this post.

Symptoms:

Some Cisco Cisco Routers (1900/2900 Series) are answering to the TCP connection attempts (replying SYN-ACKs for the SYN requests) upon TCP ports 2002, 4002, 6002, and 9002.

Some other routers are answering tcp port 23 (telnet).

I used http://ping.eu/port-chk/ to test those ports, ports 2002, 4002, 6002 and 9002 are opening on my CISCO1921 router :

R1#show control-plane host open-ports
Active internet connections (servers and established)
Prot               Local Address             Foreign Address                  Service    State
 tcp                        *:22                         *:0               SSH-Server   LISTEN
 tcp                        *:23                         *:0                   Telnet   LISTEN
 tcp                      *:6002          88.198.46.51:58719            TCP Protocols ESTABLIS
 udp                       *:123                         *:0                      NTP   LISTEN
 udp                      *:4500                         *:0                   ISAKMP   LISTEN
 udp                       *:161                         *:0                  IP SNMP   LISTEN
 udp                       *:162                         *:0                  IP SNMP   LISTEN
 udp                      *:1975                         *:0                      IPC   LISTEN
 udp                     *:57430                         *:0                  IP SNMP   LISTEN
 udp                       *:500                         *:0                   ISAKMP   LISTEN

Solutions:

1. Solution for ports 2002, 4002, 6002 and 9002 will be same as the post mentioned before:


Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line 2
Router(config-line)#transport input none
Router(config-line)#end
Router#


2. Solution for port 23:


R#conf t


Enter configuration commands, one per line.  End with CNTL/Z.


R(config)#class-map type port-filter match-any TCP23


R(config-cmap)#match port tcp 23


R(config)#policy-map type port-filter FILTERTCP23


R(config-pmap)#class TCP23


R(config-pmap-c)#drop   


R(config-pmap-c)#log


R(config)#control-plane host


R(config-cp-host)#service-policy type port-filter input FILTERTCP23


*Aug 15 16:31:29: %CP-6-TCP: DROP TCP/UDP Portfilter  88.198.46.51(57596) -> 61.16.203.24(23)
*Aug 15 16:31:30: %CP-6-TCP: DROP TCP/UDP Portfilter  88.198.46.51(57596) -> 61.16.203.24(23)

Reference:

1.PacketU's Post
2. itcertnotes' Post

Thursday, August 7, 2014

Tripwire Enterprise 8.3 Basic Configuration Steps


Tripwire Enterprise is a security configuration management suite whose Policy Management, Integrity Management, and Remediation Management capabilities stand-alone or work together in a comprehensive, tightly integrated SCM solution.
Five Key Features:
  • Change-triggered Configuration Assessment
  • World's Best File Integrity Monitoring
  • Achieve Continuous Compliance
  • Integrate SCM into IT Security Operations
  • Visualize and Report SCM Results to Communicate & Mitigate Risks



Our version is 8.3. Here are some basic steps to configure a new network device node in the Tripwire Enterprise 8.3:

1. Add a new node:

Assigned to Custom type Cisco which gives more flexibility.
Enter correct username and password.

Important part is to give right maker and model information to get it auto assigned into smart group.

This screenshot shows the new node assigned to right Cisco Nexus 5000 group.


2. Do a check or baseline to new node with proper rule. 

In this example, I used Cisco IOS configuration Rule which is to run Show Running-Config command

3. Rules. 

Create a new rule for your device. Using Network Device -> Common -> Command Output Validation Rule template:


In the rule, put proper command just as following screenshot shows:

Next Screenshot shows how to check Checkpoint rules.C

Another thing in the rule is Target Node Type.

4. Report

Create a report based on a report template.



5. Task.

Schedule a task to send the report to your email.



Wednesday, August 6, 2014

Linux : find big file in the all directories

1. Juniper Firewall  

find . -type f -size +10000 -exec ls -lh {} \; 

Sample output:

root@FW% find . -type f -size +10000 -exec ls -lh {} \; 
-rw-r--r--  1 930  929   134M Jan  5 17:34 ./cf/packages/junos-11.4R6.6-domestic
-rw-r--r--  1 root  wheel   139M Sep  8  2011 ./cf/var/log/junos-srxsme-11.2R2.4-domestic.tgz
-rw-r-----  1 root  wheel   4.9M Feb 11 17:12 ./cf/var/db/idpd/db/secdb_02.db
-rw-r-----  1 root  wheel   6.7M Feb 11 17:13 ./cf/var/db/idpd/db/secdb_03.db
-rw-r-----  1 root  wheel    64M Feb 11 17:13 ./cf/var/db/idpd/db/secdb_06.db
-rwxr-xr-x  1 admin  20    24M May 23 08:38 ./cf/var/db/idpd/nsm-download/SignatureUpdate.xml
-r-xr-xr-x  1 root  wheel   5.2M Jan  5 17:33 ./jail/html/dynamic-vpn/client/jam/InstallerComponentSRX.exe
-rw-r--r--  1 root  wheel   139M Sep  8  2011 ./jail/var/log/junos-srxsme-11.2R2.4-domestic.tgz
-rw-r-----  1 root  config    14M Feb  8 22:16 ./mfs/var/run/db/schema.db
-rw-r-----  1 root  wheel    10M Feb  8 22:19 ./mfs/var/sdb/log.0000000001
-r--r--r--  1 root  wheel   6.5M Jan  5 13:59 ./usr/lib/dd/libjkernel-dd.so
-r-xr-xr-x  1 root  wheel    13M Jan  5 15:39 ./usr/sbin/authd
-r-xr-xr-x  1 root  wheel   6.0M Jan  5 16:51 ./usr/sbin/chassisd
-r-xr-xr-x  1 root  wheel    27M Jan  5 13:05 ./usr/sbin/flowd_octeon
-r-xr-xr-x  1 root  wheel    34M Jan  5 13:05 ./usr/sbin/flowd_octeon_hm
-r-xr-xr-x  1 root  wheel   5.5M Jan  5 16:51 ./usr/sbin/kmd
-r-xr-xr-x  1 root  wheel    13M Jan  5 16:24 ./usr/sbin/rpd



2. Checkpoint Firewall gateway:


[Expert@CP]# find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
./sysimg/CPwrapper/linux/CPEndpointSecurity/EndpointSecurityServer.bin: 145M
./sysimg/CPwrapper/linux/windows/SmartConsole.exe: 194M
./sysimg/CPwrapper/linux/CPrt/CPrt-R75.40-00.i386.rpm: 53M
./sysimg/CPwrapper/linux/CPportal/CPportal-R75.40-00.i386.rpm: 59M
./var/log/db: 336M
./var/log/upload/WebUpload.IjyBg6: 91M
./var/log/upload/Check_Point_R77.10_T151_upg_WEBUI_and_SmartUpdate.Gaia.tgz: 1.5G
./var/log/upgrade/RPMS/auto_hfs-0.2-cp990150005.i386.rpm: 59M
./var/log/upgrade/scripts/linux/CPcvpn/CPcvpn-R77-00.i386.rpm: 67M
./var/log/upgrade/scripts/linux/CPvpn/CPsuite-R77-00.i386.rpm: 504M
./var/log/upgrade/scripts/linux/CPuepm/CPuepm-R77-00.i386.rpm: 125M
./var/log/upgrade/scripts/linux/CPportal/CPportal-R77-00.i386.rpm: 62M
./var/log/upgrade/scripts/linux/windows/SmartConsole.exe: 302M
./var/log/upgrade/scripts/linux/CPrt/CPrt-R77-00.i386.rpm: 53M
./var/log/opt/CPsuite-R75.40/fw1/fw.log: 55M
./var/CPbackup/backups/backup_CP-M-DMZ.gi-de.com_9_7_2013_13_21.tgz: 59M
./var/opt/CPsuite-R75.40/fw1/conf/appfw/appfw_tables.sqlite: 130M
./sys/devices/pci0000:00/0000:00:02.0/resource2: 256M
./proc/kcore: 1015M

Saturday, August 2, 2014

Cisco VPN LAB 3 : A Simple DMVPN Configuration Example

1. Topology
a. Rack is from IOU v5. This lab will use seven routers to complete whole DMVPN configuration and test.




b. network topology. It is drew from gliffy website mentioned in previous post cool networking website and tools collection.

2. Configuration Before IPSec Enabled

R6:
interface Serial2/2
 ip address 172.17.6.100 255.255.255.0
ip route 0.0.0.0 0.0.0.0 172.17.6.1

R1: HUB
interface Tunnel0
 ip address 10.1.1.1 255.255.255.0
 no ip redirects
 ip mtu 1416
 ip hold-time eigrp 1 35
 no ip next-hop-self eigrp 1
 ip nhrp map multicast dynamic
 ip nhrp network-id 1
 no ip split-horizon eigrp 1
 tunnel source 192.168.1.100
 tunnel mode gre multipoin
!
interface Ethernet0/1
 ip address 192.168.1.100 255.255.255.0
!
interface Serial2/2
 ip address 172.17.6.1 255.255.255.0
!
router eigrp 1
 network 10.0.0.0
 network 172.17.0.0
 network 192.168.0.0
 no auto-summary
!
ip route 192.168.0.0 255.255.0.0 192.168.1.1

R2: Cloud
interface Ethernet0/0
 ip address 192.168.2.1 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.1.1 255.255.255.0
!
interface Serial2/2
 ip address 192.168.3.1 255.255.255.0

R3: Spoke
interface Tunnel0
 ip address 10.1.1.2 255.255.255.0
 no ip redirects
 ip mtu 1416
 ip hold-time eigrp 1 35
 no ip next-hop-self eigrp 1
 ip nhrp map 10.1.1.1 192.168.1.100
 ip nhrp map multicast 192.168.1.100
 ip nhrp network-id 1
 ip nhrp nhs 10.1.1.1
 no ip split-horizon eigrp 1
 tunnel source 192.168.2.100
 tunnel mode gre multipoint
!
interface Ethernet0/0
 ip address 192.168.2.100 255.255.255.0
!
interface Ethernet0/1
 ip address 172.17.2.1 255.255.255.0
router eigrp 1
 network 10.0.0.0
 network 172.17.0.0
 network 192.168.0.0
 no auto-summary
!
ip route 192.168.1.0 255.255.255.0 192.168.2.1

R4:
interface Ethernet0/1
 ip address 172.17.2.100 255.255.255.0
ip route 0.0.0.0 0.0.0.0 172.17.2.1


R7: Spoke:
interface Tunnel0
 ip address 10.1.1.3 255.255.255.0
 no ip redirects
 ip mtu 1416
 ip hold-time eigrp 1 35
 no ip next-hop-self eigrp 1
 ip nhrp map 10.1.1.1 192.168.1.100
 ip nhrp map multicast 192.168.1.100
 ip nhrp network-id 1
 ip nhrp nhs 10.1.1.1
 no ip split-horizon eigrp 1
 tunnel source 192.168.3.100
 tunnel mode gre multipoint
!
interface Ethernet1/1
 ip address 172.17.3.1 255.255.255.0
interface Serial2/2
 ip address 192.168.3.100 255.255.255.0
!
router eigrp 1
 network 10.0.0.0
 network 172.17.0.0
 network 192.168.0.0
 no auto-summary
!
ip route 192.168.1.0 255.255.255.0 192.168.3.1
!

R10:
interface Ethernet1/1
 ip address 172.17.3.100 255.255.255.0
ip route 0.0.0.0 0.0.0.0 172.17.3.1

3. Configuration to enable IPSec


On R1, R3 and R7, add following IPSec configuration into routes.

crypto isakmp policy 10
authentication pre-share

crypto isakmp key cisco123 address 0.0.0.0 0.0.0.0
crypto ipsec transform MINE esp-3des

crypto ipsec profile DMVPN
set transform-set MINE

interface tunnel0
tunnel protection ipsec profile DMVPN

Reference: