25.03.2015 Views

FTP Server Exit - Aesclever.com

FTP Server Exit - Aesclever.com

FTP Server Exit - Aesclever.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>FTP</strong> Analysis via SMF Records, <strong>FTP</strong><br />

<strong>Server</strong> <strong>Exit</strong>s and Logging, and CTRACE<br />

SHARE Session 3961<br />

March 6, 2006<br />

David Cheng<br />

Applied Expert Systems, Inc.<br />

davec@aesclever.<strong>com</strong>


Agenda<br />

<strong>FTP</strong> Background<br />

Data type, structure and mode<br />

Active <strong>FTP</strong><br />

Passive <strong>FTP</strong><br />

<strong>FTP</strong> Commands and Replies<br />

<strong>FTP</strong> Diagnostic/Performance Data<br />

<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong>s<br />

<strong>FTP</strong> SMF Records<br />

SMF Type 118 vs. Type 119<br />

<strong>FTP</strong> <strong>Server</strong> Logging<br />

Component Trace – IP packet trace<br />

<strong>FTP</strong> Analysis/Tuning<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 2


<strong>FTP</strong> Data Type – how data is interpreted<br />

by the receiver<br />

<strong>FTP</strong> always transfer data in 8-bit 8<br />

bytes; this is called the transfer size<br />

ASCII<br />

Default data type<br />

Each line of data is terminated by CRLF (X’0D0A<br />

0D0A’)<br />

Translation is always required; even between 2 ASCII hosts:<br />

ASCII -> > NVT-ASCII<br />

-> > ASCII<br />

(NVT-ASCII : Network Virtual Terminal ASCII as defined in the TELNET<br />

protocol.)<br />

If MVS is the receiving side, data will be translated to EBCDIC, CRLF<br />

replaced with MVS record boundaries – according to SITE/LOCSITE parms:<br />

RECFM and LRECL<br />

EBCDIC<br />

8-bit EBCDIC bytes are transferred as they are – no translation<br />

IMAGE<br />

Contiguous bits packed into the 8-bit 8<br />

<strong>FTP</strong> transfer byte size<br />

Normally used for binary data<br />

More efficient method to transfer data between 2 similar ASCII hostsh<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 3


Data Type Comparison<br />

EBCDIC -> EBCDIC, 29*80 chars: 2320 bytes<br />

Data Type<br />

ASCII<br />

EBCDIC<br />

IMAGE<br />

Bytes transferred<br />

2378 bytes<br />

29*2 extra bytes:<br />

X’0D0A’ (CRLF in ASCII)<br />

ASCII data transferred, then<br />

converted to EBCDIC<br />

2349 bytes<br />

29 extra byte:<br />

X’15’ (NL in EBCDIC)<br />

2320 bytes<br />

Response Time<br />

(seconds)<br />

0.330<br />

0.260<br />

0.320<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 4


<strong>FTP</strong> Data Structure – how data is stored<br />

by the receiver<br />

<br />

<br />

<br />

File<br />

Has no internal structure<br />

Contiguous sequence of bytes<br />

Most widely implemented<br />

Record<br />

File is made up of sequential records; ASCII type with<br />

CRLF sequences<br />

z/OS only supports Record structure with stream<br />

mode transfer<br />

Page – not supported in z/OS<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 5


<strong>FTP</strong> Data Mode – how data is transmitted<br />

<br />

<br />

<br />

Stream<br />

Transmitted as stream of bytes; with very little or no extra<br />

processing<br />

Block<br />

Transmitted as a series of data blocks, each block is preceded<br />

by a header - count and descriptor<br />

z/OS only supports Block mode with data type EBCDIC<br />

A file transferred between 2 z/OS systems in Block mode will<br />

preserve its record structure (e.g., variable length records)<br />

Compress<br />

Transmitted in a <strong>com</strong>pressed format<br />

Simple <strong>com</strong>pression algorithm – send duplicated bytes in a two-<br />

byte sequence, followed by a one-byte filler<br />

In z/OS Compress requires data type EBCDIC<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 6


Control / Data Connections<br />

<br />

<br />

Control connection<br />

A <strong>com</strong>munication path between the Client and <strong>Server</strong> for the<br />

exchange of <strong>com</strong>mands & replies<br />

<strong>FTP</strong> <strong>Server</strong> Port 21<br />

Connection stays up during the whole session, in which<br />

many files may be transferred<br />

Data connection<br />

A full duplex connection over which data is transferred, in a<br />

specified mode and type<br />

<strong>FTP</strong> <strong>Server</strong> Port 20 (for active <strong>FTP</strong>)<br />

Usually one for each file transfer<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 7


Active <strong>FTP</strong><br />

<strong>Server</strong> initiates data connection to the client<br />

Client connects from a random unprivileged port (N ><br />

1024) to the <strong>FTP</strong> server’s s port 21<br />

Client starts listening to port N+1 and sends the <strong>FTP</strong><br />

<strong>com</strong>mand PORT N+1 to the <strong>FTP</strong> server<br />

PORT h1,h2,h3,h4,p1,p2<br />

h1,h2,h3,h4 is the client’s s IP address, p1,p2 is the client<br />

port number in an 8 bit high, low bit order<br />

The <strong>Server</strong> will then connect back to the client’s s specified<br />

data port from its local data port (port 20)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 8


<strong>FTP</strong> Data Session – Active Mode<br />

<strong>FTP</strong> Client<br />

Port X PORT, IP address, port Y<br />

Port X<br />

Port X<br />

<strong>FTP</strong> <strong>Server</strong><br />

Port 21<br />

PORT, IP address, port Y Port 21<br />

PORT <strong>com</strong>mand successful Port 21<br />

ACK Port 21<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 9


<strong>FTP</strong> Active Mode in Details<br />

<strong>FTP</strong> Client<br />

Port X<br />

Port X<br />

Port X<br />

Port X<br />

Port X<br />

Port X<br />

Port Y<br />

Port Y<br />

Port Y<br />

Port Y<br />

<strong>FTP</strong> <strong>Server</strong><br />

