Skip to content

Commit

Permalink
Merge pull request #798 from tailwarden/develop
Browse files Browse the repository at this point in the history
v3.0.16 release 🚀
  • Loading branch information
mlabouardy authored May 15, 2023
2 parents 591c345 + 56d3398 commit 6145d7e
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ blobs:
bucket: komiser-releases
folder: "/{{.Version}}"
region: eu-central-1
- provider: s3
bucket: komiser-releases
folder: "/latest"
region: eu-central-1

brews:
- tap:
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komiser-dashboard",
"version": "3.0.15",
"version": "3.0.16",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0
github.com/BurntSushi/toml v1.2.1
github.com/aws/aws-sdk-go-v2 v1.17.8
github.com/aws/aws-sdk-go-v2 v1.18.0
github.com/aws/aws-sdk-go-v2/config v1.15.14
github.com/aws/aws-sdk-go-v2/service/apigateway v1.16.0
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.27.2
Expand All @@ -34,6 +34,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/elasticache v1.26.1
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.4
github.com/aws/aws-sdk-go-v2/service/iam v1.18.9
github.com/aws/aws-sdk-go-v2/service/kinesis v1.17.12
github.com/aws/aws-sdk-go-v2/service/kms v1.18.18
github.com/aws/aws-sdk-go-v2/service/lambda v1.23.4
github.com/aws/aws-sdk-go-v2/service/pricing v1.17.5
Expand Down Expand Up @@ -91,11 +92,11 @@ require (
github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/apache/thrift v0.16.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.32 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.20.9
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ github.com/aws/aws-sdk-go-v2 v1.17.5/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3eP
github.com/aws/aws-sdk-go-v2 v1.17.7/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2 v1.17.8 h1:GMupCNNI7FARX27L7GjCJM8NgivWbRgpjNI/hOQjFS8=
github.com/aws/aws-sdk-go-v2 v1.17.8/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY=
github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 h1:S/ZBwevQkr7gv5YxONYpGQxlMFFYSRfz3RMcjsC9Qhk=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno=
github.com/aws/aws-sdk-go-v2/config v1.15.14 h1:+BqpqlydTq4c2et9Daury7gE+o67P4lbk7eybiCBNc4=
github.com/aws/aws-sdk-go-v2/config v1.15.14/go.mod h1:CQBv+VVv8rR5z2xE+Chdh5m+rFfsqeY4k0veEZeq6QM=
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 h1:DloAJr0/jbvm0iVRFDFh8GlWxrOd9XKyX82U+dfVeZs=
Expand All @@ -77,13 +81,17 @@ github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.29/go.mod h1:Dip3sIGv48
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31/go.mod h1:QT0BqUvX1Bh2ABdTGnjqEjvjzrCfIniM9Sc8zn9Yndo=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.32 h1:dpbVNUjczQ8Ae3QKHbpHBpfvaVkRdesxpTOe9pTouhU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.32/go.mod h1:RudqOgadTWdcS3t/erPQo24pcVEoYyqj/kKW5Vya21I=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21/go.mod h1:+Gxn8jYn5k9ebfHEqlhrMirFjSW0v0C9fI+KN5vk2kE=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.23/go.mod h1:mr6c4cHC+S/MMkrjtSlG4QA36kOznDep+0fga5L/fGQ=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25/go.mod h1:zBHOPwhBc3FlQjQJE/D3IfPWiWaQmT06Vq9aNukDo0k=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.26 h1:QH2kOS3Ht7x+u0gHCh06CXL/h6G8LQJFpZfFBYBNboo=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.26/go.mod h1:vq86l7956VgFr0/FWQ2BWnK07QC3WYsepKzy33qqY5U=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 h1:QquxR7NH3ULBsKC+NoTpilzbKKS+5AELfNREInbhvas=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15/go.mod h1:Tkrthp/0sNBShQQsamR7j/zY4p19tVTAs+nnqhH6R3c=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 h1:tEEHn+PGAxRVqMPEhtU8oCSW/1Ge3zP5nUgPrGQNUPs=
Expand Down Expand Up @@ -130,6 +138,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 h1:GE25AWCdN
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8 h1:TlN1UC39A0LUNoD51ubO5h32haznA+oVe15jO9O4Lj0=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8/go.mod h1:JlVwmWtT/1c5W+6oUsjXjAJ0iJZ+hlghdrDy/8JxGCU=
github.com/aws/aws-sdk-go-v2/service/kinesis v1.17.12 h1:Xw1u2pxSAI9giCqYamjNZjFthuh2UjVct8mnv9X2XBo=
github.com/aws/aws-sdk-go-v2/service/kinesis v1.17.12/go.mod h1:DDgzScy4XhYf4xgHP7xVNP3jjwMwMegzusy8awGN7YU=
github.com/aws/aws-sdk-go-v2/service/kms v1.18.18 h1:VEj0VdYbmx12y3GKWSXm8hB/mPuSaYHnECRhokHy4Wo=
github.com/aws/aws-sdk-go-v2/service/kms v1.18.18/go.mod h1:kZodDPTQjSH/qM6/OvyTfM5mms5JHB/EKYp5dhn/vI4=
github.com/aws/aws-sdk-go-v2/service/lambda v1.23.4 h1:d1Olp+josNRAlrrtacghtos74rffKS6Mq5gEUBHfgHw=
Expand Down
2 changes: 2 additions & 0 deletions providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/tailwarden/komiser/providers/aws/elasticache"
"github.com/tailwarden/komiser/providers/aws/elb"
"github.com/tailwarden/komiser/providers/aws/iam"
"github.com/tailwarden/komiser/providers/aws/kinesis"
"github.com/tailwarden/komiser/providers/aws/kms"
"github.com/tailwarden/komiser/providers/aws/lambda"
"github.com/tailwarden/komiser/providers/aws/opensearch"
Expand Down Expand Up @@ -82,6 +83,7 @@ func listOfSupportedServices() []providers.FetchDataFunction {
systemsmanager.MaintenanceWindows,
ec2.VpcEndpoints,
ec2.VpcPeeringConnections,
kinesis.Shards,
}
}

Expand Down
57 changes: 57 additions & 0 deletions providers/aws/kinesis/shards.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package kinesis

import (
"context"
"fmt"
"time"

log "github.com/sirupsen/logrus"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/kinesis"
. "github.com/tailwarden/komiser/models"
. "github.com/tailwarden/komiser/providers"
)

func Shards(ctx context.Context, client ProviderClient) ([]Resource, error) {
resources := make([]Resource, 0)
var config kinesis.ListShardsInput
kinesisClient := kinesis.NewFromConfig(*client.AWSClient)

for {
output, err := kinesisClient.ListShards(ctx, &config)
if err != nil {
return resources, err
}

for _, shard := range output.Shards {
resources = append(resources, Resource{
Provider: "AWS",
Account: client.Name,
Service: "Kinesis Shard",
ResourceId: *shard.ShardId,
Region: client.AWSClient.Region,
Name: *shard.ShardId,
Cost: 0,
FetchedAt: time.Now(),
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/kinesis/home?region=%s#/streams/details/%s", client.AWSClient.Region, client.AWSClient.Region, *shard.ShardId),
})
}

if aws.ToString(output.NextToken) == "" {
break
}

config.NextToken = output.NextToken
}

log.WithFields(log.Fields{
"provider": "AWS",
"account": client.Name,
"region": client.AWSClient.Region,
"service": "Kinesis Shard",
"resources": len(resources),
}).Info("Fetched resources")

return resources, nil
}
2 changes: 2 additions & 0 deletions providers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ func listOfSupportedServices() []providers.FetchDataFunction {
compute.Disks,
compute.Images,
compute.VirtualMachines,
compute.Snapshots,
networking.ApplicationGateways,
networking.LoadBalancers,
networking.Firewalls,
storage.Queues,
storage.Tables,
storage.Databoxes,
Expand Down
64 changes: 64 additions & 0 deletions providers/azure/compute/snapshots.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package compute

import (
"context"
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4"
log "github.com/sirupsen/logrus"

"github.com/tailwarden/komiser/models"
"github.com/tailwarden/komiser/providers"
)

func Snapshots(ctx context.Context, client providers.ProviderClient) ([]models.Resource, error) {
resources := make([]models.Resource, 0)

svc, err := armcompute.NewSnapshotsClient(client.AzureClient.SubscriptionId, client.AzureClient.Credentials, &arm.ClientOptions{})
if err != nil {
return resources, err
}

pager := svc.NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
return resources, err
}

for _, snapshot := range page.SnapshotList.Value {
tags := make([]models.Tag, 0)

for key, value := range snapshot.Tags {
tags = append(tags, models.Tag{
Key: key,
Value: *value,
})
}

resources = append(resources, models.Resource{
Provider: "Azure",
Account: client.Name,
Service: "Snapshot",
Region: *snapshot.Location,
ResourceId: *snapshot.ID,
Cost: 0,
Name: *snapshot.Name,
FetchedAt: time.Now(),
Tags: tags,
CreatedAt: *snapshot.Properties.TimeCreated,
Link: fmt.Sprintf("https://portal.azure.com/#resource%s", *snapshot.ID),
})
}
}

log.WithFields(log.Fields{
"provider": "Azure",
"account": client.Name,
"service": "Snapshot",
"resources": len(resources),
}).Info("Fetched resources")
return resources, nil
}
63 changes: 63 additions & 0 deletions providers/azure/networking/firewalls.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package networking

import (
"context"
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork"
log "github.com/sirupsen/logrus"

"github.com/tailwarden/komiser/models"
"github.com/tailwarden/komiser/providers"
)

func Firewalls(ctx context.Context, client providers.ProviderClient) ([]models.Resource, error) {
resources := make([]models.Resource, 0)

svc, err := armnetwork.NewAzureFirewallsClient(client.AzureClient.SubscriptionId, client.AzureClient.Credentials, &arm.ClientOptions{})
if err != nil {
return resources, err
}

pager := svc.NewListAllPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
return resources, err
}

for _, firewall := range page.AzureFirewallListResult.Value {
tags := make([]models.Tag, 0)

for key, value := range firewall.Tags {
tags = append(tags, models.Tag{
Key: key,
Value: *value,
})
}

resources = append(resources, models.Resource{
Provider: "Azure",
Account: client.Name,
Service: "Firewall",
Region: *firewall.Location,
ResourceId: *firewall.ID,
Cost: 0,
Name: *firewall.Name,
FetchedAt: time.Now(),
Tags: tags,
Link: fmt.Sprintf("https://portal.azure.com/#resource%s", *firewall.ID),
})
}
}

log.WithFields(log.Fields{
"provider": "Azure",
"account": client.Name,
"service": "Firewall",
"resources": len(resources),
}).Info("Fetched resources")
return resources, nil
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6145d7e

Please sign in to comment.