-
Notifications
You must be signed in to change notification settings - Fork 227
The stunnel EFS port can be configurable #288
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
Open
rkurucz9
wants to merge
1
commit into
aws:master
Choose a base branch
from
rkurucz9:stunnel_efs_port_is_not_hardcoded
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,7 +268,7 @@ | |
| STUNNEL_EFS_CONFIG = { | ||
| "client": "yes", | ||
| "accept": "127.0.0.1:%s", | ||
| "connect": "%s:2049", | ||
| "connect": "%s:%s", | ||
| "sslVersion": "TLSv1.2", | ||
| "renegotiation": "no", | ||
| "TIMEOUTbusy": "20", | ||
|
|
@@ -621,6 +621,30 @@ def get_boolean_config_item_value( | |
| return default_value | ||
| return config.getboolean(config_section, config_item) | ||
|
|
||
| def get_int_config_item_value( | ||
| config, config_section, config_item, default_value, emit_warning_message=True | ||
| ): | ||
| warning_message = None | ||
| if not config.has_section(config_section): | ||
| warning_message = ( | ||
| "Warning: config file does not have section %s." % config_section | ||
| ) | ||
| elif not config.has_option(config_section, config_item): | ||
| warning_message = ( | ||
| "Warning: config file does not have %s item in section %s." | ||
| % (config_item, config_section) | ||
| ) | ||
|
|
||
| if warning_message: | ||
| if emit_warning_message: | ||
| sys.stdout.write( | ||
| "%s. You should be able to find a new config file in the same folder as current config file %s. " | ||
| "Consider update the new config file to latest config file. Use the default value [%s = %s]." | ||
| % (warning_message, CONFIG_FILE, config_item, default_value) | ||
| ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning is written to sys.stdout, but mount.efs's stdout can be parsed by callers (systemd units, automount helpers, scripts wrapping mount). Diagnostics like this should go to stderr |
||
| return default_value | ||
| return config.getint(config_section, config_item) | ||
|
|
||
|
|
||
| def fetch_ec2_metadata_token_disabled(config): | ||
| return get_boolean_config_item_value( | ||
|
|
@@ -1514,10 +1538,11 @@ def write_stunnel_config_file( | |
| efs_config = dict(STUNNEL_EFS_CONFIG) | ||
| efs_config["accept"] = efs_config["accept"] % tls_port | ||
|
|
||
| stunnel_efs_port = get_int_config_item_value(config, CONFIG_SECTION, "stunnel_efs_port", 2049) | ||
| if fallback_ip_address: | ||
| efs_config["connect"] = efs_config["connect"] % fallback_ip_address | ||
| efs_config["connect"] = efs_config["connect"] % (fallback_ip_address, stunnel_efs_port) | ||
| else: | ||
| efs_config["connect"] = efs_config["connect"] % dns_name | ||
| efs_config["connect"] = efs_config["connect"] % (dns_name, stunnel_efs_port) | ||
|
|
||
| # Verify level is only valid for tls mounts | ||
| if (verify_level is not None) and tls_enabled(options): | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This method seems like a duplicate of
get_boolean_config_item_value, we can have a generic method like