SYN Port 21<br />

SYN ACK Port 21<br />

ACK Port 21<br />

PORT, IP address, port Y Port 21<br />

PORT <strong>com</strong>mand successful Port 21<br />

LIST, RETR, or STOR, etc. Port 21<br />

SYN Port 20<br />

SYN ACK Port 20<br />

ACK Port 20<br />

Data segments and ACKs Port 20<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 10


Active <strong>FTP</strong><br />

<strong>FTP</strong> Client<br />

<strong>FTP</strong> <strong>Server</strong><br />

1674 PORT 1675 21<br />

ACK<br />

1675 connect 20<br />

ACK<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 11


Passive <strong>FTP</strong><br />

Client initiates data connection to the server<br />

Firewall friendly<br />

When opening an <strong>FTP</strong> connection, the client opens 2<br />

random unprivileged ports locally (N > 1024 and N+1)<br />

The first port contacts the server on port 21<br />

Client issues the PASV <strong>com</strong>mand (the PASV <strong>com</strong>mand<br />

takes no parameters)<br />

The server then opens a random port and sends Reply<br />

Code 227 back to the client (similar to the PORT<br />

<strong>com</strong>mand)<br />

The client then initiates the connection from port N+1 to<br />

port P on the server to transfer data<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 12


Passive <strong>FTP</strong><br />

<strong>FTP</strong> Client<br />

<strong>FTP</strong> <strong>Server</strong><br />

1673 PASV 21<br />

“227 Entering Passive Mode (IP Addr, , Port #)”<br />

1674 connect 2020<br />

ACK<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 13


<strong>FTP</strong> Passive Mode in Details<br />

<strong>FTP</strong> Client<br />

<strong>FTP</strong> <strong>Server</strong><br />

Port X<br />

SYN Port 21<br />

Port X SYN ACK Port 21<br />

Port X<br />

ACK Port 21<br />

Port X<br />

Port X<br />

Port Z<br />

Port Z<br />

Port Z<br />

Port X<br />

Port Z<br />

PASV Port 21<br />

RC 227, IP address, Port Y Port 21<br />

SYN<br />

Port Y<br />

SYN ACK<br />

Port Y<br />

ACK<br />

Port Y<br />

LIST, RETR, or STOR, etc. Port 21<br />

Data segments and ACKs Port 20<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 14


<strong>FTP</strong> Commands<br />

<br />

<br />

<br />

Commands and Replies are sent across the control<br />

connection and are in plain text.<br />

Commands are 3 or 4 bytes characters, each with<br />

optional parameters.<br />

The <strong>FTP</strong> <strong>com</strong>mands specify the parameters for:<br />

the data connection (port)<br />

transfer mode<br />

data representation type and structure<br />

the nature of file system operation (store, retrieve,<br />

append, delete, etc.)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 15


Sample <strong>FTP</strong> Commands<br />

Access Control:<br />

USER<br />

PORT<br />

TYPE<br />

QUIT<br />

Transfer:<br />

MODE<br />

RETR<br />

STOR<br />

User identification<br />

Data port specification<br />

Data representation (ASCII, EBCDIC, Image)<br />

Terminates a USER and the control connection<br />

Transfer mode (Stream, Block, Compress)<br />

<strong>Server</strong> -> > Client file transfer<br />

Client -> > <strong>Server</strong> file transfer<br />

Service:<br />

DELE<br />

Deletes a <strong>Server</strong> file<br />

LIST<br />

Directory listing<br />

RNFR<br />

Renames from <br />

RNTO<br />

Renames to <br />

(RNFR must be immediately followed by a RNTO <strong>com</strong>mand)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 16


<strong>FTP</strong> Replies<br />

Synchronization of requests and actions in the file<br />

transfer process<br />

Guarantee that the user process always knows the state<br />

of <strong>Server</strong><br />

Every <strong>com</strong>mand must generate at least one reply<br />

An <strong>FTP</strong> reply consists of a 3-digit 3<br />

number (i.e., 3<br />

alphanumeric characters) followed by some text<br />

The number is intended for use by the software to<br />

determine what to do next; the text is intended for the<br />

human user<br />

There may be more than one reply, in which case these<br />

multiple replies must be easily distinguished<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 17


<strong>FTP</strong> Reply Code<br />

<br />

<br />

<br />

<br />

<br />

1yz<br />

2yz<br />

3yz<br />

4yz<br />

5yz<br />

Positive preliminary reply<br />

Positive <strong>com</strong>pletion reply (a new <strong>com</strong>mand may be sent)<br />

Positive intermediate reply (another <strong>com</strong>mand must be sent)<br />

Transient negative reply (<strong>com</strong>mand can be re- issued later)<br />

Permanent negative reply (<strong>com</strong>mand should not be retried)<br />

<br />

<br />

<br />

<br />

<br />

<br />

x0z<br />

x1z<br />

x2z<br />

x3z<br />

x4z<br />

x5z<br />

Syntax error<br />

Information<br />

Connections<br />

Authentication and accounting<br />

Unspecified<br />

File system status<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 18


Sample <strong>FTP</strong> Reply Codes<br />

150 File status okay; about to open data connection.<br />

226 Transfer <strong>com</strong>plete<br />

227 Entering passive mode {h1,h2,h3,h4,p1,p2}<br />

250 Requested file action okay, <strong>com</strong>pleted.<br />

257 "PATHNAME" created.<br />

350 Requested file action pending further information.<br />

450 Requested file action not taken. File unavailable (e.g., file busy). b<br />

550 Requested action not taken. File unavailable (e.g., file not<br />

found, no access).<br />

451 Requested action aborted. Local error in processing.<br />

551 Requested action aborted. Page type unknown.<br />

452 Requested action not taken. Insufficient storage space in<br />

system.<br />

552 Requested file action aborted. Exceeded storage allocation (for<br />

current directory or data set).<br />

553 Requested action not taken.<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 19


C:\Windows>ftp 137.72.43.247<br />

Connected to 137.72.43.247.<br />

220-<strong>FTP</strong>D1 IBM <strong>FTP</strong> CS V1R4 at S390, 21:05:48 on 2004-07<br />

07-20.<br />

220 Connection will close if idle for more than 5 minutes.<br />

User (137.72.43.247:(none)): p390<br />

331 Send password please.<br />

Password:<br />

RC 220<br />

RC 331<br />

Service ready for new user<br />

- : continuation<br />

User name OK, need password<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 20


<strong>FTP</strong> Diagnostics Data<br />

Connection attempts<br />

Client identification<br />

Active vs. Passive <strong>FTP</strong><br />

<strong>FTP</strong> <strong>com</strong>mands<br />

<strong>FTP</strong> replies<br />

Throughput<br />

PORT <strong>com</strong>mand hacking (<strong>FTP</strong> bounce attack)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 21


<strong>FTP</strong> Diagnostics/Performance Data<br />

Published Record Types or API<br />

Non-intrusive, lower overhead<br />

Event-driven<br />

True real-time data<br />

<strong>FTP</strong> <strong>Server</strong> exits and SMF exits<br />

Polling<br />

Comm <strong>Server</strong> Network Management API<br />

Only SMF data is available<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 22


<strong>FTP</strong> Diagnostics/Performance Data<br />

<br />

<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong>s<br />

FTCHKIP – open connection<br />

FTCHKPWD – password verification<br />

FTCHKCMD – <strong>FTP</strong> <strong>com</strong>mand<br />

<strong>FTP</strong>OSTPR – <strong>FTP</strong> <strong>com</strong>mand <strong>com</strong>pletion<br />

FTCHKJES – Job submission<br />

<strong>FTP</strong>SMFEX – <strong>FTP</strong> server SMF record<br />

SMF records (Type 118 or 119)<br />

<br />

<br />

<br />

<br />

<br />

<strong>FTP</strong> <strong>Server</strong> Logon Fauilure<br />

<strong>FTP</strong> <strong>Server</strong> Transfer Completion<br />

<strong>FTP</strong> Client Transfer Completion<br />

TCP Connection Initiation<br />

TCP Connection Termination<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 23


<strong>FTP</strong> Diagnostics/Performance Data<br />

Logging/Tracing<br />

<strong>FTP</strong>LOGGING, ANONYMOUS<strong>FTP</strong>LOGGING (<strong>FTP</strong><br />

<strong>Server</strong>)<br />

TRACE, DEBUG (<strong>FTP</strong> <strong>Server</strong>)<br />

Packet trace – detailed analysis at protocol level<br />

NOT for monitoring purpose<br />

Performance penalty (e.g., APAR PQ84192)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 24


<strong>FTP</strong> <strong>Server</strong> User <strong>Exit</strong>s<br />

<br />

<br />

<br />

<br />

<br />

<br />

R1 -> > parameter list, which is a series of pointers to<br />

values<br />

The first word of the parameter list always points to the<br />

return code (RC). RC=0 upon entry to an exit. If RC is<br />

not 0, user will receive a negative reply<br />

The second word of the parameter list always points to a<br />

word containing the number of parameters that follow<br />

APF-authorized<br />

STEPLIB DD in the <strong>FTP</strong>D proc<br />

RACF consideration<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 25


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - FTCHKIP<br />

FTCHKIP is called at the initial stage of login or<br />

whenever the user issues an OPEN <strong>com</strong>mand<br />

Client’s s IP address (IPV4) and port<br />

<strong>Server</strong>’s s IP address (IPV4) and port<br />

Socket address structure (IPV4 or IPV6) for<br />

the client’s s control conneciton<br />

Socket address structure (IPV4 or IPV6) for<br />

the server’s s control connection<br />

Session ID<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 26


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - FTCHKPWD<br />

FTCHKPWD is called after the user enters the password<br />

Client’s s user ID<br />

Client’s s password<br />

User data<br />

Number of bad passwords input in this logon attempt<br />

Socket address structure for the client’s s control<br />

connection<br />

Socket address structure for the server’s s control<br />

connection<br />

Session ID<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 27


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - FTCHKCMD<br />

FTCHKCMD is called whenever the client enters a<br />

<strong>com</strong>mand<br />

Client’s s user ID<br />

Command<br />

Command parameters<br />

Current directory type: MVS, HFS<br />

File type: SEQ, JES, SQL<br />

Current working directory<br />

Address of a buffer for <strong>com</strong>mand modification<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 28


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - <strong>FTP</strong>OSTPR<br />

<strong>FTP</strong>OSTPR is called upon <strong>com</strong>pletion of the <strong>FTP</strong> <strong>com</strong>mands RETR,<br />

STOR, STOU, APPE, DELE, and RNTO<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Client’s s user ID<br />

Client’s s IP address<br />

Client’s s port<br />

Current directory type: MVS, HFS<br />

Current working directory<br />

Current file type: SEQ, JES, SQL<br />

<strong>FTP</strong> reply code<br />

<strong>FTP</strong> reply string<br />

<strong>FTP</strong> <strong>com</strong>mand code<br />

Current CONDDISP setting: C for catalog, D for delete<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 29


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - <strong>FTP</strong>OSTPR<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Close reason code:<br />

0 – transfer <strong>com</strong>pleted normally<br />

4 – transfer <strong>com</strong>pleted w/error<br />

see <strong>FTP</strong> reply code and text string<br />

8 – transfer <strong>com</strong>pleted w/socket erros<br />

12 – transfer aborted<br />

16 – transfer aborted w/SQL file errors<br />

Dataset name or HFS file name<br />

Bytes transferred<br />

Socket address structure for the client’s s control session<br />

Socket address structure for the server’s s control session<br />

Session ID<br />

Address of scratch pad area (256 bytes)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 30


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> - <strong>FTP</strong>SMFEX<br />

<strong>FTP</strong>SMFEX is called before a type 118 SMF (<strong>FTP</strong><br />

server) record is written to SMF<br />

Type 119 SMF records must use the system-wide SMF<br />

exits IEFU83, IEFU84 and IEFU85<br />

R1 -> > the following parameter list:<br />

Pointer to the return code<br />

Pointer to the type 118 SMF record<br />

On entry, the return code is set to 0. A return code of 0<br />

specifies that the SMF record will be written<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 31


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> Installation<br />

APF-authorize the load library<br />

Add the load library to STEPLIB in the <strong>FTP</strong>D<br />

proc<br />

If RACF Program Control is active: SETROPTS<br />

WHEN(PROGRAM), you must define <strong>FTP</strong> exits<br />

to RACF class PROGRAM<br />

Restart the <strong>FTP</strong> Daemon (for FTCHKIP)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 32


<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong> Installation<br />

Sample RACF Definition for FTCHKIP:<br />

RDEFINE PROGRAM FTCHKIP<br />

ADDMEM(‘loadlib<br />

loadlib’/volser/NOPADCHK) ) UACC(READ)<br />

