Using SFTP on the z/os Platform



Similar documents
Configuring and Tuning SSH/SFTP on z/os

Secure Shell. The Protocol

TS-800. Configuring SSH Client Software in UNIX and Windows Environments for Use with the SFTP Access Method in SAS 9.2, SAS 9.3, and SAS 9.

SSH and FTP on Ubuntu WNYLUG Neal Chapman 09/09/2009

IBM Ported Tools for z/os: OpenSSH - Using Key Rings

SSH The Secure Shell

CASHNet Secure File Transfer Instructions

Secure File Transfer Installation. Sender Recipient Attached FIles Pages Date. Development Internal/External None 11 6/23/08

SSH! Keep it secret. Keep it safe

SSH, SCP, SFTP, Denyhosts. Süha TUNA Res. Assist.

Install and configure SSH server

File transfer clients manual File Delivery Services

WinSCP PuTTY as an alternative to F-Secure July 11, 2006

SSSD and OpenSSH Integration

Adobe Marketing Cloud Using FTP and sftp with the Adobe Marketing Cloud

Co:Z SFTP - User's Guide

Contents. Part 1 SSH Basics 1. Acknowledgments About the Author Introduction

Pragma FortressSSH 5.0

What IT Auditors Need to Know About Secure Shell. SSH Communications Security

Methods available to GHP for out of band PUBLIC key distribution and verification.

CreationDirect. Clearstream file transfer connectivity solutions

F-Secure SSH. for Windows. User s Guide

An Overview of the Secure Shell (SSH)

How To Run A Hybrid Batch Processing Job On An Z/Os V1.13 V1 (V1) V1-R13 (V2) V2.1 (R13) V3.1.1

fåíéêåéí=péêîéê=^çãáåáëíê~íçêûë=dìáçé

z/os Firewall Technology Overview

Implementing Secure Shell

Defeating Firewalls : Sneaking Into Office Computers From Home

Sharing Secrets Using Encryption Facility

Experian Secure Transport Service

Authentication in a Heterogeneous Environment

Configuring SSH and Telnet

How to Secure Mainframe FTP

Configuring for SFTP March 2013

How to upload large files to a JTAC Case

XFTP 5 User Guide. The Powerful SFTP/FTP File Transfer Program. NetSarang Computer Inc.

Encrypted File Transfer - Customer Testing

2 Advanced Session... Properties 3 Session profile... wizard. 5 Application... preferences. 3 ASCII / Binary... Transfer

ASX SFTP External User Guide

Online Banking for Business Secure FTP with SSH (Secure Shell) USER GUIDE

Guide to the Configuration and Use of SFTP Clients for Uploading Digital Treatment Planning Data to IROC RI

TELE 301 Network Management. Lecture 16: Remote Terminal Services

Using OpenSSH in a Single Sign-On Corporate Environment with z/os, Windows and Linux

Chapter 17. Transport-Level Security

z/os Hybrid Batch Processing and Big Data

Security Configuration Guide P/N Rev A05

A SHORT INTRODUCTION TO BITNAMI WITH CLOUD & HEAT. Version

Obtaining a user account and password: To obtain a user account, please submit the following information to AJRR staff:

SECURE FTP CONFIGURATION SETUP GUIDE

Overview. Remote access and file transfer. SSH clients by platform. Logging in remotely

HPCC - Hrothgar Getting Started User Guide

Java on z/os. Agenda. Java runtime environments on z/os. Java SDK 5 and 6. Java System Resource Integration. Java Backend Integration

Pro OpenSSH. Michael Stahnke. Apress* =# # w^ l&l ## frsft. *,«.,*

STERLING SECURE PROXY. Raj Kumar Integration Management, Inc.

Secure access to the DESY network using SSH

Overview SSL/TLS HTTPS SSH. TLS Protocol Architecture TLS Handshake Protocol TLS Record Protocol. SSH Protocol Architecture SSH Transport Protocol

ProxyCap Help. Table of contents. Configuring ProxyCap Proxy Labs

WS_FTP Professional 12. Security Guide

z/os Hybrid Batch Processing and Big Data Session zba07

athenahealth Interface Connectivity SSH Implementation Guide

Royal Mail Business Integration Gateway Specification

Deploying PGP Encryption and Compression for z/os Batch Data Protection to (FIPS-140) Compliance

SOSFTP Managed File Transfer

Digital Certificate Goody Bags on z/os

