19
Fri, Apr
5 New Articles

Taming the "Wild West" That Is TCP/IP

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Are you sure you're properly securing your IP applications?

 

If your IBM i is running TCP/IP, you have a problem. While the availability of IP applications is a blessing in that it gives your company an easy way to access your systems based on a set of defined standards, it also gives hackers an easy way to get into your systems and data using defined standards. Utilizing secure IP connectivity for your Telnet, FTP, and HTTP connectivity can help to curb the problem, but what about all of those other IP applications?

 

Often, the worst part of the issue can be getting a handle on exactly what applications you have running over TCP/IP. While you can display currently active IP connections using the NETSTAT command, that command gives only a snapshot of what's currently happening. The ideal would be a way to capture that activity on a timed basis to monitor TCP/IP traffic. By stringing together a few IBM APIs, we can do exactly that. In this article, we'll explore a utility to monitor IP traffic as well as learn exactly how to control traffic on restricted ports.

Monitoring TCP/IP Traffic

The command to dump IP network status data is DMPIPSTS. The source for this command can be found here. The parameters for this command are shown below:

  

Dump IP Net Stat Data (DMPIPSTS) Parameters

Keyword

Description

Choices

Notes

OUTFMT

Output format

*OUTFILE, *STMF, *PRINT

Optional

OUTFILE

Output File

Qualified object name

Optional

 

Qualifier 1: Output File

Name

 

 

Qualifier 2: Library

Name, *LIBL, *CURLIB

 

OUTMBR

Output member

Character value, *FIRST

Optional

ADDRPL

Add or Replace Records

*ADD, *REPLACE

Optional

STMF

Output Stream File

Character value

Optional

STMFTYPE

Stream File Type

*TXT, *CSV

 

 

The first parameter on this command identifies the destination for the data using one of the following three special values:

 

  • *OUTFILE—This value identifies that the output should be sent to the physical file identified on the OUTFILE parameter and the member identified on the OUTMBR parameter. The "Add or Replace Records" parameter is also used to identify whether or not to clear the destination file prior to adding new records.
  • *STMF—This value specifies that the output should be sent to the stream file identified on the Output Stream File parameter (STMF). The Stream File Type parameter (STMFTYPE) identifies the format of the output stream file as one of the following values: *CSV (the output is sent to a comma-delimited text format) or *TXT (the output is sent as a flat text file format).
  • *PRINT—This value defines that the output should be sent to a spooled file. When this option is used, multiple spooled files are created as a result of the number of columns of output.

Data Generated

The data generated by this command contains local and remote connection data along with associated job data for each IP network connection available at the time the command is executed. Below is a list of the columns generated by this command: 

 

File Layout for the Output of the DMPIPSTS Command

Field Name

Description

Data Type

Length

Dec Plc

IPCRMTADR

Remote System IP Address

CHAR

15

 

IPCRMTPORT

Remote System Port #

DECIMAL

10

0

IPCRMTNAME

Remote System Host Name

CHAR

256

 

IPCRMTSVNM

Remote Service Name

CHAR

32

 

IPCRMTSVDS

Remote Service Desc

CHAR

50

 

IPCLOCADR

Local System IP Address

CHAR

15

 

IPCLOCPORT

Local System Port #

DECIMAL

10

0

IPCLOCNAME

Local System Host Name

CHAR

256

 

IPCLOCSVNM

Local Service Name

CHAR

32

 

IPCLOCSVDS

Local Service Description

CHAR

50

 

IPCCNNSTT

Connection Status

CHAR

15

 

IPCCNOPNTP

Connection Open Type

CHAR

15

 

IPCNETCNTP

Connection Type

CHAR

10

 

IPCBYTIN

Bytes In

DECIMAL

20

0

IPCBYTOUT

Bytes Out

DECIMAL

20

0

IPCIDLTIME

Idle Time (hhhhhmmss)

DECIMAL

9

0

IPCJOBNAM

Connection Job Name

CHAR

10

 

IPCJOBUSR

Connection Job User

CHAR

10

 

IPCJOBNBR

Connection Job Number

CHAR

6

 

IPCCURRUSR

Current User Profile

CHAR

10

 

IPCRUNUSER

Run User

CHAR

10

 

IPCRUNTMS

Run Timestamp

TIMESTMP

10

 

 

The same output is generated whether you select *PRINT, *OUTFILE, or *STMF output. The main difference between the three options is that the *OUTFILE option allows you to indicate that you want to add the output to an existing physical file. This option gives you the ability to capture data over a period of time at given intervals. The command below shows how you would do this;

 

DMPIPSTS    OUTFMT(*OUTFILE) OUTFILE(MYLIB/IPSTATUS)

            OUTMBR(*FIRST) ADDRPL(*ADD)

 

This command will add current IP status data to the file IPSTATUS in library MYLIB.

 

When generating output to *STMF, you have the option of generating the output as a fixed-format text file or as a comma-delimited *CSV file. Figure 1 below shows a sample of the data as displayed in Microsoft Excel.

 

082712FaustDMPIPSTSFIG1

Figure 1: This is a sample of output generated to a comma delimited file.

 

To generate a file like the one shown above, the command below would be executed:

 

DMPIPSTS    OUTFMT(*STMF) STMF('/home/reports/ipstatus.csv')

            STMFTYPE(*CSV)

Knowledge Is Power

The key to securing your TCP/IP connectivity is knowing what IP traffic you're using. Because the output includes a timestamp indicating when the output was generated, you have the ability to also identify how long connectivity to a given port was connected and the IP address of the client that connected to that port. The output also identifies the user who started the job that is servicing the IP request locally. This can be a big help in ensuring that unnecessary (or even rogue) applications aren't leaving IP ports open on your system. Securing traffic for standard applications like Telnet, HTTP, or FTP is only half the battle. Identifying all of the "other" traffic is as important as, or maybe even more important than, implementing SSL on all of those standard applications. Now you have the utility to help you do that.

Mike Faust

Mike Faust is a senior consultant/analyst for Retail Technologies Corporation in Orlando, Florida. Mike is also the author of the books Active Server Pages Primer, The iSeries and AS/400 Programmer's Guide to Cool Things, JavaScript for the Business Developer, and SQL Built-in Functions and Stored Procedures. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Mike Faust available now on the MC Press Bookstore.

Active Server Pages Primer Active Server Pages Primer
Learn how to make the most of ASP while creating a fully functional ASP "shopping cart" application.
List Price $79.00

Now On Sale

JavaScript for the Business Developer JavaScript for the Business Developer
Learn how JavaScript can help you create dynamic business applications with Web browser interfaces.
List Price $44.95

Now On Sale

SQL Built-in Functions and Stored Procedures SQL Built-in Functions and Stored Procedures
Unleash the full power of SQL with these highly useful tools.
List Price $49.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: