Authentication on OpenSSH Windows 10 Host from OpenVMS Using Public Keys
Jump to navigation
Jump to search
Prerequisites
Environment
- OpenVMS V8.4 and above
- TCP/IP V5.7 (SSH.COM format)
- Windows 10 SSH server (OpenSSH format)
System Configuration
- Public key authentication is allowed on both hosts being connected.
- SSH Client is enabled on OpenVMS
- The client is enabled by calling the
SYS$MANAGER:TCPIP$CONFIG.COMscript and selecting2. Client components→7. SSH clientfrom the menu.
- The client is enabled by calling the
- User with administrator privileges on Windows 10
- Running OpenSSH server on the Windows 10 host
- OpenSSH server is enabled by checking the appropriate checkbox from
Settings→Apps→Apps & Features→Optional features. - To start the server, one needs to open
Computer Management→Services and Applications→Services, select OpenSSH SSH Server Service, and then click onStart the service. It is also recommended to change the startup type toAutomaticto start the service upon Windows loading.
- OpenSSH server is enabled by checking the appropriate checkbox from
- OpenVMS Telnet connectivity to the Windows host running OpenSSH.
- To test connectivity, execute:
$ TELNET OpenSSH 22- A banner should be displayed in the terminal upon successful connection. If unable to connect, contact appropriate support.
Common Steps
- Generate the key pair:
$ set def sys$login ! This is for the account on VMS that will use public key authentication.$ set def [.SSH2]$ @sys$manager:tcpip$define_commands ! The account must have appropriate privileges.$ ssh_keygen OpenVMS ! This command produces the keypair. Note the lack of extension on the target filename - OpenVMS.OpenVMS. ! Is the Private keyOpenVMS.PUB ! Is the Public key
- Verify the public key (example):
$ ssh_keygen -"F" OpenVMS.pubFingerprint for key:xemer-dovak-cevol-kukoh-fifav-zopub-sucil-tydic-gebar-nalen-cyxax- If the fingerprint is not returned, then the public key is not usable. Try generating the keys again. Contact appropriate support for further assistance if it is still not working.
- Populate the
IDENTIFICATION.file :$ create IDENTIFICATION. ! Note the lack of a file extensionIdKey OpenVMS[CTRL-Z] Exitdir IDENTIFICATION.;Directory SYS$SYSDEVICE:[user.ssh2]IDENTIFICATION.;1Total of 1 file.
- Set protection on the files:
$ SET FILE/PROT=(S,W,G,O:RE) IDENTIFICATION.$ SET FILE/PROT=(S,W,G,O:RE) OpenVMS.*
- Transfer the
.PUBfile to the OpenSSH Windows 10 SSH server.
Method A
SFTP the .PUB to OpenSSH:
sftp user@OpenSSH
user@OpenSSH's password: ! Note the password prompt
sftp> cd .ssh
/C:/Users/user/.ssh/
sftp>
sftp> put OpenVMS.PUB
OpenVMS.PUB | 1.2kB | 1.2 kB/s | TOC: 00:00:01 | 100%
sftp> quit
Method B
- Copy/paste the contents of the public key from OpenVMS to OpenSSH on Windows 10:
$ TYPE OpenVMS.PUB- The user needs to be logged into an Administrator account on a Windows 10 PC. Files cannot be edited from a command line.
- Open a Notepad session and paste the contents of the TYPE command output from above into a text editor, such as Notepad. Include the beginning and ending lines as well as all of the text between them:
---- BEGIN SSH2 PUBLIC KEY ----. text .. text .. text .---- END SSH2 PUBLIC KEY ----
- Save the Notepad session in the
.sshfolder for the user asOpenVMS.PUB. - Open a CMD prompt window on the Windows 10 system to perform the following steps:
- Convert the SSH.COM format public key to an OpenSSH test file and verify the converted key:
C:\Users\%USERNAME%\.ssh>ssh-keygen -i -f openvms.pub > vms2openssh.pubC:\Users\%USERNAME%\.ssh>ssh-keygen -B -f vms2openssh.pub- The output of the second command should generate a fingerprint that contains the same output as the one that was generated on the OpenVMS system by
$ ssh_keygen -"F" OpenVMS.pubfrom Step 2. If the fingerprint is not returned, the key is not usable. In this case, try Method A and/or Method B above again. If it is still failing, contact appropriate support for further assistance.
- Once verified, the vms2openssh.pub file can be deleted.
- Convert the SSH.COM format public key to an OpenSSH test file and verify the converted key:
- Convert the SSH.COM format key to the OpenSSH format and add it to the
authorized_keysfile. Older versions of OpenSSH used a file calledauthorized_keys2. Windows 10 uses a newer version of OpenSSH which changed the file name toauthorized_keys:C:\Users\%USERNAME%\.ssh>ssh-keygen -i -f openvms.pub >> authorized_keys
- Change permissions on the authorized_keys file in the users
.sshfolder. BothSYSTEMand the user should have full control over the file.- Open a File Explorer window and navigate to the
.sshfolder. - Right click on authorized_keys and go to
Properties→Security→Advanced. - Click
Disable inheritance. - Choose
Convert inherited permissions into explicit permissions on this objectwhen prompted. Remove all permissions from the file except for theSYSTEMand the user. There must remain exactly two permission entries on the file.
- Open a File Explorer window and navigate to the
- To enable the public key type of ssh-dss (needed to support the SSH.COM format key from the OpenVMS system) and to prevent public key access from trying to read the
administrators_authorized_keysfile inC:\PROGRAMDATA\ssh, thesshd_configfile needs to be modified as follows:- Right click and copy the
sshd_configfile fromC:\PROGRAMDATA\sshand save it to a folder local to the user (Documents,Downloads, etc.). - Right click on the copied file and select
Open with. Select Notepad or your preferred text editor/processor from the popup window and click OK. - In the editor window, scroll down to the line that reads
#PubkeyAuthentication yes. Enter the following line below it:PubkeyAcceptedKeyTypes=+ssh-dss
- Scroll to the bottom of the file and comment out the lines that read:
Match Group administratorsAuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys- by adding a
#character at the beginning of each line. They should look like this: # Match Group administrators# AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
- Save the modified
sshd_configfile to the local user folder. Right click the saved file, selectCopy, and then right click in theC:\PROGRAMDATA\sshfolder and selectPaste. Click onReplace the filein the destination in the popup window. ClickContinuein theDestination Folder Access Deniedpopup window that appears. This provides administrator permission to allow copying into the folder. - Start or restart the
OpenSSH SSH Serverservice on the Windows 10 system to have the service read the newsshd_configfile.
- Right click and copy the
- Test SFTP from OpenVMS:
$ sftp OpenSSH- <<<NOTE THE LACK OF PASSWORD PROMPT>>>
sftp> pwd/C:/Users/usersftp>