Authentication on OpenSSH Windows 10 Host from OpenVMS Using Public Keys
Contents
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.COM
script and selecting2. Client components
→7. SSH client
from 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 toAutomatic
to 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 key
OpenVMS.PUB ! Is the Public key
- Verify the public key (example):
$ ssh_keygen -"F" OpenVMS.pub
Fingerprint 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 extension
IdKey OpenVMS
[CTRL-Z] Exit
dir IDENTIFICATION.;
Directory SYS$SYSDEVICE:[user.ssh2]
IDENTIFICATION.;1
Total 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
.PUB
file 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
.ssh
folder 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.pub
C:\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.pub
from 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_keys
file. 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
.ssh
folder. BothSYSTEM
and the user should have full control over the file.- Open a File Explorer window and navigate to the
.ssh
folder. - Right click on authorized_keys and go to
Properties
→Security
→Advanced
. - Click
Disable inheritance
. - Choose
Convert inherited permissions into explicit permissions on this object
when prompted. Remove all permissions from the file except for theSYSTEM
and 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_keys
file inC:\PROGRAMDATA\ssh
, thesshd_config
file needs to be modified as follows:- Right click and copy the
sshd_config
file fromC:\PROGRAMDATA\ssh
and 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 administrators
AuthorizedKeysFile __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_config
file to the local user folder. Right click the saved file, selectCopy
, and then right click in theC:\PROGRAMDATA\ssh
folder and selectPaste
. Click onReplace the file
in the destination in the popup window. ClickContinue
in theDestination Folder Access Denied
popup window that appears. This provides administrator permission to allow copying into the folder. - Start or restart the
OpenSSH SSH Server
service on the Windows 10 system to have the service read the newsshd_config
file.
- Right click and copy the
- Test SFTP from OpenVMS:
$ sftp OpenSSH
- <<<NOTE THE LACK OF PASSWORD PROMPT>>>
sftp> pwd
/C:/Users/user
sftp>