…<br />

SETR WHEN(PROGRAM) REFRESH<br />

Without proper RACF definition, <strong>FTP</strong> client will get the<br />

following error when logging in:<br />

550 PASS COMMAND FAILED - _PASSWD() ERROR: EDC5157I AN<br />

INTERNAL ERROR OCURRED<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 33


Verify <strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong>s<br />

Start the <strong>FTP</strong> <strong>Server</strong> with the “TRACE”<br />

parameter; e.g., S <strong>FTP</strong>D,PARM=TRACE<br />

Check for the following messages in SYSLOG:<br />

BPXF024I (<strong>FTP</strong>D) Jan 5 18:01:34 ftpd 33619980 : DM1009 main:<br />

FTCHKIP successfully loaded<br />

BPXF024I (AESDJC1) Jan 6 02:01:57 ftps 16843115 : RX0625 main:<br />

chkpwdexit successfully loaded<br />

BPXF024I (AESDJC1) Jan 6 02:01:58 ftps 16843115 : RX0641 main:<br />

chkcmdexit successfully loaded<br />

BPXF024I (AESDJC1) Jan 6 02:01:58 ftps 16843115 : RX0696 main:<br />

<strong>FTP</strong>OSTPR successfully loaded<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 34


<strong>FTP</strong> <strong>Server</strong> SMF Record<br />

<strong>FTP</strong> <strong>com</strong>mand<br />

<strong>FTP</strong> type: SEQ, JES, SQL<br />

Client IP address and port<br />

<strong>Server</strong> IP address and port<br />

Local user ID<br />

Data format: A: ASCII, E: EBCDIC, I: image<br />

(binary), D: double byte, U: UCS-2<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 35


<strong>FTP</strong> <strong>Server</strong> SMF Record - Continued<br />

Mode – S: stream, B: block. C : <strong>com</strong>pressed<br />

Start/End time of transmission<br />

Bytes transferred<br />

<strong>FTP</strong> reply code<br />

Dataset/member/file names<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 36


<strong>FTP</strong> Client SMF Record<br />

<strong>FTP</strong> <strong>com</strong>mand<br />

Client IP address and port<br />

<strong>Server</strong> IP address and port<br />

Data format<br />

Transfer mode<br />

Start/End time of transmission<br />

Byte count<br />

Dataset/file name<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 37


Enable TCP/IP SMF Recording<br />

SMFPRMxx – make sure that 118/119 is not<br />

being excluded from recording<br />

SMF Type 119 is available only in z/OS V1R2<br />

and later releases<br />

SMF Type 118 and Type 119 can co-exist<br />

To get <strong>FTP</strong> <strong>Server</strong> SMF record, configure <strong>FTP</strong><br />

DATA as follows:<br />

118: SMF STD<br />

119: SMF TYPE119<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 38


Enable TCP/IP SMF Recording<br />

To get <strong>FTP</strong> Client SMF record, configure TCP/IP<br />

PROFILE as follows:<br />

118<br />

SMFCONFIG <strong>FTP</strong>CLIENT …<br />

119<br />

SMFCONFIG … TYPE119 <strong>FTP</strong>CLIENT …<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 39


Verify SMF Recording<br />

<br />

<br />

System Level – issue the “D SMF,O” operator <strong>com</strong>mand, verify:<br />

SMFPRMxx member<br />

SMF parameters<br />

TCP/IP Level – issue the “NETSTAT,CONFIG” <strong>com</strong>mand<br />

Check the SMF Parameters listing; e.g.,<br />

SMF Parameters:<br />

Type 118:<br />

TcpInit: 00 TcpTerm: 00 <strong>FTP</strong>Client: 00<br />

TN3270Client: 00 TcpIpStats: 00<br />

Type 119:<br />

TcpInit: Yes TcpTerm: Yes <strong>FTP</strong>Client: Yes<br />

TcpIpStats: Yes IfStats: Yes PortStats: Yes<br />

Stack: Yes UdpTerm: Yes TN3270Client: Yes<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 40


Verify SMF Recording<br />

<strong>FTP</strong> <strong>Server</strong> – start the <strong>FTP</strong> server with the “TRACE” parameter;<br />

e.g., S <strong>FTP</strong>D,PARM=TRACE<br />

Look for the write_smf_record messages; e.g.,<br />

<br />

250 Transfer <strong>com</strong>pleted successfully.<br />

BPXF024I (AESDJC1) Jan 6 02:02:08 ftps 16843115 : RU1463<br />

write_smf_record: entered with type 4<br />

BPXF024I (AESDJC1) Jan 6 02:02:08 ftps 16843115 : RU0754<br />

write_smf_record_119: entered with type 4.<br />

<br />

<strong>FTP</strong> Client – start the <strong>FTP</strong> client with the “trace” parameter, or issue the<br />

“debug” <strong>com</strong>mand from an <strong>FTP</strong> client session;<br />