If you prefer to use your own SSH client, configure NG Admin with the path to the executable:

Securing Windows Remote Desktop with CopSSH

State of Michigan Data Exchange Gateway. SSLFTP/SFTP client setup

Introduction to HP NonStop SSH Customer Talk 01/24/08

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Secure File Multi Transfer Protocol Design

SBClient SSL. Ehab AbuShmais

Securing Windows Remote Desktop with CopSSH

TELNET CLIENT 5.11 SSH SUPPORT

OS/390 Firewall Technology Overview

IBM WebSphere Application Server Version 7.0

OpenSSH: Secure Shell

Network Security and Firewall 1

File Transfer. User Guide For Clients and Vendors. Last Revised: October

File Transfer Examples. Running commands on other computers and transferring files between computers

RELEASE NOTES. Release Notes. Introduction. Platform. Product/version/build: Remote Control ( ) ActiveX Guest 11.

FL EDI SECURE FTP CONNECTIVITY TROUBLESHOOTING GUIDE. SSL/FTP (File Transfer Protocol over Secure Sockets Layer)

Cross-platform TCP/IP Socket Programming in REXX

CA ehealth. Remote Poller Guide. r6.1

Network Security Essentials Chapter 5

MOVEIT: SECURE, GUARANTEED FILE DELIVERY BY JONATHAN LAMPE, GCIA, GSNA

z/os UNIX for all Vit Gottwald CA Technologies March 15, 2012 Session Number 10983

Understanding Secure Shell Host Keys

Connectivity using ssh, rsync & vsftpd

How to install and set up the WinSCP software for Secure File Transfer

Tel: Toll-Free: Fax: Oct Website: CAIL Security Facility

Safe and Secure Transfers with z/os FTP

Single Sign-On for Kerberized Linux and UNIX Applications

File Transfer Protocol

Transcription:

Using SFTP on the z/os Platform Thursday, December 10 th 2009 Steve Goetze Kirk Wolf http://dovetail.com info@dovetail.com Copyright 2009, Dovetailed Technologies Slide 1

Dovetailed Technologies Our operating philosophy is to offer quality products licensed free of charge, along with world class support and consulting services. Co:Z Toolkit, which includes: - Co:Z Launcher remote system cooperative processing - Co:Z Dataset Pipes convert datasets to files - Co:Z SFTP OpenSSH SFTP with z/os exploitation - Co:Z Batch full featured BPXBATCH replacement - Co:Z FtpSshProxy tunnel ordinary FTP in SSH proxy T:Z Quickstart for Tomcat and z/os JZOS - acquired by IBM in 2005 and now part of the z/os Java SDK Copyright 2009, Dovetailed Technologies Slide 2

Copyright 2009, Dovetailed Technologies Slide 3

Agenda What is SFTP and how it works with SSH How is SFTP different from FTP, and why use it Using IBM Ported Tools OpenSSH - Using z/os as an SFTP server - How to use the SFTP client from a batch job - Enhancing Ported Tools OpenSSH with Co:Z SFTP - Transferring MVS data sets - Connecting with keys or passwords - Using SAF/RACF client certificates - Diagnosing problems and avoiding common pitfalls Copyright 2009, Dovetailed Technologies Slide 4

What is SFTP? It's not FTP It's not FTPS (FTP with SSL/TLS) It's the Secure Shell (SSH2 specification) for file transfer - Most SSH implementations include an sftp command that has subcommands familiar to FTP users - The SFTP and FTPS wire protocols are not compatible Copyright 2009, Dovetailed Technologies Slide 5

Terminology used in this presentation SSH A draft internet standard defined by a group of related RFCs, aka SSH-2 SFTP SSH file transfer layer. SFTP implementations generally follow draft-ietf-secsh-filexfer version 3 or 4. FTPS FTP with SSL/TLS; RFC-2228 et al. Ported Tools - IBM Ported Tools for z/os OpenSSH; a non-chargeable, supported z/os feature Note: the old SSH protocol version 1 ( SSH-1 ) has known security weaknesses, and should be avoided and disabled in your SSH servers if possible (the default in Ported Tools) Copyright 2009, Dovetailed Technologies Slide 6

SSH features SSH provides: - A secure (encrypted) connection over one TCP/IP socket between a client and a server - The server's identity is authenticated using a public / private host keypair. - The client (user) can authenticate over the encrypted socket in one of several ways: - User public/private keypair - Password - GSS-API (Kerberos) - etc... - Data compression - Support for one or more simultaneous application channels Copyright 2009, Dovetailed Technologies Slide 7

Types of SSH Application Channels shell (telnet) - not tn3270 - a secure replacement for tty telnet (eg. PuTTY client) Remote command exec (redirect stdin, stdout, stderr) Port forwarding (and reverse forwarding, socks proxy etc) Subsystem: A named indirect command execution with binary stdin, stdout redirection: - File transfer (sftp) - A standardized packet protocol in the application channel - Additional subsystems can be configured Copyright 2009, Dovetailed Technologies Slide 8

SFTP as an SSH Application/Subsystem sftp sftp-server child process child process ssh -s sftp tcp/ip sshd Copyright 2009, Dovetailed Technologies Slide 9

Implications The sftp command and sftp-server subsystem are not responsible for: - TCP/IP socket communications - Authentication: Key Exchange, Passwords, etc... - Encryption - Compression Copyright 2009, Dovetailed Technologies Slide 10

SSH (+SFTP) Implementations OpenSSH Free, open-source. Included on Unix/Linux distros; available on Windows. - IBM Ported Tools for z/os includes a port. - Co:Z SFTP is a port of sftp and sftp-server for z/os. PuTTY Free, open-source Windows client. - WinSCP is a graphical Windows client that uses PuTTY SSH Tectia (SSH Communications) Windows, Unix, Linux, z/os SecureCRT, SecureFX (Van Dyke) - Windows, Unix, Linux... (many others) SSH Implementations are generally very compatible Copyright 2009, Dovetailed Technologies Slide 11

Important differences between SFTP and FTPS Host Authentication: - FTPS - SSL/TLS (X.509 PKI server certificates) - SSH Public/private DSA or RSA keypairs User Authentication: - FTPS - passwords, X.509 PKI client certificates, GSS-API - SSH passwords, DSA or RSA keypairs, GSS-API, PAM,... Note: IBM Ported Tools OpenSSH only supports a subset of user auth mechanisms: passwords, DSA/RSA keys Copyright 2009, Dovetailed Technologies Slide 12

Important differences between SFTP and FTPS (cont. 1) TCP/IP socket usage: - FTP and FTPS - one control connection (port 21) One data connection for each file transfer or directory listing. Data connection is either setup server->client or client->server ( passive mode) using dynamically assigned ports. Can be troublesome for firewalls and NAT routers - SSH one or more application channels are multiplexed in a single TCP/IP socket connection. More firewall/router friendly Copyright 2009, Dovetailed Technologies Slide 13

Important differences between SFTP and FTPS (cont. 2) MVS dataset support: FTPS (IBM Comm Svr) - including load module libraries SFTP (IBM Ported Tools) SFTP (Co:Z) SFTP (SSH Tectia) - staged and limited to 2GB unless partner is also Tectia SMF (type 119) accounting: FTPS (IBM Comm Svr) SFTP (IBM Ported Tools) SFTP (Co:Z) SFTP (SSH Tectia) Copyright 2009, Dovetailed Technologies Slide 14

Important differences between SFTP and FTPS (cont. 3) z/os hardware crypto exploitation: - IBM Comm Svr FTPS Random number (entropy) SAF/RACF key operations Ciphers - Ported Tools OpenSSH Random number (entropy) via /dev/random with ICSF SAF/RACF key operations - with Co:Z SFTP Ciphers - cards and letters to IBM please! - SSH Tectia for z/os Random number (entropy) SAF/RACF key operations Ciphers Copyright 2009, Dovetailed Technologies Slide 15

Important differences between SFTP and FTPS (cont. 4) User Exits: - Commonly used by customers or vendor products to control and automate file transfer operations. FTPS (IBM Comm Svr) SFTP (IBM Ported Tools) SFTP (Co:Z) Support for IBM FTP compatible exits SFTP (SSH Tectia) Copyright 2009, Dovetailed Technologies Slide 16

Managing FTP (and SFTP) FTP/WatchDog-Z ( SoftwareAssist.net ) An integrated product that manages z/os FTP and Co:Z SFTP. Preemptive control over server usage via SAF/RACF rules Real-time monitoring of activity Automation and alert capabilities Comprehensive auditing of FTP and SFTP usage in minutes Co:Z SFTP's compatibility with IBM FTP's user exits and SMF records allow it to be managed alongside FTP. Copyright 2009, Dovetailed Technologies Slide 17

