13.07.2015 Views

FTP Analysis via SMF Records, FTP Server Exits ... - Aesclever.com

FTP Analysis via SMF Records, FTP Server Exits ... - Aesclever.com

FTP Analysis via SMF Records, FTP Server Exits ... - Aesclever.com

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>FTP</strong> <strong>Analysis</strong> <strong>via</strong> <strong>SMF</strong> <strong>Records</strong>, <strong>FTP</strong><strong>Server</strong> <strong>Exits</strong> and Logging, and CTRACESHARE Session 3753March 6, 2009David ChengApplied Expert Systems, Inc.davec@aesclever.<strong>com</strong>


Agenda<strong>FTP</strong> Background Data type, structure and mode Active <strong>FTP</strong> vs. Passive <strong>FTP</strong> <strong>FTP</strong> Commands and Replies<strong>FTP</strong> Diagnostic/Performance Data<strong>FTP</strong> <strong>Server</strong> <strong>Exits</strong><strong>FTP</strong> <strong>SMF</strong> <strong>Records</strong> – <strong>Server</strong>, ClientTCP Connection <strong>SMF</strong> <strong>Records</strong> – INIT, TERM<strong>SMF</strong> <strong>Exits</strong> vs. NMI SYSTCPSM<strong>FTP</strong> <strong>Server</strong> LoggingTracing <strong>FTP</strong> <strong>Server</strong> Trace IP packet trace, OSAENTA trace Packet Trace <strong>Analysis</strong><strong>FTP</strong> Diagnosis, Tuning and <strong>Analysis</strong>Copyright (C) 2009 Applied Expert Systems, Inc. 2


<strong>FTP</strong> Data Type – how data is interpretedby the receiver <strong>FTP</strong> always transfer data in 8-bit bytes; this is called the transfer size ASCII (TYPE A)Default data type Each line of data is terminated by CRLF (X’0D0A’)Translation is always required; even between 2 ASCII hosts:ASCII -> NVT-ASCII-> ASCII(NVT-ASCII : Network Virtual Terminal ASCII as defined in the TELNETprotocol.)If MVS is the receiving side, data will be translated to EBCDIC, CRLFreplaced with MVS record boundaries – according to SITE/LOCSITE parms:RECFM and LRECL EBCDIC (TYPE E) 8-bit EBCDIC bytes are transferred as they are – no translation IMAGE (TYPE I) Contiguous bits packed into the 8-bit <strong>FTP</strong> transfer byte sizeNormally used for binary data More efficient method to transfer data between 2 similar ASCII hostsCopyright (C) 2009 Applied Expert Systems, Inc. 3


<strong>FTP</strong> Data Structure – how data is storedby the receiver File (STRU F) Has no internal structure Contiguous sequence of bytes Most widely implemented Record (STRU R) File is made up of sequential records; ASCII type withCRLF sequences z/OS only supports Record structure with streammode transfer Page (STRU P) – not supported in z/OSCopyright (C) 2009 Applied Expert Systems, Inc. 4


<strong>FTP</strong> Data Mode – how data is transmitted Stream (MODE S)Transmitted as stream of bytes; with very little or no extraprocessing Block (MODE B) Transmitted as a series of data blocks, each block is precededby a header - count and descriptor z/OS only supports Block mode with data type EBCDIC A file transferred between 2 z/OS systems in Block mode willpreserve its record structure (e.g., variable length records) Compress (MODE C)Transmitted in a <strong>com</strong>pressed format Simple <strong>com</strong>pression algorithm – send duplicated bytes in a two-byte sequence, followed by a one-byte filler In z/OS Compress requires data type EBCDICCopyright (C) 2009 Applied Expert Systems, Inc. 5


Control / Data ConnectionsControl connection A <strong>com</strong>munication path between the Client and <strong>Server</strong> for theexchange of <strong>com</strong>mands & replies <strong>FTP</strong> <strong>Server</strong> Port 21 Connection stays up during the whole session, in whichmany files may be transferredData connection A full duplex connection over which data is transferred, in aspecified mode and type <strong>FTP</strong> <strong>Server</strong> Port 20 (for active <strong>FTP</strong>) Usually one for each file transferCopyright (C) 2009 Applied Expert Systems, Inc. 6


Active <strong>FTP</strong><strong>Server</strong> initiates data connection to the client Client connects from a random unprivileged port (N >1024) to the <strong>FTP</strong> server’s port 21Client starts listening to port N+1 and sends the <strong>FTP</strong><strong>com</strong>mand PORT N+1 to the <strong>FTP</strong> serverPORT h1,h2,h3,h4,p1,p2h1,h2,h3,h4 is the client’s IP address, p1,p2 is the clientport number in an 8 bit high, low bit orderThe <strong>Server</strong> will then connect back to the client’s specifieddata port from its local data port (port 20)Copyright (C) 2009 Applied Expert Systems, Inc. 7


Active <strong>FTP</strong><strong>FTP</strong> Client<strong>FTP</strong> <strong>Server</strong>1674 PORT 1675 21ACK1675 connect 20ACKCopyright (C) 2009 Applied Expert Systems, Inc. 8


<strong>FTP</strong> Active Mode in Detail<strong>FTP</strong> ClientPort XPort XPort XPort XPort XPort XPort YPort YPort YPort Y<strong>FTP</strong> <strong>Server</strong>SYN Port 21SYN ACK Port 21ACK Port 21PORT, IP address, port Y Port 21PORT <strong>com</strong>mand successful Port 21LIST, RETR, or STOR, etc. Port 21SYN Port 20SYN ACK Port 20ACK Port 20Data segments and ACKs Port 20Copyright (C) 2009 Applied Expert Systems, Inc. 9


Passive <strong>FTP</strong> Client initiates data connection to the server Firewall friendly When opening an <strong>FTP</strong> connection, the client opens 2random unprivileged ports locally (N > 1024 and N+1) The first port contacts the server on port 21 Client issues the PASV <strong>com</strong>mand (the PASV <strong>com</strong>mandtakes no parameters) The server then opens a random port and sends ReplyCode 227 back to the client (similar to the PORT<strong>com</strong>mand) The client then initiates the connection from port N+1 toport P on the server to transfer dataCopyright (C) 2009 Applied Expert Systems, Inc. 10


