Add networking validation functions for inbound port restriction and east-west connectivity #25
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.
Add networking validation functions for inbound port restriction and east-west connectivity
Summary
This PR implements two new networking validation functions in
pkg/v1/networking
:ValidateInboundPortRestriction
- Validates that only SSH port (22) is accessible from external sources by testing common ports (21, 23, 25, 53, 80, 443, 993, 995, 3389, 5432, 3306) using netcat (nc
) to ensure they're properly blocked.ValidateEastWestConnectivity
- Creates two temporary test instances and validates inter-instance communication by testing ping connectivity and SSH port accessibility between instances using private IPs.Both functions are integrated into the existing validation suite in
internal/validation/suite.go
and follow established patterns for instance lifecycle validation. The implementation includes proper error handling, cleanup mechanisms, and logging.Key Fix: Resolved SSH authentication failures in CI by properly handling empty
attrs.Name
fields - providing a default "test-connectivity" name prevents malformed instance names like "-east" and "-west".Review & Testing Checklist for Human
nc
behavior may varyRecommended Test Plan:
make test
to verify no regressions in existing validationDiagram
Notes
nc
(netcat) which should be available on most cloud instance images but behavior may varySession Details: