Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Latest
- Adjusted random number generator logic used to get filename in downloadContent plugin
- Fixed Agent to gather application inventory from both rpm and dpkg package managers if present in Unix instances
- Bump golang.org/x/crypto/ssh from 0.14.0 to 0.17.0
- Added EXCLUDE\_INTERFACES environment variable support to exclude certain interfaces

3.2.2016.0
===============
Expand Down
12 changes: 11 additions & 1 deletion agent/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ package platform
import (
"fmt"
"net"
"os"
"sort"
"strings"
"unicode/utf8"

"github.com/aws/amazon-ssm-agent/agent/log"
"github.com/aws/amazon-ssm-agent/agent/ssm/util"
)

const (
Expand Down Expand Up @@ -144,8 +147,15 @@ func isIpv4(ip net.IP) bool {

// filterInterface removes interface that's not up or is a loopback/p2p
func filterInterface(interfaces []net.Interface) (i []net.Interface) {
excludeInterfacesStr := os.Getenv("EXCLUDE_INTERFACES")

excludeInterfaces := []string{}
if excludeInterfacesStr != "" {
excludeInterfaces = strings.Split(excludeInterfacesStr, ",")
}

for _, v := range interfaces {
if (v.Flags&net.FlagUp != 0) && (v.Flags&net.FlagLoopback == 0) && (v.Flags&net.FlagPointToPoint == 0) {
if (v.Flags&net.FlagUp != 0) && (v.Flags&net.FlagLoopback == 0) && (v.Flags&net.FlagPointToPoint == 0 && !util.Contains(excludeInterfaces, v.Name)) {
i = append(i, v)
}
}
Expand Down
10 changes: 10 additions & 0 deletions agent/ssm/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,13 @@ func disableHTTPDowngrade(req *http.Request, via []*http.Request) error {
}
return nil
}

func Contains(slice []string, str string) bool {
// contains checks if a string is present in a slice
for _, s := range slice {
if s == str {
return true
}
}
return false
}