-
Notifications
You must be signed in to change notification settings - Fork 43
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
Try to detect ssh and telnet port #313
Conversation
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
# Check ssh and telnet port | ||
if [ -z "${ZWED_SSH_PORT}" ]; then | ||
if [ -e "/etc/ssh/sshd_config" ]; then | ||
ssh_port=$(cat "/etc/ssh/sshd_config" | grep '^Port.*' | awk -F\ '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the reading of these here:
Just did a lot of work in v2.15-v2.18 to remove as much shell as possible for performance.
-
start.sh gets read every time the server starts, including crash restarts. configure.sh does not get read during crash restarts so its a little better...
-
configure.sh still gets read every fresh start. can we do this in JS instead? - read the file, line split and search for term.... we already have "initInstance.js". It could be made more intelligent.
initUtils.js takes these env vars and writes out JSON in workspace dir.
If it would instead do pretty much this logic when the env vars were missing, we wouldn't need to put this code into shell and the performance impact would be much less.
Replaced by #326. |
Proposed changes
Try to detect
ssh
andtelnet
port by looking into/etc/ssh/sshd_config
and/etc/services
. If such check fails, set the default port22
and23
(same as now).This PR addresses Issue:
app-server
start-up. This approach is independent on thezowe.yaml
changes: you can set the Zowe not to useapp-server
and later change it.Type of change
PR Checklist
Please delete options that are not relevant.
Testing
Small unit test
Test for checking if the logic works as expected:
Running without variables
In the log:
Running with preset
ZWED_SSH_PORT
In the log:
Further comments
I keep the setting in
defaults.yaml
. It should work without that, because those variables are exported. But in the future, there might be a way how to do it in JavaScript, keep it as reference.