Which should I use SFTP or FTPS? FTPS generally has better native z/os features - SFTP MVS dataset support is available with Co:Z or SSH Tectia - SFTP User Exits are available with Co:Z FTPS likes PKI (X.509) (do you?) - SSH Tectia also supports X.509 as a non-standard extension - Co:Z SFTP supports z/os client authentication via SAF/RACF SFTP is more firewall/router friendly SFTP is more widely deployed on Unix/Linux SFTP generally has fewer incompatibilities between implementations Your partners may dictate - the answer is often both Copyright 2009, Dovetailed Technologies Slide 18

Using z/os Ported Tools SFTP server Install and configure z/os OpenSSH per the IBM manual - Create host keys - Use /dev/random and ICSF if possible! - Start SSHD (the OpenSSH server) How does SSHD find sftp-server subsystem? # /etc/ssh/sshd_config... #Subsystem sftp /usr/lib/ssh/sftp-server # for using Co:Z SFTP - Subsystem sftp /usr/local/coz/bin/sftp-server.sh Copyright 2009, Dovetailed Technologies Slide 19

Using z/os Ported Tools SFTP server From a non-z/os OpenSSH sftp client: kirk@ubuntu:~$ sftp kirk@zoshost The authenticity of host 'zoshost (192.168.0.12)' can't be established. RSA key fingerprint is 76:34:22:42:15:d6:f5:6e:82:61:d9:3c:00:13:12:ed. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'zoshost,192.168.0.12' (RSA) to the list of known hosts. kirk@zoshost's password: xxxxxx sftp> sftp> get zos_file local_file Under the covers, sftp uses the ssh command to connect to z/os SSHD's sftp subsystem. Host key was accepted and added to the client file: ~/.ssh/authorized_keys ssh option -o StrictHostKeyChecking=no will automatically accept a new host key Copyright 2009, Dovetailed Technologies Slide 20

Using Co:Z SFTP server example IBM Ported Tools sshd_config sftp subsystem points to Co:Z sftp-server. From a non-z/os sftp client: kirk@ubuntu:~$ sftp kirk@zoshost kirk@zoshost's password: xxxxxx sftp> ls /+recfm=fb,lrecl=80 sftp> ls /+space=cyl.3.1 sftp> cd //KIRK sftp> put local_file test.dsn Uploading local_file to //KIRK/test.dsn sftp> ls -al Volume Referred Ext Tracks Used Recfm Lrecl BlkSz Dsorg Dsname VOL001 2009/08/04 2 45 18 FB 80 27920 PS KIRK.TEST.DSN VOL002 2009/02/10 1 1 1 U 0 6144 PS KIRK.TEST.FOO Copyright 2009, Dovetailed Technologies Slide 21

The z/os Ported Tools sftp client in a batch job // EXEC PGM=BPXBATCH,PARM='SH /path/sftp-ex1.sh' //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* // (file: sftp-ex1.sh with execute bits set) #!/bin/sh sftp -b- kirk@myco.com <<EOB get remote.file /path/local.file EOB How is the userid and remote host authenticated? Additional steps to copy HFS/zFS files to/from datasets Copyright 2009, Dovetailed Technologies Slide 22

The Co:Z SFTP client in a batch job // EXEC PGM=COZBATCH, -- a better BPXBATCH // PARM='/rf=&RFILE ru=&ruser rh=&rhost' //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //DOWNLD DD DISP=(NEW,CATLG),DSN=..,DCB=...,SPACE=... //STDIN DD * -- input to user's default login shell ssh_opts= -ostricthostkeychecking=no cozsftp $ssh_opts -b- $ru@$rh <<EOB get $rf //DD:DOWNLD EOB // JCL/PROC variables substituted into environment variables Downloads a remote file into a dataset via DD reference Assumes user public key in remote ~/.ssh/authorized_keys Copyright 2009, Dovetailed Technologies Slide 23

Using a password from a batch sftp client... (as previous slide)... //STDIN DD * export PASSWD_DSN='//HLQ.PASSWD(SITE1)' export SSH_ASKPASS=read_passwd_dsn.sh export DISPLAY=none ssh_opts="-obatchmode=no -ostricthostkeychecking=no" cozsftp $ssh_opts -b- $ru@$rh <<EOB get $rf //DD:DOWNLD EOB // Allows the use of a password from a RACF protected MVS dataset, and the acceptance of a new remote host key Copyright 2009, Dovetailed Technologies Slide 24