e.g., ftp 137.72.43.247 (trace<br />

Look for the following messages: CU1963, CU1463, CU2241; e.g.,<br />

<br />

250 Transfer <strong>com</strong>pleted successfully.<br />

EZA1617I 2320 bytes transferred in 0.160 seconds. Transfer<br />

rate 14.50 Kbytes/sec.<br />

CU1963 write_smf_record: entered with type 16.<br />

CU1463 write_smf_record_119: entered with type 16.<br />

CU2241 write_smf_record: length of smfrecord: 224<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 41


Obtaining SMF data in real-time<br />

SMF <strong>Exit</strong>s<br />

IEFU83, IEFU84, IEFU85<br />

MVS Dynamic <strong>Exit</strong>s Facility allows multiple<br />

exits to co-exist<br />

z/OS CS Network Management Interface<br />

SYSTCPSM interface<br />

Type 119 SMF records only<br />

Requires “polling” – not as real-time as exits<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 42


Sample <strong>FTP</strong> Session 1<br />

ftp 137.72.43.243<br />

EZA1450I IBM <strong>FTP</strong> CS V2R8 1999 336 15:35 UTC<br />

EZA1554I Connecting to: 137.72.43.243 port: 21.<br />

220-<strong>FTP</strong>D1 IBM <strong>FTP</strong> CS V1R2 at p390.svo.test.<strong>com</strong>, 15:51:13 on 2002-08-16.<br />

220 Connection will close if idle for more than 5 minutes.<br />

EZA1459I NAME (137.72.43.243:P390):<br />

p390<br />

EZA1701I >>> USER p390<br />

331 Send password please.<br />

EZA1789I PASSWORD:<br />

EZA1701I >>> PASS<br />

230 P390 is logged on. Working directory is "AESDJC1.".<br />

EZA1460I Command:<br />

bin<br />

EZA1701I >>> TYPE I<br />

200 Representation type is Image<br />

EZA1460I Command:<br />

get 'aesdjc1.xmi' 'aesdjc1.xmi' (replace<br />

EZA1701I >>> PORT 137,72,43,240,6,139<br />

200 Port request OK.<br />

EZA1701I >>> RETR 'aesdjc1.xmi'<br />

125 Sending data set AESDJC1.XMI FIXrecfm 80<br />

250 Transfer <strong>com</strong>pleted successfully.<br />

EZA1617I 166400 bytes transferred in 2.180 seconds. Transfer rate 76.33 Kbytes<br />

/sec.<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 43


Sample <strong>FTP</strong> Session 1 – logging by<br />

<strong>FTP</strong> <strong>Exit</strong>s<br />

<strong>FTP</strong> OPEN CONNECTION,IP=137.72.43.240,PORT= 1674,TIME=14:51:13.67<br />

<strong>FTP</strong> CMD=USER ,USER= ,TIME=14:51:16.01,ARG=p390<br />

<strong>FTP</strong> CMD=PASS ,USER=P390 ,TIME=14:51:17.81,ARG=<br />

<strong>FTP</strong> LOGIN,USER=P390 ,TIME=14:51:17.81<br />

<strong>FTP</strong> CMD=TYPE ,USER=P390 ,TIME=14:51:23.03,ARG=I<br />

<strong>FTP</strong> CMD=PORT ,USER=P390 ,TIME=14:51:34.37,ARG=137,72,43,240,6,139<br />

<strong>FTP</strong> CMD=RETR ,USER=P390 ,TIME=14:51:34.40,ARG='aesdjc1.xmi'<br />

FTCHKIP<br />

FTCHKCMD<br />

FTCHKCMD<br />

FTCHKPWD<br />

FTCHKCMD<br />

FTCHKCMD<br />

FTCHKCMD<br />

<strong>FTP</strong> POST,CMD=RETR,USER=P390<br />

,IP=137.72.43.240,TYPE=MVS/SEQ,RC=250,REASON=0,TIME=14:51:36.93<br />

<strong>FTP</strong>OSTPR<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 44


Sample <strong>FTP</strong> Session 1<br />

How to interpret the PORT <strong>com</strong>mand<br />

PORT 137,72,43,240,6,139<br />

,6,139<br />

IP Address of the client: 137.72.43.240<br />

Port of the client: 256*6 + 139 = 1675<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 45


Sample <strong>FTP</strong> Session 1: Active <strong>FTP</strong><br />

<strong>FTP</strong> Client<br />

<strong>FTP</strong> <strong>Server</strong><br />

(137.72.43.240) (137.72.43.243)<br />

1674 PORT 1675 21<br />

ACK<br />

1675 connect 20<br />

ACK<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 46


Sample <strong>FTP</strong> Session 1 – <strong>FTP</strong> <strong>Server</strong><br />

SMF data<br />

<strong>FTP</strong>S:RETR,IP=137.72.43.240,PORT=21/1674,RC=250,<br />

User=P390,Format=S/S/I<br />

Format=S/S/I,ABND=<br />

Start=15:51:34,End=15:51:34,Bytes=166400,<br />

Elapsed=0.010sec,Throughput=16640.00KB/sec<br />

DSN1=AESDJC1.XMI/,DSN2=/<br />

Format:<br />

Data set type: P – partitioned, S – sequential, H – HFS<br />

Mode:<br />

S – stream, B – block, C – <strong>com</strong>pressed<br />

Data format:<br />

A – ASCII, E – EBCDIC, I – image (binary),<br />

D – double-byte, byte, U – UCS-2<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 47


Sample <strong>FTP</strong> Session 2<br />

EZA1460I Command:<br />

put 'aesdjc1.xmi' 'aesdjc1.small'<br />

EZA1701I >>> SITE FIXrecfm 80 LRECL=80 RECFM=FB BLKSIZE=3120<br />

200 SITE <strong>com</strong>mand was accepted<br />

EZA1701I >>> PORT 137,72,43,240,6,142<br />

200 Port request OK.<br />

EZA1701I >>> STOR 'aesdjc1.small'<br />

125 Storing data set AESDJC1.SMALL<br />

451-System <strong>com</strong>pletion code and reason: D37-04<br />

451-Data set is out of space.<br />

451 Transfer aborted due to file error.<br />

EZA1460I Command:<br />

quit<br />

EZA1701I >>> QUIT<br />

221 Quit <strong>com</strong>mand received. Goodbye.<br />

READY<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 48


Sample <strong>FTP</strong> Session 2 – logging by<br />

<strong>FTP</strong> <strong>Exit</strong>s<br />

<strong>FTP</strong> CMD=SITE ,USER=P390 ,TIME=14:53:28.45,ARG=FIXrecfm<br />

80 LRECL=80<br />

RECFM=FB BLKSIZE=3120<br />

<strong>FTP</strong> CMD=PORT ,USER=P390 ,TIME=14:53:28.50,ARG=137,72,43,240,6,142<br />

0,6,142<br />

<strong>FTP</strong> CMD=STOR ,USER=P390 ,TIME=14:53:28.52,ARG='aesdjc1.small'<br />

<strong>FTP</strong> POST,CMD=STOR,USER=P390<br />

,IP=137.72.43.240,TYPE=MVS/SEQ,RC=451,REASON=4<br />

REASON=4,TIME=14:53:29.61<br />

<strong>FTP</strong> REPLY=Transfer aborted due to file error.<br />

<strong>FTP</strong> CMD=QUIT ,USER=P390 ,TIME=14:53:31.48,ARG=<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 49


Sample <strong>FTP</strong> Session 2 – <strong>FTP</strong> <strong>Server</strong><br />

SMF Record<br />

<strong>FTP</strong>S:STOR,IP=137.72.43.240,PORT=21/1674,RC=451<br />

RC=451,<br />

User=P390,Format=S/S/I,ABND=<br />

Start=15:53:28,End=15:53:29,Bytes=166400,<br />

Elapsed=0.500sec,Throughput=332.80KB/sec<br />

DSN1=AESDJC1.SMALL/,DSN2=/<br />

Reply Code 451: Requested action aborted. Local<br />

error in processing.<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 50


Some Unique data in Type 119<br />

<br />

Self-defining sections (triplets)<br />

Number of data sections<br />

Offset to data sections<br />

Length of data sections<br />

<br />

TCP/IP identification section<br />

This is the first section in every type 119 record<br />

System name from SYSNAME in IEASYSxx<br />

Sysplex name from SYSPLEX in COUPLExx<br />

TCP/IP stack name, etc.<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 51


Some Unique data in Type 119<br />

All IP addresses are in 128-bit IPv6 format<br />

IPv4-mapped format:<br />

Bytes 0-9: 0<br />

X’00’<br />

Bytes 10-11:<br />

11: X’FF’<br />

Bytes 12-15:<br />

15: IPv4 address<br />

Has Both Control and Data Connection<br />

Session Info:<br />

Remote IP address and port number<br />

Local IP address and port number<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 52


Some Unique data in Type 119<br />

Transmission Start/End Date<br />

Transmission byte count format:<br />

64-bit integer<br />

z/OS floating point format<br />

<strong>FTP</strong> Client record has SOCKS section when<br />

data was transferred through a SOCKS<br />

server<br />

IP address and port number of SOCKS<br />

server for Control Connection<br />

SOCKS protocol version (v4 or v5)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 53


<strong>FTP</strong> <strong>Server</strong> Logging<br />

<br />

<br />

<br />

<br />

z/OS 1.4 or later release<br />

<strong>FTP</strong> <strong>Server</strong> can log activities to SyslogD via the<br />

following <strong>FTP</strong>.DATA options:<br />

<strong>FTP</strong>LOGGING TRUE<br />

ANONYMOUS<strong>FTP</strong>LOGGING TRUE<br />

Nine events are logged:<br />

CONN<br />

connectivity<br />

SECURE<br />

security (TLS/SSL, Kerberos)<br />

ACCESS<br />

login<br />

ALLOC<br />

file and data set allocation<br />

DEALL<br />

file and data set de-allocation<br />

TRANS<br />

file transfer<br />

SUBMIT<br />

JES job submission<br />

QUERY<br />

SQL query<br />

ABEND<br />

abnormal termination<br />

Each activity logging message has a message number<br />

within the range of EZYFS50 to EZYFS95<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 54


<strong>FTP</strong> <strong>Server</strong> Tracing<br />

<br />

<br />

<br />

<br />

TRACE run-time option for <strong>FTP</strong>D<br />

TRACE and DEBUG statements in <strong>FTP</strong>.DATA<br />

TRACE is equivalent to DEBUG BAS, which includes:<br />

DEBUG CMD<br />

DEBUG INT<br />

DEBUG FSC<br />

DEBUG SOC<br />

Use the SITE <strong>com</strong>mand to turn on tracing dynamically only for the duration<br />

of an <strong>FTP</strong> session<br />

Requires: DEBUGONSITE TRUE be specified in <strong>FTP</strong>.DATA<br />

z/OS example : site debug=bas<br />

MS/DOS example: quote site debug=bas<br />

Output in SYSLOG<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 55


CTRACE – Packet Tracing<br />

<br />

Set up External Writer Proc<br />

E.g., SYS1.PROCLIB(AESWRT):<br />

//IEFPROC EXEC PGM=ITTTRCWR,REGION=0K,TIME=1440,DPRTY=15<br />

//TRCOUT01 DD DISP=SHR,DSN=trace.dataset<br />

<br />

Set up tracing parameters<br />

E.g., SYS1.PARMLIB(CTAESPRM):<br />

TRACEOPTS ON WTR(AESWRT)<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 56


CTRACE – Packet Tracing<br />

<br />

<br />

<br />

To Start Tracing:<br />

<br />

<br />

<br />

<br />

TRACE CT,WTRSTART=AESWRT<br />

V TCPIP,,PKT,CLEAR<br />

V TCPIP,,PKT,LINKN=ETH1,ON,FULL,PROT=TCP,IP=<br />

TRACE CT,ON,COMP=SYSTCPDA,SUB=(TCPIP),PARM=CTAESPRM<br />

To View Tracing Status:<br />

<br />

<br />

D TRACE,WTR=AESWRT<br />

Verify that the external writer is active<br />

D TCPIP,,NETSTAT,DE<br />

Verify that TrRecCnt is non-zero and incrementing<br />

To Stop Tracing:<br />

<br />

<br />

<br />

V TCPIP,,PKT,OFF<br />

TRACE CT,OFF,COMP=SYSTCPDA,SUB=(TCPIP)<br />

TRACE CT,WTRSTOP=AESWRT,FLUSH<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 57


CTRACE – Packet Tracing<br />

Analyze one <strong>FTP</strong> session at a time<br />

Separate the Control Session from<br />

the Data Session<br />

Check <strong>FTP</strong> <strong>com</strong>mands and replies<br />

Look for packet retransmissions and<br />

unusual long response times<br />

TCP window size<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 58


Sample <strong>FTP</strong> Session 3<br />

<strong>FTP</strong> Session 3:<br />

ftp to 137.72.43.247<br />

logon on as p390<br />

use ASCII transfer mode<br />

get ‘AESDJC1.MAIN.CNTL(ASM)<br />

AESDJC1.MAIN.CNTL(ASM)’<br />

Quit<br />

<br />

Diagnostic Data Sources:<br />

<strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong>s<br />

<strong>FTP</strong> SMF Records<br />

<strong>FTP</strong>LOGGING<br />

Packet tracing<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 59


Data Source: <strong>FTP</strong> <strong>Server</strong> <strong>Exit</strong>s<br />

AES824I <strong>FTP</strong> OPEN CONNECTION,IP=137.72.43.64,PORT= 3068,TIME=17:13:11.39<br />

AES826I <strong>FTP</strong> CMD=USER ,USER= ,TIME=17:13:42.94<br />

17:13:42.94,ARG=p390<br />

AES826I <strong>FTP</strong> CMD=PASS ,USER=P390 ,TIME=17:13:45.39,ARG=<br />

AES825I <strong>FTP</strong> LOGIN,USER=P390 ,TIME=17:13:45.39<br />

AES826I <strong>FTP</strong> CMD=TYPE ,USER=P390 ,TIME=17:13:48.29,ARG=A<br />

AES826I <strong>FTP</strong> CMD=PORT ,USER=P390 ,TIME=17:13:56.34,ARG=137,72,43,64,12,6<br />

,72,43,64,12,6<br />

AES826I <strong>FTP</strong> CMD=RETR ,USER=P390 ,TIME=17:13:56.35,ARG='aesdjc1.main.cntl(asm)'<br />

AES827I <strong>FTP</strong> POST,CMD=RETR,USER=P390 ,IP=137.72.43.64,TYPE=MVS/SEQ,<br />

RC=250,REASON=0,TIME=17:13:57.10<br />

AES829I <strong>FTP</strong> POST,PORT=3068,DSN=AESDJC1.MAIN.CNTL(ASM),BYTES=0 gb + 2378 bytes<br />

AES839I <strong>FTP</strong> POST,SESSIONID=<strong>FTP</strong>D100005 ,CPU,<br />

TIME=0.567 SECONDS,EXCP=209<br />

AES826I <strong>FTP</strong> CMD=QUIT ,USER=P390 ,TIME=17:13:57.72,ARG=``<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 60


Data Source: <strong>FTP</strong> SMF <strong>Server</strong> Record<br />

AES801I <strong>FTP</strong>S:RETR,IP=137.72.43.64,PORT=21/3068,RC=250,User=P390<br />

,Format=P/S/A,ABND=<br />

AES802I Start=17:13:56,End=17:13:56,Bytes=2378,Elapsed=0.020sec,Throughput=118.90KB/sec<br />

AES803I DSN1=AESDJC1.MAIN.CNTL /ASM ,DSN2=<br />

/<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 61


Data Source: <strong>FTP</strong>LOGGING<br />

17:13:42.18 STC00404 00000090 BPXF024I (<strong>FTP</strong>D) Jul 20 21:13:42 ftpd 50397342 : EZYFS50I ID=<strong>FTP</strong>D100005<br />

191 00000090 CONN starts Client IPaddr=::ffff:137.72.43.64 hostname=UNKNOWN<br />

17:13:45.62 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:45 ftps 50397342 : EZYFS56I ID=<strong>FTP</strong>D100005<br />

192 00000090 ACCESS OK USERID=P390<br />

17:13:56.69 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:56 ftps 50397342 : EZYFS60I ID=<strong>FTP</strong>D100005<br />

193 00000090 ALLOC OK Use MVS DSN=AESDJC1.MAIN.CNTL(ASM)<br />

17:13:56.73 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:56 ftps 50397342 : EZYFS61I ID=<strong>FTP</strong>D100005<br />

194 00000090 ALLOC DDNAME=SYS00004 VOLSER=AES004 DSORG=PO DISP=(SHR,KEEP)<br />

17:13:56.85 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:56 ftps 50397342 : EZYFS70I ID=<strong>FTP</strong>D100005<br />

195 00000090 DEALL OK Release MVS DSN=AESDJC1.MAIN.CNTL(ASM)<br />

17:13:56.98 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:56 ftps 50397342 : EZYFS81I ID=<strong>FTP</strong>D100005<br />

196 00000090 TRANS MVS DSN=AESDJC1.MAIN.CNTL(ASM)<br />

17:13:57.02 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:57 ftps 50397342 : EZYFS84I ID=<strong>FTP</strong>D100005<br />

197 00000090 TRANS Stru=F Mode=S Type=A Output=2378 bytes<br />

17:13:57.06 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:57 ftps 50397342 : EZYFS80I ID=<strong>FTP</strong>D100005<br />

198 00000090 TRANS Reply=250 Transfer <strong>com</strong>pleted successfully.<br />

17:13:57.75 STC00404 00000090 BPXF024I (P390) Jul 20 21:13:57 ftps 50397342 : EZYFS52I ID=<strong>FTP</strong>D100005<br />

199 00000090 CONN ends Input=0 bytes Output=2378 bytes<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 62


Packet Trace Decoding – IPCS JCL<br />

//TSO EXEC PGM=IKJEFT01,DYNAMNBR=60,<br />

// PARM='%BLSCDDIR DSNAME(&SYSUID..BATCH.DDIR) VOLUME(AES003)'<br />

//SYSPROC DD DISP=SHR,DSN=SYS1.SBLSCLI0<br />

//TRACE DD DISP=SHR,DSN=trace.dataset<br />


Packet Trace Decoding – IPCS Output<br />

IPCS PRINT LOG FOR USER AESDJC1 1 17:15:42 07/20/04<br />

_____________________________________________________________________________________________________<br />

COMPONENT TRACE FULL FORMAT<br />

SYSNAME(P390)<br />

COMP(SYSTCPDA)SUBNAME((TCPIP))<br />

z/OS TCP/IP Packet Trace Formatter, (C) IBM 2000-2004, 2004, 2003.293<br />

FILE(TRACE')<br />

**** 2004/07/20<br />

RcdNr Sysname Mnemonic Entry Id Time Stamp Description<br />

----- -------- -------- -------- --------------- --------------------------------<br />

11 P390 PACKET 00000001 21:13:11.369759 Packet Trace<br />

From Interface : ETH1 Device: LCS Ethernet Full=48 F<br />

Tod Clock : 2004/07/20 21:13:11.369745<br />

Sequence # : 0 Flags: Pkt Ver2<br />

Source Port : 3068 Dest Port: 21 Asid: : 0034 TCB: 00000000<br />

IpHeader: : Version : 4 Header Length: 20<br />

Tos<br />

: 00 QOS: Routine Normal Service<br />

Packet Length : 48 ID Number: BEFD<br />

Fragment : DontFragment Offset: 0<br />

TTL : 128 Protocol: TCP CheckSum: : D202 FFFF<br />

Source : 137.72.43.64<br />

Destination : 137.72.43.247<br />

TCP<br />

Source Port : 3068 () Destination Port: 21 (ftp)<br />

Sequence Number : 834806980 Ack Number: 0<br />

Header Length : 28 Flags: Syn<br />

Window Size : 64240 CheckSum: : BBCF FFFF Urgent Data Pointer: 0000<br />

Option : Max Seg Size Len: 4 MSS: 1460<br />

Option : NOP<br />

Option : NOP<br />

Option : SACK Permitted<br />

IP Header : 20<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 64


Packet Trace – Unfiltered by Application Ports<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 65


Packet Trace – Filtered by Application Ports<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 66


Packet Trace – Zoom in on <strong>FTP</strong> Control Session<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 67


<strong>FTP</strong> Data Session: “connection reset by peer”<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 68


<strong>FTP</strong> Data Session: “connection reset by peer”<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 69


Packet Details<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 70


<strong>FTP</strong> Control Session: “451 transfer aborted”<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 71


<strong>FTP</strong> Control Session: exceptions<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 72


<strong>FTP</strong> Tuning<br />

Use the right Data Type (EBCDIC vs. ASCII)<br />

TCP Window Size: the maximum amount of data that<br />

can be in the network at any time for a single connection.<br />

Optimal TCP Window Size =<br />

Bottleneck Bandwidth * Round-trip Time (RTT)<br />

E.g., the slowest link=45 Mbit/sec, RTT=20ms<br />

45 Mbit/sec * 20ms<br />

= 45,000,000 bits/sec * .020 sec<br />

= 900,000 bits = 109.86 KBytes<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 73


<strong>FTP</strong> Tuning<br />

RTT<br />

Ping with default packet size; e.g., 256<br />

Ping with “average” <strong>FTP</strong> packet size<br />

SMF 119 TCP Connection Termination<br />

Record (RTT at time of connection close)<br />

Packet trace<br />

Window Size<br />

SMF 119 TCP Connection Termination<br />

Record<br />

Packet trace<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 74


SMF 119 TCP Connection Termination Record<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 75


How to Analyze <strong>FTP</strong><br />

Global usage patterns: How many <strong>FTP</strong>s does<br />

the installation run and when<br />

Heavy users: Typically may be responsible for<br />

80% of the workload<br />

Heavy data set usage: Often moved around or<br />

duplicates made for security and other<br />

redundancy reasons<br />

Failures: Who and Why<br />

<strong>FTP</strong> performance analysis: throughput<br />

Unauthorized attempts<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 76


<strong>FTP</strong> Analysis - Global Usage<br />

Patterns<br />

Total <strong>FTP</strong> sessions<br />

Total <strong>FTP</strong> bytes<br />

<strong>FTP</strong> server vs. <strong>FTP</strong> client activities<br />

When are heavy <strong>FTP</strong>s done?<br />

Are gigabyte file transfers done?<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 77


<strong>FTP</strong> Analysis - Heavy Data Set Usage<br />

Which data sets are most heavily used?<br />

Certain type? SEQ/ JES/ SQL?<br />

Can reposition or copy data sets for better<br />

performance?<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 78


<strong>FTP</strong> Analysis - Failures<br />

Are there any failures?<br />

Logon failure vs. data transfer failure<br />

When do failures occur?<br />

Who are the top failing clients?<br />

What are the top failing datasets?<br />

At a specific time of day?<br />

Correlated with heavy usage?<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 79


<strong>FTP</strong> Historical Trending and<br />

Analysis<br />

Number of server/client sessions<br />

Types of transfers (SEQ/SQL/JES)<br />

Amount of transfers<br />

Failures<br />

Heavy usage hours<br />

Throughput<br />

Workload analysis = proactive problem<br />

diagnostics<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 80


Additional Information<br />

Open source network protocol analyzer -<br />

Ethereal (www.ethereal.<strong>com</strong>(<br />

www.ethereal.<strong>com</strong>)<br />

IP Configuration Reference (SC31-8776)<br />

Sample <strong>FTP</strong> server exit code in SEZAINST:<br />

FTCHKCMD<br />

FTCHKIP<br />

FTCHKPWD<br />

<strong>FTP</strong>OSTPR<br />

Copyright (C) 2006 Applied Expert Systems, Inc. 81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!