Passive <strong>FTP</strong><strong>FTP</strong> Client<strong>FTP</strong> <strong>Server</strong>1673 PASV 21“227 Entering Passive Mode (IP Addr, Port #)”1674 connect 2020ACKCopyright (C) 2009 Applied Expert Systems, Inc. 11


<strong>FTP</strong> Passive Mode in Detail<strong>FTP</strong> Client<strong>FTP</strong> <strong>Server</strong>Port XSYN Port 21Port X SYN ACK Port 21Port XACK Port 21Port XPort XPort ZPort ZPort ZPort XPort ZPASV Port 21RC 227, IP address, Port Y Port 21SYNPort YSYN ACKPort YACKPort YLIST, RETR, or STOR, etc. Port 21Data segments and ACKsPort YCopyright (C) 2009 Applied Expert Systems, Inc. 12


<strong>FTP</strong> CommandsCommands and Replies are sent across the controlconnection and are in plain text.Commands are 3 or 4 bytes characters, each withoptional parameters.The <strong>FTP</strong> <strong>com</strong>mands specify the parameters for: the data connection (port) transfer mode data representation type and structure the nature of file system operation (store, retrieve,append, delete, etc.)Copyright (C) 2009 Applied Expert Systems, Inc. 13


Sample <strong>FTP</strong> CommandsAccess Control:ABOR Abort a file transferUSERUser identification PORTData port specification QUITTerminates a user and the control connectionTransfer:TYPE STRUMODE RETR STORData representation (ASCII, EBCDIC, Image)Transfer structure (File, Record, Page)Transfer mode (Stream, Block, Compress)<strong>Server</strong> -> Client file transferClient -> <strong>Server</strong> file transferService:DELEDeletes a <strong>Server</strong> fileLIST Directory listingRNFRRenames from RNTO Renames to (RNFR must be immediately followed by a RNTO <strong>com</strong>mand)Copyright (C) 2009 Applied Expert Systems, Inc. 14


<strong>FTP</strong> Replies Synchronization of requests and actions in the filetransfer process Guarantee that the user process always knows the stateof <strong>Server</strong>Every <strong>com</strong>mand must generate at least one reply An <strong>FTP</strong> reply consists of a 3-digit number (i.e., 3alphanumeric characters) followed by some text The number is intended for use by the software todetermine what to do next; the text is intended for thehuman user There may be more than one reply, in which case thesemultiple replies must be easily distinguishedCopyright (C) 2009 Applied Expert Systems, Inc. 15


<strong>FTP</strong> Reply Code1yz2yz3yz4yz5yzPositive preliminary replyPositive <strong>com</strong>pletion reply (a new <strong>com</strong>mand may be sent)Positive intermediate reply (another <strong>com</strong>mand must be sent)Transient negative reply (<strong>com</strong>mand can be re- issued later)Permanent negative reply (<strong>com</strong>mand should not be retried)x0zx1zx2zx3zx4zx5zSyntax errorInformationConnectionsAuthentication and accountingUnspecifiedFile system statusCopyright (C) 2009 Applied Expert Systems, Inc. 16


Sample <strong>FTP</strong> Reply Codes 150 File status okay; about to open data connection. 226 Transfer <strong>com</strong>plete 227 Entering passive mode {h1,h2,h3,h4,p1,p2} 250 Requested file action okay, <strong>com</strong>pleted. 257 "PATHNAME" created. 350 Requested file action pending further information. 450 Requested file action not taken. File unavailable (e.g., file busy). 550 Requested action not taken. File unavailable (e.g., file notfound, no access). 451 Requested action aborted. Local error in processing. 551 Requested action aborted. Page type unknown. 452 Requested action not taken. Insufficient storage space insystem. 552 Requested file action aborted. Exceeded storage allocation (forcurrent directory or data set). 553 Requested action not taken.Copyright (C) 2009 Applied Expert Systems, Inc. 17


C:\Windows>ftp 137.72.43.247Connected to 137.72.43.247.220-<strong>FTP</strong>D1 IBM <strong>FTP</strong> CS V1R7 at os17.aesclever.<strong>com</strong>, 21:05:48on 2006-0707-20.220 Connection will close if idle for more than 5 minutes.User (137.72.43.207:(none)): p390331 Send password please.Password:RC 220RC 331Service ready for new user- : continuationUser name OK, need passwordCopyright (C) 2009 Applied Expert Systems, Inc. 18


<strong>FTP</strong> VulnerabilitiesUser ID and Password are sent in clear text<strong>FTP</strong> Bounce Attack Arbitrary IP and port can be specified in the PORT<strong>com</strong>mand – this allows an attacker to open a (data)connection to a port on a machine that’s not theoriginal client Port scanning Bypass firewallsTo Control PORT or EPRT <strong>com</strong>mand:PORTCOMMAND ACCEPT | REJECTPORTCOMMANDIPADDR UNRESTRICTED | NOREDIRECTPORTCOMMANDPORT UNRESTRICTED | NOLOWPORTS(ports < 1024)Copyright (C) 2009 Applied Expert Systems, Inc. 19


<strong>FTP</strong> Diagnostics/Performance DataConnection attemptsLogon failuresClient identificationActive vs. Passive <strong>FTP</strong><strong>FTP</strong> <strong>com</strong>mands<strong>FTP</strong> repliesThroughputData can also be used as audit trail and for monitoringsecurity breaches.Copyright (C) 2009 Applied Expert Systems, Inc. 20


<strong>FTP</strong> Diagnostics/Performance Data Published Record Types or API Non-intrusive, lower overhead Event-driven True real-time data <strong>FTP</strong> <strong>Server</strong> exits and <strong>SMF</strong> exits Waiting/”Polling” Comm <strong>Server</strong> Network Management API(<strong>SMF</strong> 119 only) TCP/IP session <strong>SMF</strong> data is not availableCopyright (C) 2009 Applied Expert Systems, Inc. 21


<strong>FTP</strong> Diagnostics/Performance Data<strong>FTP</strong> <strong>Server</strong> <strong>Exits</strong> FTCHKIP – open connection (invoked by <strong>FTP</strong> daemon) FTCHKPWD – password verification FTCHKCMD – <strong>FTP</strong> <strong>com</strong>mand<strong>FTP</strong>OSTPR – <strong>FTP</strong> <strong>com</strong>mand <strong>com</strong>pletion FTCHKJES – Job submission<strong>FTP</strong><strong>SMF</strong>EX – <strong>FTP</strong> server <strong>SMF</strong> record <strong>SMF</strong> records (Type 118 or 119)<strong>FTP</strong> <strong>Server</strong> Logon Failure<strong>FTP</strong> <strong>Server</strong> Transfer Completion<strong>FTP</strong> Client Transfer CompletionTCP Connection InitiationTCP Connection TerminationCopyright (C) 2009 Applied Expert Systems, Inc. 22


<strong>FTP</strong> Diagnostics/Performance Data Logging/Tracing <strong>FTP</strong> <strong>Server</strong> <strong>FTP</strong>LOGGING ANONYMOUS<strong>FTP</strong>LOGGING TRACE, DEBUG Packet trace – detailed analysis at protocol level NOT for monitoring purpose Performance penalty (e.g., APAR PQ84192)Copyright (C) 2009 Applied Expert Systems, Inc. 23


<strong>FTP</strong> <strong>Server</strong> User <strong>Exits</strong>R1 -> parameter list, which is a series of pointers to valuesThe first word of the parameter list always points to thereturn code (RC). RC=0 upon entry to an exit. If RC is not0, user will receive a negative replyThe second word of the parameter list always points to aword containing the number of parameters that followAPF-authorizedSTEPLIB DD in the <strong>FTP</strong>D procRACF considerationSample code in TCPIP.SEZAINSTCopyright (C) 2009 Applied Expert Systems, Inc. 24


<strong>FTP</strong> <strong>Server</strong> Exit - FTCHKIPFTCHKIP is called at the initial stage of login orwhenever the user issues an OPEN <strong>com</strong>mand Client’s IP address (IPV4) and port <strong>Server</strong>’s IP address (IPV4) and port Socket address structure (IPV4 or IPV6) for theclient’s control conneciton Socket address structure (IPV4 or IPV6) for theserver’s control connection Session IDSecurity Control: control <strong>FTP</strong> access by IP addressCopyright (C) 2009 Applied Expert Systems, Inc. 25


<strong>FTP</strong> <strong>Server</strong> Exit - FTCHKPWDFTCHKPWD is called after the user enters the password Client’s user ID Client’s password User data Number of bad passwords input in this logon attempt Socket address structure for the client’s controlconnection Socket address structure for the server’s controlconnection Session IDSecurity Control: Control <strong>FTP</strong> access by User IDCopyright (C) 2009 Applied Expert Systems, Inc. 26


<strong>FTP</strong> <strong>Server</strong> Exit - FTCHKCMDFTCHKCMD is called whenever the client enters a<strong>com</strong>mand Client’s user ID Command Command parameters Current directory type: MVS, HFS File type: SEQ, JES, SQL Current working directory Address of a buffer for <strong>com</strong>mand modificationSecurity Control: Control <strong>FTP</strong> access by <strong>FTP</strong> <strong>com</strong>mandor file name, etc.Copyright (C) 2009 Applied Expert Systems, Inc. 27


<strong>FTP</strong> <strong>Server</strong> Exit - <strong>FTP</strong>OSTPR<strong>FTP</strong>OSTPR is called upon <strong>com</strong>pletion of the <strong>FTP</strong> <strong>com</strong>mands RETR,STOR, STOU, APPE, DELE, and RNTOClient’s user IDClient’s IP addressClient’s portCurrent directory type: MVS, HFSCurrent working directoryCurrent file type: SEQ, JES, SQL<strong>FTP</strong> reply code<strong>FTP</strong> reply string<strong>FTP</strong> <strong>com</strong>mand codeCurrent CONDDISP setting: C for catalog, D for deleteCopyright (C) 2009 Applied Expert Systems, Inc. 28


<strong>FTP</strong> <strong>Server</strong> Exit - <strong>FTP</strong>OSTPRClose reason code: 0 – transfer <strong>com</strong>pleted normally 4 – transfer <strong>com</strong>pleted w/errorsee <strong>FTP</strong> reply code and text string 8 – transfer <strong>com</strong>pleted w/socket erros 12 – transfer aborted 16 – transfer aborted w/SQL file errorsDataset name or HFS file nameBytes transferredSocket address structure for the client’s control sessionSocket address structure for the server’s control sessionSession IDAddress of scratch pad area (256 bytes)Copyright (C) 2009 Applied Expert Systems, Inc. 29


<strong>FTP</strong> <strong>Server</strong> Exit - <strong>FTP</strong><strong>SMF</strong>EX<strong>FTP</strong><strong>SMF</strong>EX is called before a type 118 <strong>SMF</strong> (<strong>FTP</strong>server) record is written to <strong>SMF</strong>Type 119 <strong>SMF</strong> records must use the system-wide <strong>SMF</strong>exits: IEFU83, IEFU84 , (IEFU85)R1 -> the following parameter list: Pointer to the return code Pointer to the type 118 <strong>SMF</strong> record On entry, the return code is set to 0. A return code of 0specifies that the <strong>SMF</strong> record will be writtenCopyright (C) 2009 Applied Expert Systems, Inc. 30


<strong>FTP</strong> <strong>Server</strong> Exit Installation APF-authorize the load library Add the load library to STEPLIB in the <strong>FTP</strong>Dproc If RACF Program Control is active: SETROPTSWHEN(PROGRAM), you must define <strong>FTP</strong> exitsto RACF class PROGRAM Restart the <strong>FTP</strong> Daemon (for FTCHKIP)Copyright (C) 2009 Applied Expert Systems, Inc. 31


<strong>FTP</strong> <strong>Server</strong> Exit InstallationSample RACF Definition for FTCHKIP:RDEFINE PROGRAM FTCHKIPADDMEM(‘loadlib’loadlib’/volser/NOPADCHK) UACC(READ)…SETR WHEN(PROGRAM) REFRESHWithout proper RACF definition, <strong>FTP</strong> client will get thefollowing error when logging in:550 PASS COMMAND FAILED - _PASSWD() ERROR: EDC5157I ANINTERNAL ERROR OCURREDCopyright (C) 2009 Applied Expert Systems, Inc. 32


Verify <strong>FTP</strong> <strong>Server</strong> <strong>Exits</strong> Start the <strong>FTP</strong> <strong>Server</strong> with the “TRACE”parameter; e.g., S <strong>FTP</strong>D,PARM=TRACE Check for the following messages in SYSLOG:BPXF024I (<strong>FTP</strong>D) Jan 5 18:01:34 ftpd 33619980 : DM1009 main:FTCHKIP successfully loadedBPXF024I (AESDJC1) Jan 6 02:01:57 ftps 16843115 : RX0625 main:chkpwdexit successfully loadedBPXF024I (AESDJC1) Jan 6 02:01:58 ftps 16843115 : RX0641 main:chkcmdexit successfully loadedBPXF024I (AESDJC1) Jan 6 02:01:58 ftps 16843115 : RX0696 main:<strong>FTP</strong>OSTPR successfully loadedCopyright (C) 2009 Applied Expert Systems, Inc. 33


<strong>FTP</strong> <strong>Server</strong> Transfer Completion <strong>SMF</strong> Record<strong>FTP</strong> <strong>com</strong>mand<strong>FTP</strong> type: SEQ, JES, SQLClient IP address and port<strong>Server</strong> IP address and portLocal user IDData format:A: ASCIIE: EBCDICI: image (binary)D: double byteU: UCS-2Data Structure: File or RecordTransmission mode – S: stream, B: block. C : <strong>com</strong>pressedStart/End time of transmissionBytes transferred<strong>FTP</strong> reply codeDataset/member/file namesFile transmission durationCopyright (C) 2009 Applied Expert Systems, Inc. 34


<strong>FTP</strong> Client Transfer Completion <strong>SMF</strong> Record<strong>FTP</strong> <strong>com</strong>mandClient IP address and port<strong>Server</strong> IP address and portData formatData StructureTransmission modeStart/End time of transmissionByte countDataset/file name File transmission durationCopyright (C) 2009 Applied Expert Systems, Inc. 35


Enable TCP/IP <strong>SMF</strong> Recording <strong>SMF</strong>PRMxx – make sure that 118/119 is notbeing excluded from recording <strong>SMF</strong> Type 119 is available only in z/OS V1R2and later releases <strong>SMF</strong> Type 118 and Type 119 can co-exist To get <strong>FTP</strong> <strong>Server</strong> <strong>SMF</strong> record, configure <strong>FTP</strong>DATA as follows: 118: <strong>SMF</strong> STD 119: <strong>SMF</strong> TYPE119Copyright (C) 2009 Applied Expert Systems, Inc. 36


Enable TCP/IP Session <strong>SMF</strong> RecordingTo get <strong>FTP</strong> Client <strong>SMF</strong> record, configure TCP/IP PROFILE asfollows:<strong>SMF</strong>CONFIG TYPE119 <strong>FTP</strong>CLIENT …To get TCP INIT and TERM <strong>SMF</strong> records:<strong>SMF</strong>CONFIG TYPE119 TCPINIT TCPTERM …Do not collect duplicate records; either 118 or 119 (re<strong>com</strong>mended)TERM records are “better” than INIT records: more informationCopyright (C) 2009 Applied Expert Systems, Inc. 37


Verify <strong>SMF</strong> RecordingSystem Level – issue the D <strong>SMF</strong>,O operator <strong>com</strong>mand, verify: <strong>SMF</strong>PRMxx member <strong>SMF</strong> parametersTCP/IP Level – issue the NETSTAT,CONFIG <strong>com</strong>mandCheck the <strong>SMF</strong> Parameters listing; e.g.,<strong>SMF</strong> Parameters:Type 118:TcpInit: 00 TcpTerm: 00 <strong>FTP</strong>Client: 00TN3270Client: 00 TcpIpStats: 00Type 119:TcpInit: Yes TcpTerm: Yes <strong>FTP</strong>Client: YesTcpIpStats: Yes IfStats: Yes PortStats: YesStack: Yes UdpTerm: Yes TN3270Client: YesCopyright (C) 2009 Applied Expert Systems, Inc. 38


Verify <strong>SMF</strong> Recording<strong>FTP</strong> <strong>Server</strong> – start the <strong>FTP</strong> server with the “TRACE” parameter;e.g., S <strong>FTP</strong>D,PARM=TRACELook for the write_smf_record messages; e.g.,250 Transfer <strong>com</strong>pleted successfully.BPXF024I (AESDJC1) Jan 6 02:02:08 ftps 16843115 : RU1463write_smf_record: entered with type 4BPXF024I (AESDJC1) Jan 6 02:02:08 ftps 16843115 : RU0754write_smf_record_119: entered with type 4.<strong>FTP</strong> Client – start the <strong>FTP</strong> client with the “trace” parameter, or issue the“debug” <strong>com</strong>mand from an <strong>FTP</strong> client session;e.g., ftp 137.72.43.247 (traceLook for the following messages: CU1963, CU1463, CU2241; e.g.,250 Transfer <strong>com</strong>pleted successfully.EZA1617I 2320 bytes transferred in 0.160 seconds. Transferrate 14.50 Kbytes/sec.CU1963 write_smf_record: entered with type 16.CU1463 write_smf_record_119: entered with type 16.CU2241 write_smf_record: length of smfrecord: 224Copyright (C) 2009 Applied Expert Systems, Inc. 39


Obtaining <strong>SMF</strong> data in real-time – <strong>SMF</strong> <strong>Exits</strong><strong>SMF</strong> <strong>Exits</strong> - receives control when caller invokes the macro towrite <strong>SMF</strong> records; Supervisor state, KEY 0 IEFU83 – <strong>SMF</strong>WTM, BRANCH=NO <strong>FTP</strong> <strong>Server</strong> <strong>SMF</strong> TCP/IP Session <strong>SMF</strong> (INIT and TERM) IEFU84 – <strong>SMF</strong>WTM, BRANCH=YES <strong>FTP</strong> Client <strong>SMF</strong> IEFU85 – <strong>SMF</strong>EWTM, BRANCH=YES MODE=XMEM, andASCB != home primary ASID.IEFU85 cannot issue any SVC MVS Dynamic <strong>Exits</strong> Facility allows multiple exits to co-existCopyright (C) 2009 Applied Expert Systems, Inc. 40


Installing <strong>SMF</strong> <strong>Exits</strong>Specify <strong>SMF</strong> <strong>Exits</strong> in <strong>SMF</strong>PRMxxBy default, ALL exits are invokedIf EXITS is specified on a SUBSYS for STC, OMVS, TSO or JES2, specify IEFU83,IEFU84 and IEFU85 on the EXITS parameterE.g, SUBSYS(STCSTC,EXITS(IEFU83,IEFU84,IEFU85,IEFACTRT))Specify <strong>SMF</strong> <strong>Exits</strong> to the Dynamic <strong>Exits</strong> FacilityDefine PROGxx in SYS1.PARMLIBEXIT ADD EXITNAME(SYS.IEFU83) MODNAME(module) DSNAME(dsn)EXIT ADD EXITNAME(SYSSTC.IEFU83) MODNAME(module) DSNAME(dsn)Issue the SET PROG=xx <strong>com</strong>mandVerify <strong>SMF</strong> <strong>Exits</strong>D PROG,EXITD PROG,EXIT,EX=SYS.IEFU83,DIAGCSV464I 21.37.38 PROG,EXIT DISPLAY 109EXIT SYS.IEFU83MODULE STATE EPADDR LOADPT LENGTH JOBNAMEIEFU83 A 838CA518 00000000 00000000 *AES<strong>SMF</strong>00 A 8FFB66F8 0FFB66F8 00000908 *Copyright (C) 2009 Applied Expert Systems, Inc. 41


Obtaining <strong>SMF</strong> data in real-time - NMI z/OS CS Network Management Interface (NMI) z/OS 1.4 w/APAR II13699, z/OS 1.5 or later SYSTCPSM interface Type 119 <strong>SMF</strong> records: <strong>FTP</strong> <strong>Server</strong>/Client, TN3270 <strong>Server</strong> andTSO Telnet Client TCP Connection records Requires waiting/”polling” – not as real-time as<strong>SMF</strong> exitsCopyright (C) 2009 Applied Expert Systems, Inc. 42


SYSTCPSM NMI SAF authorization for the SERVAUTH classEZB.NETMGMT.sysname.tcpprocname.SYSTCPSMEZB.NETMGMT.sysname.tcpprocname.SYSTCPSM profile TCP/IP Profile NETMONITOR ONor NETMONITOR … <strong>SMF</strong>SERVICE Connect to the AF_UNIX socket descriptor:/varvar/sock/SYSTCPSM.


SYSTCPSM Service Use the EZBTMIC1 service (in SYS1.CSSLIB) tocopy the data into application buffer Caller must be APF authorized Input is the token record received fromSYSTCPSM NMI Data is copied to application buffer as CTE(Component Trace Element) records: ,…For more info: “Comm <strong>Server</strong> IP Programmer’s Guide and Ref.”Copyright (C) 2009 Applied Expert Systems, Inc. 44


Sample <strong>FTP</strong> Session 1ftp 137.72.43.207EZY2640I Using 'TCPIP.<strong>FTP</strong>.DATA' for local site configuration parameters.EZA1450I IBM <strong>FTP</strong> CS V1R7EZA1554I Connecting to: 137.72.43.207 port: 21.220-<strong>FTP</strong>D1 IBM <strong>FTP</strong> CS V1R6 at OS16.AESCLEVER.COM, 14:51:31 on 2007-02-09.220 Connection will not timeout.EZA1459I NAME (137.72.43.207:AESDJC1):p390EZA1701I >>> USER p390331 Send password please.EZA1789I PASSWORD:EZA1701I >>> PASS230 P390 is logged on. Working directory is "AESDJC1.".EZA1460I Command:binEZA1701I >>> TYPE I200 Representation type is ImageEZA1460I Command:get 'aesdjc1.xmi' 'aesdjc1.xmi' (replaceEZA1701I >>> PORT 137,72,43,240,6,139200 Port request OK.EZA1701I >>> RETR 'aesdjc1.xmi'125 Sending data set AESDJC1.XMI FIXrecfm 80250 Transfer <strong>com</strong>pleted successfully.EZA1617I 166400 bytes transferred in 2.180 seconds. Transfer rate 76.33 Kbytes/sec.Copyright (C) 2009 Applied Expert Systems, Inc. 45


Sample <strong>FTP</strong> Session 1 – logging by<strong>FTP</strong> <strong>Exits</strong><strong>FTP</strong> OPEN CONNECTION,IP=137.72.43.240,PORT= 1674,TIME=14:51:13.67<strong>FTP</strong> CMD=USER ,USER= ,TIME=14:51:16.01,ARG=p390<strong>FTP</strong> CMD=PASS ,USER=P390 ,TIME=14:51:17.81,ARG=<strong>FTP</strong> LOGIN,USER=P390 ,TIME=14:51:17.81<strong>FTP</strong> CMD=TYPE ,USER=P390 ,TIME=14:51:23.03,ARG=I<strong>FTP</strong> CMD=PORT<strong>FTP</strong> CMD=RETR,USER=P390 ,TIME=14:51:34.37,ARG=137,72,43,240,6,139,USER=P390 ,TIME=14:51:34.40,ARG='aesdjc1.xmi'FTCHKIPFTCHKCMDFTCHKCMDFTCHKPWDFTCHKCMDFTCHKCMDFTCHKCMD<strong>FTP</strong> POST,CMD=RETR,USER=P390,IP=137.72.43.240,TYPE=MVS/SEQ,RC=250,REASON=0,TIME=14:51:36.93SESSIONID=<strong>FTP</strong>D100011, CPU TIME=0.829<strong>FTP</strong>OSTPRCopyright (C) 2009 Applied Expert Systems, Inc. 46


Sample <strong>FTP</strong> Session 1How to interpret the PORT <strong>com</strong>mandPORT 137,72,43,240,6,139,6,139IP Address of the client: 137.72.43.240Port of the client: 256*6 + 139 = 1675Copyright (C) 2009 Applied Expert Systems, Inc. 47


Sample <strong>FTP</strong> Session 1: Active <strong>FTP</strong><strong>FTP</strong> Client<strong>FTP</strong> <strong>Server</strong>(137.72.43.240) (137.72.43.207)1674 PORT 1675 21ACK1675 connect 20ACKCopyright (C) 2009 Applied Expert Systems, Inc. 48


Sample <strong>FTP</strong> Session 1 – <strong>FTP</strong> <strong>Server</strong><strong>SMF</strong> data<strong>FTP</strong>S:RETR,IP=137.72.43.240,PORT=21/1674,RC=250,User=P390,Format=S/S/IFormat=S/S/I,ABND=Start=15:51:34,End=15:51:34,Bytes=166400,Elapsed=0.010sec,Throughput=16640.00KB/secDSN1=AESDJC1.XMI/,DSN2=/Format:Data set type: P – partitioned, S – sequential, H – HFSMode: S – stream, B – block, C – <strong>com</strong>pressedData format:A – ASCII, E – EBCDIC, I – image (binary),D – double-byte, byte, U – UCS-2Copyright (C) 2009 Applied Expert Systems, Inc. 49


Sample <strong>FTP</strong> Session 2EZA1460I Command:put 'aesdjc1.xmi' 'aesdjc1.small'EZA1701I >>> SITE FIXrecfm 80 LRECL=80 RECFM=FB BLKSIZE=3120200 SITE <strong>com</strong>mand was acceptedEZA1701I >>> PORT 137,72,43,240,6,142200 Port request OK.EZA1701I >>> STOR 'aesdjc1.small'125 Storing data set AESDJC1.SMALL451-System <strong>com</strong>pletion code and reason: D37-04451-Data set is out of space.451 Transfer aborted due to file error.EZA1460I Command:quitEZA1701I >>> QUIT221 Quit <strong>com</strong>mand received. Goodbye.READYCopyright (C) 2009 Applied Expert Systems, Inc. 50


Sample <strong>FTP</strong> Session 2 – logging by<strong>FTP</strong> <strong>Exits</strong><strong>FTP</strong> CMD=SITE ,USER=P390 ,TIME=14:53:28.45,ARG=FIXrecfm 80 LRECL=80RECFM=FB BLKSIZE=3120<strong>FTP</strong> CMD=PORT ,USER=P390 ,TIME=14:53:28.50,ARG=137,72,43,240,6,142<strong>FTP</strong> CMD=STOR ,USER=P390 ,TIME=14:53:28.52,ARG='aesdjc1.small'<strong>FTP</strong> POST,CMD=STOR,USER=P390,IP=137.72.43.240,TYPE=MVS/SEQ,RC=451,REASON=4,TIME=14:53:29.61<strong>FTP</strong> REPLY=Transfer aborted due to file error.<strong>FTP</strong> CMD=QUIT ,USER=P390 ,TIME=14:53:31.48,ARG=Copyright (C) 2009 Applied Expert Systems, Inc. 51


Sample <strong>FTP</strong> Session 2 – <strong>FTP</strong> <strong>Server</strong><strong>SMF</strong> Record<strong>FTP</strong>S:STOR,IP=137.72.43.240,PORT=21/1674,RC=451RC=451,User=P390,Format=S/S/I,ABND=Start=15:53:28,End=15:53:29,Bytes=166400,Elapsed=0.500sec,Throughput=332.80KB/secDSN1=AESDJC1.SMALL/,DSN2=/Reply Code 451: Requested action aborted. Local error inprocessing.Copyright (C) 2009 Applied Expert Systems, Inc. 52


<strong>SMF</strong> 119 TCP Connection Termination and <strong>FTP</strong> <strong>Server</strong> RecordCopyright (C) 2009 Applied Expert Systems, Inc. 53


CleverView(TM) for TCP/IP BatchPRTCP Session RTT ReportAPPLIED EXPERT SYSTEMS, INC.System: OS16 Sysplex: ADCDPL TCP/IP Stack: TCPIPDate: 10/14/2005 (2005.287)Shift: 4, From: 18:00 To: 20:00# Round Trip Time (ms) Segments SegmentsLOCATION Remote IP AddrApplSessions Avg / Std Dev / Min / Max In Out======== =============== ======== ========== ============================ ============ ============AES2 137.72.43.239AESTCP80 237 3.09 15.119 0 174 475 741<strong>FTP</strong>D1 87 26.64 56.467 1 275 129 257HTTPD1 79 1.85 6.522 0 59 130 238NPMTCPI5 16 0.50 0.500 0 1 40 56TCPIP 87 5.00 32.140 0 301 94 217506 7.19 30.318 0 301 868 1509HOST16 137.72.43.252AESTCP80 79 9.28 44.817 3 404 158 237TCPIP 14 5.29 4.131 3 20 28 4293 8.68 41.362 3 404 186 279SUBNET1 137.72.43.*AESTCP80 316 4.64 26.091 0 404 633 978<strong>FTP</strong>D1 87 26.64 56.467 1 275 129 257HTTPD1 79 1.85 6.522 0 59 130 238NPMTCPI5 16 0.50 0.500 0 1 40 56TCPIP 103 5.49 29.919 0 301 3378 3964601 7.49 32.281 0 404 4310 5493# Round Trip Time (ms) Segments SegmentsApplSessions Avg / Std Dev / Min / Max In Out======== ========== ============================ ============ ============AESTCP80 316 4.64 26.091 0 404 633 978<strong>FTP</strong>D1 87 26.64 56.467 1 275 129 257HTTPD1 79 1.85 6.522 0 59 130 238NPMTCPI5 16 0.50 0.500 0 1 40 56TCPIP 103 5.49 29.896 0 301 3378 3964Copyright (C) 2009 Applied Expert Systems, Inc. 54


<strong>FTP</strong> <strong>Server</strong> Loggingz/OS 1.4 or later release<strong>FTP</strong> <strong>Server</strong> can log activities to SyslogD <strong>via</strong> thefollowing <strong>FTP</strong>.DATA options: <strong>FTP</strong>LOGGING TRUE ANONYMOUS<strong>FTP</strong>LOGGING TRUENine events are logged: CONNconnectivitySECUREsecurity (TLS/SSL, Kerberos)ACCESSlogin ALLOCfile and data set allocation DEALLfile and data set de-allocationTRANS file transfer SUBMITJES job submission QUERYSQL queryABEND abnormal terminationEach activity logging message has a message numberwithin the range of EZYFS50 to EZYFS95Copyright (C) 2009 Applied Expert Systems, Inc. 55


<strong>FTP</strong>LOGGING output – centralized BPXF024I messages19:34:05 BPXF024I (<strong>FTP</strong>D) Feb 28 01:34:06 ftpd 16842834 : EZYFS50I ID=<strong>FTP</strong>D10009819:34:05 CONN starts Client IPaddr=137.72.43.142 hostname=UNKNOWN19:34:12 BPXF024I (<strong>FTP</strong>D) Feb 28 01:34:13 ftps 16842834 : EZYFS57I ID=<strong>FTP</strong>D10009819:34:12 ACCESS fails USERID=BADUSER Reason=10 Text=The userid is unknown19:34:13 BPXF024I (<strong>FTP</strong>D) Feb 28 01:34:14 ftps 16842834 : EZYFS52I ID=<strong>FTP</strong>D10009819:34:13 CONN ends Input=0 bytes Output=0 bytes19:34:30 BPXF024I (<strong>FTP</strong>D) Feb 28 01:34:31 ftpd 50397260 : EZYFS50I ID=<strong>FTP</strong>D10009919:34:30 CONN starts Client IPaddr=137.72.43.142 hostname=UNKNOWN19:34:37 BPXF024I (AESDJC1) Feb 28 01:34:38 ftps 50397260 : EZYFS56I19:34:37 ID=<strong>FTP</strong>D100099 ACCESS OK USERID=AESDJC119:34:45 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS60I19:34:45 ID=<strong>FTP</strong>D100099 ALLOC OK Use MVS DSN=AESDJC1.MAIN.CNTL(ASM)19:34:45 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS61I19:34:45 ID=<strong>FTP</strong>D100099 ALLOC DDNAME=SYS00003 VOLSER=AES004 DSORG=PO19:34:45 DISP=(SHR,KEEP)19:34:45 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS70I19:34:45 ID=<strong>FTP</strong>D100099 DEALL OK Release MVS DSN=AESDJC1.MAIN.CNTL(ASM)19:34:45 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS81I19:34:45 ID=<strong>FTP</strong>D100099 TRANS MVS DSN=AESDJC1.MAIN.CNTL(ASM)19:34:44 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS84I19:34:44 ID=<strong>FTP</strong>D100099 TRANS Stru=F Mode=S Type=A Output=2460 bytes19:34:44 BPXF024I (AESDJC1) Feb 28 01:34:45 ftps 50397260 : EZYFS80I19:34:44 ID=<strong>FTP</strong>D100099 TRANS Reply=250 Transfer <strong>com</strong>pleted successfully.19:34:45 BPXF024I (AESDJC1) Feb 28 01:34:46 ftps 50397260 : EZYFS52I19:34:45 ID=<strong>FTP</strong>D100099 CONN ends Input=0 bytes Output=2460 bytesCopyright (C) 2009 Applied Expert Systems, Inc. 56


<strong>FTP</strong> <strong>Server</strong> TracingTRACE and DEBUG statements in <strong>FTP</strong>.DATA TRACE is equivalent to DEBUG BAS, which includes:DEBUG CMD - <strong>com</strong>mandDEBUG INT – init and term of <strong>FTP</strong> sessionDEBUG FSC – details of APPE, STOR, STOU, RETR, DELE, RNFR, RNTODEBUG SOC – interface between <strong>FTP</strong> and networkUse the SITE <strong>com</strong>mand to turn on tracing dynamically only for the duration ofan <strong>FTP</strong> session Requires: DEBUGONSITE TRUE be specified in <strong>FTP</strong>.DATA z/OS example : site debug=basMS/DOS example: quote site debug=basUse the MODIFY <strong>com</strong>mand F jobname,DEBUG=(BAS) F jobname,DEBUG=(NONE)Output in SYSLOGCopyright (C) 2009 Applied Expert Systems, Inc. 57


<strong>FTP</strong> <strong>Server</strong> Tracing OutputFeb 8 04:29:51 os17 ftpd[83951678]: EZYFT82I ACTIVE SERVER TRACES - CMD INT FSC(1) SOC(1)Feb 8 04:29:51 os17 ftpd[83951678]: SD0359 accept_client: calling selectex for socket 6Feb 8 04:29:59 os17 ftpd[83951678]: SD0407 accept_client: accept()Feb 8 04:29:59 os17 ftpd[83951678]: SD0474 accept_client: accepted client on socket 7Feb 8 04:29:59 os17 ftpd[83951678]: SD1735 handle_client_socket: entered for socket 7Feb 8 04:29:59 os17 ftpd[83951678]: SD1958 handle_client_socket: new session for 137.72.43.122 port 4085Feb 8 04:29:59 os17 ftpd[83951678]: SD1099 spawn_ftps: enteredFeb 8 04:29:59 os17 ftpd[83951678]: SD0340 accept_client: prepare to accept another clientFeb 8 04:29:59 os17 ftpd[83951678]: SD0359 accept_client: calling selectex for socket 6Feb 8 04:29:59 os17 ftpd[67174598]: SD1119 spawn_ftps: my pid is 67174598 and my parent's is 83951678Feb 8 04:29:59 os17 ftpd[67174598]: SD1168 spawn_ftps: tmpmsg is 220-<strong>FTP</strong>D1 IBM <strong>FTP</strong> CS V1R7 at os17.aesclever.<strong>com</strong>,04:29:59 on 2007-02-08.08.Feb 8 04:29:59 os17 ftpd[67174598]: SD1254 spawn_ftps: tmpmsg is 220 Connection will not timeout.Feb 8 04:29:59 os17 ftpd[67174598]: SD0750 setup_new_pgm: enteredFeb 8 04:30:00 os17 ftpd[67174598]: SD0888 setup_new_pgm: msgcat->_name = /usr/lib/nls/msg/C/ftpdmsg.catFeb 8 04:30:00 os17 ftpd[67174598]: SD1049 setup_new_pgm: issuing execvFeb 8 04:30:00 os17 ftps[67174598]: GU1099 chkVerRel: system information for ADCD: z/OS version 1 release 7 (1247)Feb 8 04:30:00 os17 ftps[67174598]: PR0291 parse_cmd: enteredFeb 8 04:30:01 os17 ftps[67174598]: PR0470 parse_cmd: >>> USER aesdjc1Feb 8 04:30:01 os17 ftps[67174598]: SR2944 reply: --> 331 Send password please.Feb 8 04:30:02 os17 ftps[67174598]: PR0475 parse_cmd: >>> PASS ******Feb 8 04:30:02 os17 ftps[67174598]: RA0607 RACF_MIXED_CASE_PASSWORDS_ENABLED 0Feb 8 04:30:02 os17 ftps[67174598]: RA0670 pass: call user exit FTCHKPWD with these parameters:Feb 8 04:30:02 os17 ftps[67174598]: RA0673 ... exitrc 0, numparms 7Feb 8 04:30:02 os17 ftps[67174598]: RA0676 ... userid AESDJC1, numbadpw 0Feb 8 04:30:02 os17 ftps[67174598]: RA0696 ... client sockaddr addr:port 137.72.43.122:4085Feb 8 04:30:02 os17 ftps[67174598]: RA0698 ... server sockaddr addr:port 137.72.43.207:21Feb 8 04:30:02 os17 ftps[67174598]: RA0701 ... session id <strong>FTP</strong>D100140Feb 8 04:30:02 os17 ftps[67174598]: RA0795 pass: use __passwd() to verify the userFeb 8 04:30:02 os17 ftps[67174598]: RX1205 copyCntlBlks: enteredFeb 8 04:30:02 os17 ftps[67174598]: RX1226 copyCntlBlks: cbSaveArea at 7F5B7EB8Feb 8 04:30:02 os17 ftps[67174598]: RX1227 copyCntlBlks: ... for 37192 bytesCopyright (C) 2009 Applied Expert Systems, Inc. 58


CTRACE – Packet Tracing (SYSTCPDA)Set up External Writer ProcE.g., SYS1.PROCLIB(AESWRT)://IEFPROC EXEC PGM=ITTTRCWR,REGION=0K,TIME=1440,DPRTY=15//TRCOUT01 DD DISP=SHR,DSN=trace.datasetSet up tracing parametersE.g., SYS1.PARMLIB(CTAESPRM):TRACEOPTS ON WTR(AESWRT)Copyright (C) 2009 Applied Expert Systems, Inc. 59


CTRACE – Packet Tracing (SYSTCPDA)To Start Tracing:TRACE CT,WTRSTART=AESWRTV TCPIP,,PKT,CLEARV TCPIP,,PKT,LINKN=ETH1,ON,FULL,PROT=TCP,IP=TRACE CT,ON,COMP=SYSTCPDA,SUB=(TCPIP),PARM=CTAESPRMTo View Tracing Status:D TRACE,WTR=AESWRTVerify that the external writer is activeD TCPIP,,NETSTAT,DE Verify that TrRecCnt is non-zero and incrementingTo Stop Tracing:V TCPIP,,PKT,OFFTRACE CT,OFF,COMP=SYSTCPDA,SUB=(TCPIP)TRACE CT,WTRSTOP=AESWRT,FLUSHCopyright (C) 2009 Applied Expert Systems, Inc. 60


CTRACE – Packet Tracing (SYSTCPDA)To Start Tracing:TRACE CT,WTRSTART=AESWRTV TCPIP,,PKT,CLEARV TCPIP,,PKT,LINKN=ETH1,ON,FULL,PROT=TCP,IP=TRACE CT,ON,COMP=SYSTCPDA,SUB=(TCPIP),PARM=CTAESPRMTo View Tracing Status:D TRACE,WTR=AESWRTVerify that the external writer is activeD TCPIP,,NETSTAT,DE Verify that TrRecCnt is non-zero and incrementingTo Stop Tracing:V TCPIP,,PKT,OFFTRACE CT,OFF,COMP=SYSTCPDA,SUB=(TCPIP)TRACE CT,WTRSTOP=AESWRT,FLUSHCopyright (C) 2009 Applied Expert Systems, Inc. 61


CTRACE – OSAENTA Tracing (SYSTCPOT)Trace packets to a host attached to an OSA-Express2.The host can be an LPAR with z/OS, z/VM or Linux.The trace function is controlled by z/OS Communication <strong>Server</strong>, while the data iscollected in the OSA at the network port.Pre-Reqs:Install the required PTFs for z/OS V1R8 (APAR PK36947).Install the microcode for the OSA (2094DEVICE PSP and the 2096DEVICEPSP).Update the OSA using the Hardware Management Console (HMC) to:Define more data devices to systems that will use the trace function.Set the security for the OSA:LOGICAL PARTITION - Only packets from the LPARCHPID - All packets using this CHPIDVerify the TRLE definitions for the OSA that it has one DATAPATH addressavailable for tracing. Note that two DATAPATH addresses are required – one fordata transfers and the other for trace data.Copyright (C) 2009 Applied Expert Systems, Inc. 62


CTRACE – OSAENTA Tracing (SYSTCPOT)To Start Tracing:TRACE CT,WTRSTART=AESWRTAESWRTV TCPIP,,OSAENTAOSAENTA,PORTNAME=,CLEARV TCPIP,,OSAENTAOSAENTA,PORTNAME=,ON,NOFILTER=ALLTRACE CT,ON,COMP=SYSTCPOT,SUB=(TCPIP),PARM=,SUB=(TCPIP),PARM=CTAESPRMCTAESPRMTo Stop Tracing:V TCPIP,,OSAENTAOSAENTA,PORTNAME=,OFFTRACE CT,OFF,COMP=SYSTCPOTSYSTCPOT,SUB=(TCPIP)TRACE CT,WTRSTOP=AESWRT,FLUSHTo View Tracing Status:D TCPIP,,NETSTAT,DEVLINKSD TRACE,WTR=AESWRTAESWRTCopyright (C) 2009 Applied Expert Systems, Inc. 63


CTRACE Packet Trace Decoding – IPCS JCL//TSO EXEC PGM=IKJEFT01,DYNAMNBR=60,// PARM='%BLSCDDIR DSNAME(&SYSUID..BATCH.DDIR)VOLUME(AES003)'//SYSPROC DD DISP=SHR,DSN=SYS1.SBLSCLI0//TRACE DD DISP=SHR,DSN=trace.dataset


CTRACE Packet Trace Decoding – IPCS OutputIPCS PRINT LOG FOR USER AESDJC1 05:15:13 02/24/08_____________________________________________________________________________________________________________________COMPONENT TRACE FULL FORMATSYSNAME(ADCD)COMP(SYSTCPDA)SUBNAME((TCPIP))OPTIONS((<strong>FTP</strong>(20,21)))z/OS TCP/IP Packet Trace Formatter, (C) IBM 2000-2005, 2005, 2005.047FILE(TRACE)**** 2008/02/22RcdNr Sysname Mnemonic Entry Id Time Stamp Description----- -------- -------- -------- --------------- -----------------------------------------------------------------------------------------------------------------804059 ADCD PACKET 00000004 20:48:42.883175 Packet TraceFrom Interface : ETH1 Device: LCS Ethernet Full=52Tod Clock : 2008/02/22 20:48:42.883162 Intfx: 4Sequence # : 0 Flags: PktIpHeader: Version : 4 Header Length: 20Tos : 00 QOS: Routine Normal ServicePacket Length : 52 ID Number: AD04Fragment : DontFragment Offset: 0TTL : 64 Protocol: TCP CheckSum: 23F2 FFFFSource : 137.72.43.110Destination : 137.72.43.207TCPSource Port : 28265 () Destination Port: 21 (ftp)Sequence Number : 1439084340 Ack Number: 0Header Length : 32 Flags: SynWindow Size : 65534 CheckSum: 91D2 FFFF Urgent Data Pointer: 0000Option : Max Seg Size Len: 4 MSS: 1460Option : NOPOption : Window Scale OPT Len: 3 Shift: 0Option : NOPOption : NOPOption : SACK PermittedIP Header : 20000000 45000034 AD044000 400623F2 89482B6E 89482BCFCopyright (C) 2009 Applied Expert Systems, Inc. 65


z/VM Packet TraceTo enable the trace: NETSTAT OBEY PACKETTRACESIZE 256 NETSTAT OBEY TRACEONLY ETH0 ENDTRACEONLYTo start data collection:TRSOURCE ID TCP TYPE GT BLOCK FOR USER tcpip_useridTRSOURCE ENABLE ID TCPTo stop data collection: NETSTAT OBEY PACKETTRACESIZE 0 NETSTAT OBEY TRACEONLY ENDTRACEONLY TRSOURCE DISABLE ID TCPTo analyze a TRF trace file: IPFORMAT <strong>com</strong>mand Use the TRF2TCPD utility to convert the TRF file to pcap(tcpdump) formatCopyright (C) 2009 Applied Expert Systems, Inc. 66


Packet Trace <strong>Analysis</strong> Analyze one <strong>FTP</strong> session at a time Separate the Control Session from the DataSession Check session initiation and termination Check <strong>FTP</strong> <strong>com</strong>mands and replies Look for packet retransmissions and unusuallong response times Elapsed time between packets TCP window sizeCopyright (C) 2009 Applied Expert Systems, Inc. 67


Packet Trace <strong>Analysis</strong>RST flag in TCP header Abnormal condition and the receiver wants to abortthe connection; e.g., Receipt of any TCP segment from a host withwhich the receiver does not currently have aconnection Receipt of an invalid/incorrect Sequence Numberor Acknowledge Number Receipt of a SYN on a port without a listener Possible time-out on the Control Connection Issue netstat <strong>com</strong>mand on both sides to verifyconnectionsRun packet traces on both sides and <strong>com</strong>pareCapture “good” traces for future <strong>com</strong>parisonsCopyright (C) 2008 2009 Applied Expert Systems, Inc.68


Packet Trace – Unfiltered by Application PortsCopyright (C) 2009 Applied Expert Systems, Inc. 69


Packet Trace – Filtered by Application PortsCopyright (C) 2009 Applied Expert Systems, Inc. 70


Control Connection (Active <strong>FTP</strong>)Copyright (C) 2008 2009 Applied Expert Systems, Inc.71


Packet Details – PORT <strong>com</strong>mandData Connection Port =256*109 + 225 = 28129Copyright (C) 2009 Applied Expert Systems, Inc. 72


Control Connection (Passive <strong>FTP</strong>)Copyright (C) 2008 2009 Applied Expert Systems, Inc.73


Packet Details – Reply Code 227 in response to PASVData Connection Port =256*14 + 122 = 3706Copyright (C) 2008 2009 Applied Expert Systems, Inc.74


<strong>FTP</strong> Control Connection: exceptionsCopyright (C) 2009 Applied Expert Systems, Inc. 75


<strong>FTP</strong> Control Session: “451 transfer aborted”Copyright (C) 2009 Applied Expert Systems, Inc. 76


<strong>FTP</strong> Data Session: “connection reset by peer”Copyright (C) 2009 Applied Expert Systems, Inc. 77


<strong>FTP</strong> Data Session: “connection reset by peer”Copyright (C) 2009 Applied Expert Systems, Inc. 78


Trace Comparison – Host vs. WindowsCopyright (C) 2008 2009 Applied Expert Systems, Inc.79


<strong>FTP</strong> Diagnosis of Data Connection IssuesObtain a packet or OSAENTA trace.Obtain a server trace with options BAS and FLO. F ftpx,DEBUG=(FLO,BAS)Find the PORT or PASV <strong>com</strong>mand.Determine the IP address and port number for dataconnection.Check for session establishment: SYN, SYN ACK, etc.Missing SYN ACK may indicate firewall issue; e.g., forPassive <strong>FTP</strong>:<strong>FTP</strong>.DATA - PASSIVEDATAPORTS – should match firewall rangeTCP PROFILE – PORTRANGE E.g., firewall allows 5000-6000;PASSIVEPORTS(5000,6000) PORTRANGE 5000 1001 AUTHPORTCopyright (C) 2009 Applied Expert Systems, Inc. 80


<strong>FTP</strong> TuningUse the right Data Type (EBCDIC vs. ASCII)TCP Window Size: the maximum amount of data thatcan be in the network at any time for a single connection. Optimal TCP Window Size =Bottleneck Bandwidth * Round-trip Time (RTT)E.g., the slowest link=45 Mbit/sec, RTT=20ms45 Mbit/sec * 20ms= 45,000,000 bits/sec * .020 sec= 900,000 bits = 109.86 KBytesCopyright (C) 2009 Applied Expert Systems, Inc. 81


<strong>FTP</strong> TuningRTT Ping with default packet size; e.g., 256 Ping with “average” <strong>FTP</strong> packet size <strong>SMF</strong> 119 TCP Connection Termination Record (RTT attime of connection close) Packet traceWindow Size <strong>SMF</strong> 119 TCP Connection Termination Record Packet trace D NETSTAT,CONFIGTCPCONFIG TCPSENDBFRSIZE 64K TCPRCVBUFRSIZE 64K Windows tools: Dr. TCP, TCP Optimizer, etc.Copyright (C) 2009 Applied Expert Systems, Inc. 82


<strong>FTP</strong> <strong>Analysis</strong>Global usage patterns:Total <strong>FTP</strong> sessions Total <strong>FTP</strong> bytes <strong>FTP</strong> server vs. <strong>FTP</strong> client activities When are heavy <strong>FTP</strong>s done?Are gigabyte file transfers done?Unauthorized attempts – logon failure reasonHeavy users: Typically may be responsible for 80% of the workload Which data sets are most heavily used?Certain type? SEQ/ JES/ SQL?Can reposition or copy data sets for better performance?Heavy data set usage: Often moved around or duplicates made forsecurity and other redundancy reasons<strong>FTP</strong> performance analysis: throughput and response timeCopyright (C) 2009 Applied Expert Systems, Inc. 83


<strong>FTP</strong> <strong>Analysis</strong><strong>FTP</strong> Failure <strong>Analysis</strong> – Who and Why When do failures occur? At a specific time of day? Who are the top failing clients and datasets? Failure with one dataset or all datasets?Logon failure vs. data transfer failureCorrelated with heavy usage? Client side or server side – or in the middle?Control connection or data connection? Direction of flow – try reversing the role of client/server<strong>FTP</strong> Historical Trending and <strong>Analysis</strong> Number of server/client sessionsTypes of transfers (SEQ/SQL/JES) Amount of transfers Failures Heavy usage hours ThroughputWorkload analysis = proactive problem diagnosticsCopyright (C) 2009 Applied Expert Systems, Inc. 84

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

Saved successfully!

Ooh no, something went wrong!