Using a SAF/RACF Client Certificate // EXEC PGM=COZBATCH, -- a better BPXBATCH // PARM='/rf=&RFILE ru=&ruser rh=&rhost' //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //DOWNLD DD DISP=(NEW,CATLG),DSN=..,DCB=...,SPACE=... //STDIN DD * -- input to user's default login shell ssh_opts= -ostricthostkeychecking=no cozsftp $ssh_opts -k MY-RING -b- $ru@$rh <<EOB get $rf //DD:DOWNLD EOB // MY-RING is the name of the user's SAF key ring The RSA private key from the client certificate will be used to sign the SSH client authentication request. Copyright 2009, Dovetailed Technologies Slide 25

Setting up logon keys for z/os sftp client (part 1) zoshost:/u/kirk> mkdir.ssh; chmod 700.ssh; cd.ssh zoshost:/u/kirk/.ssh> ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/u/kirk/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /u/kirk/.ssh/id_dsa. Your public key has been saved in /u/kirk/.ssh/id_dsa.pub. The key fingerprint is: 85:03:2d:99:10:19:2a:13:90:16:06:b6:7a:9b:e2:5c KIRK@ZOSHOST This needs to be done from a z/os ssh session: ssh commands don't work in TSO OMVS. Consider using ACLs to secure ~/.ssh files from any access other than the owning userid Copyright 2009, Dovetailed Technologies Slide 26

Setting up logon keys for z/os sftp client (part 2) zoshost:/u/kirk/.ssh> sftp kirk@myco.com Connecting to myco.com... The authenticity of host 'myco.com(192.168.0.15)' can't be established. RSA key fingerprint is 4d:d0:91:8b:5c:68:94:92:0b:6a:ec:b8:42:8e:fc:b6. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'myco.com,192.168.0.15' (RSA) to the list of known hosts. kirk@myco.com's password: xxxxxx sftp> Now remote host's public key is in /u/kirk/.ssh/known_hosts Copyright 2009, Dovetailed Technologies Slide 27

Setting up logon keys for z/os sftp client (part 3) (zoshost's sftp client still connected to remote host) sftp> pwd Remote working directory: /home/kirk/ sftp> mkdir.ssh (if necessary) sftp> chmod 700.ssh sftp> cd.ssh sftp> ascii Sets the file transfer type to ASCII. sftp> put id_dsa.pub authorized_keys sftp> chmod 600 authorized_keys sftp> quit Now z/os client known_hosts has remote host's public key and remote host ~/.ssh/authorized_keys has z/os user's public key zoshost:/u/kirk> sftp kirk@myco.com sftp> Copyright 2009, Dovetailed Technologies Slide 28

Common Pitfalls z/os client or server userid must have an OMVS segment. If multiple z/os userids share the same uid number, Ported Tools ssh and sshd won't necessary use your.ssh directory for keys SSH key files must be in EBCDIC on z/os. Avoid ssh-rand-helper! Use /dev/random with ICSF if possible. Must use proper file permissions (or ssh may ignore your key files): ~/.ssh - 700 id_dsa, id_rsa (private keys) 600 authorized_keys 600 known_hosts - 644 Copyright 2009, Dovetailed Technologies Slide 29

Trouble Shooting When debugging batch SFTP client job connection problems, test by using the interactive sftp client (or cozsftp) in an z/os ssh shell using the same z/os userid. Add -vvv option to OpenSSH sftp or ssh client to debug connection problems. Helps to compare log with similar working connection. Co:Z SFTP server has a per-session log file. Tracing can be enabled in ~/.ssh/sftp-server.rc Consider setting up a test sshd server (see Co:Z SFTP Guide) See also: IBM Ported Tools for z/os User's Guide: Trouble Shooting Post a question on our forum: http://dovetail.com/forum (see our support page for signup info) Copyright 2009, Dovetailed Technologies Slide 30

Legal... Co:Z is a registered trademark of Dovetailed Technologies SecureCRT and SecureFX are trademarks of Van Dyke Software Inc. SSH, Secure Shell, and TECTIA are trademarks of SSH Communications z/os is a registered trademark of IBM Corporation Copyright 2009, Dovetailed Technologies Slide 31