Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto detect the TN3270 and the ssh ports during the install #292

Closed
Joe-Winchester opened this issue Jan 23, 2019 · 2 comments
Closed

Auto detect the TN3270 and the ssh ports during the install #292

Joe-Winchester opened this issue Jan 23, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Joe-Winchester
Copy link
Member

Problem:
If a site is not using 23 for the TN3270 port they will launch MVD and see a failing 3270.
We do allow the port to be overridden in the zowe-install.yaml, however the default is 23 and people may not understand where and how to change it.

Solution:
We do a netstat to detect the z/OSMF port already, so we could do a netstat to determine the TN3270 listener port and have an auto setting in the zowe-install.yaml

# Ports for the TN3270 and the VT terminal to connect to
terminals:
  sshPort=auto
  telnetPort=auto
# security=tls

If the value is auto we can netstat looking for

TN3270   00000025 Listen  
  Local Socket:   ::..23                                              
  Foreign Socket: ::..0  

and for

SSHD1    00000053 Listen  
  Local Socket:   0.0.0.0..22                                         
  Foreign Socket: 0.0.0.0..0  

If we fail to determine the ports using auto we should default to 23 and 22 (as that is what most sites have) and also echo to the console that we were unable to determine the defaults.
The installer should echo to the log that auto was used and the successful ports allocated for debugging purposes

@Joe-Winchester Joe-Winchester added enhancement New feature or request good first issue Good for newcomers labels Jan 23, 2019
@CForrest97 CForrest97 self-assigned this Jan 29, 2019
@Martin-Zeithaml
Copy link
Contributor

POC without netstat, checking always when app-server is started.
This could be moved to install/config process as well.

/app-server/bin/start.sh:

...
export ZWED_SSH_PORT_AUTODETECT=$(cat /etc/ssh/sshd_config | grep '^Port.*' | awk -F\  '{print $2}')
export ZWED_TN3270_PORT_AUTODETECT=$(cat /etc/services | grep '^telnet' | awk -F\  '{print $2}' | awk -F/ '{print $1}')
...

defaults.yaml:

...
  environments:
    ZWED_SSH_PORT: "${{ process.env.ZWED_SSH_PORT_AUTODETECT ? process.env.ZWED_SSH_PORT_AUTODETECT : 220 }}"
    ZWED_TN3270_PORT: "${{ process.env.ZWED_TN3270_PORT_AUTODETECT ? process.env.ZWED_TN3270_PORT_AUTODETECT : 230 }}"
...

Defaults 220 and 230 for testing purposes.

I am not sure, how reliable is the way of getting the port numbers. Is it possible to have config elsewhere? Another syntax breaking the grep + awk? Maybe extra variable not needed?

@Martin-Zeithaml
Copy link
Contributor

Partially solved in zowe/zlux-app-server#327
Reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants