Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

#161 Allow the creation of custom (opened) TCP endpoints. #162

Merged
merged 2 commits into from
Feb 24, 2017

Conversation

ddanciu
Copy link
Contributor

@ddanciu ddanciu commented Feb 16, 2017

This enables the setup of custom opened ports.
At the moment it allows only one interval.

In the future it should support multiple port intervals (comma separated).

@azurecla
Copy link

Hi @ddanciu, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.azure.com.

TTYL, AZPRBOT;

<% end %>
<% end %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like has_tcp_endpoints is only being applied to Linux VMs, or are my eyes playing tricks on me?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Apparently haven't thought it far enough.
Will update it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know when you'd like me to review the PR. Thank you for attempting this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @devigned , Can you please have a look. I would love some feedback.

Thanks,
Dan

@azurecla
Copy link

@ddanciu, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, AZPRBOT;

Copy link
Member

@devigned devigned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better -- I think this is almost there. I've included a few items to clean up.

README.md Outdated
@@ -124,6 +124,7 @@ For instructions on how to setup an Azure Active Directory Application see: <htt
* `vm_image_urn`: (Optional) Name of the virtual machine image urn to use -- defaults to 'canonical:ubuntuserver:16.04-LTS:latest'. See documentation for [*nix](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-cli-ps-findimage/), [Windows](https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-cli-ps-findimage).
* `virtual_network_name`: (Optional) Name of the virtual network resource
* `subnet_name`: (Optional) Name of the virtual network subnet resource
* `tcp_endpoints`: (Optional) The custom inbound security rules part of network security group (a.k.a. opened tcp endpoints). Allows specifying one or more intervals in the form '8000-9000, 9100-9200'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, this should be an array of strings. String parsing of the array will be a bit ambiguous where the array syntax only requires the understanding and parsing of the port range strings (start_port-end_port).

tcp_endpoints = ['8000-9000', '9100-9200']

unless tcp_endpoints.nil? || tcp_endpoints.empty?
endpoints = tcp_endpoints.split(',')
else
endpoints = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endpoints here should be an [] rather than a hash {}.

"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": <%= 133 + index %>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the docs for network security group rule priority (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-nsg#Nsg-rules) rule priority must be between Number between 100 and 4096. I think this is an edge case, but might warrant an error if the user has endpoints.length * 133 > 4096.

@ddanciu
Copy link
Contributor Author

ddanciu commented Feb 24, 2017

@devigned, any other feedback is appreciated.
Also, would it be possible to have this merged, we are planning on using this feature for a project starting next week.

Thanks,
Dan

@devigned devigned merged commit 479c4f0 into Azure:v2.0 Feb 24, 2017
@devigned
Copy link
Member

LGTM! Thank you for the contribution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants