Skip to content

Commit

Permalink
Merge pull request #334 from projectdiscovery/dev
Browse files Browse the repository at this point in the history
cloudlist v1.0.3
  • Loading branch information
ehsandeep authored Apr 11, 2023
2 parents 29bacea + 5699fcf commit b665ee8
Showing 35 changed files with 1,274 additions and 1,053 deletions.
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@ name: 🔨 Build Test

on:
pull_request:
paths:
- '**.go'
- '**.mod'
workflow_dispatch:

jobs:
@@ -10,11 +13,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.18.x, 1.19.x]
go-version: [1.19.x]
os: [ubuntu-latest, windows-latest, macOS-12]
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

5 changes: 3 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -3,8 +3,9 @@ name: 🚨 CodeQL Analysis
on:
workflow_dispatch:
pull_request:
branches:
- dev
paths:
- '**.go'
- '**.mod'

jobs:
analyze:
4 changes: 2 additions & 2 deletions .github/workflows/dockerhub-push.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-16-cores
steps:
- name: Git Checkout
uses: actions/checkout@v3
@@ -32,7 +32,7 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@ name: 🙏🏻 Lint Test

on:
pull_request:
paths:
- '**.go'
- '**.mod'
workflow_dispatch:

jobs:
@@ -10,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: 1.19
- name: Checkout code
uses: actions/checkout@v3
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.3.1
uses: golangci/golangci-lint-action@v3.4.0
with:
version: latest
args: --timeout 5m
27 changes: 27 additions & 0 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 🎉 Release Binary

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.19

- uses: goreleaser/goreleaser-action@v4
with:
args: "release --rm-dist"
version: latest
workdir: .
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
DISCORD_WEBHOOK_ID: "${{ secrets.DISCORD_WEBHOOK_ID }}"
DISCORD_WEBHOOK_TOKEN: "${{ secrets.DISCORD_WEBHOOK_TOKEN }}"
25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/sonarcloud.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

cmd/cloudlist/cloudlist
.DS_Store
dist
6 changes: 5 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -42,4 +42,8 @@ announce:
enabled: true
channel: '#release'
username: GoReleaser
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}'

discord:
enabled: true
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM golang:1.19.3-alpine AS builder
RUN apk add --no-cache git
RUN go install -v github.com/projectdiscovery/cloudlist/cmd/cloudlist@latest
# Base
FROM golang:1.20.1-alpine AS builder
RUN apk add --no-cache build-base
WORKDIR /app
COPY . /app
RUN go mod download
RUN go build ./cmd/cloudlist

FROM alpine:3.16.3
# Release
FROM alpine:3.17.2
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates
COPY --from=builder /go/bin/cloudlist /usr/local/bin/
COPY --from=builder /app/cloudlist /usr/local/bin/

ENTRYPOINT ["cloudlist"]
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOMOD=$(GOCMD) mod
GOTEST=$(GOCMD) test
GOFLAGS := -v
# This should be disabled if the binary uses pprof
LDFLAGS := -s -w

ifneq ($(shell go env GOOS),darwin)
LDFLAGS := -extldflags "-static"
endif

all: build
build:
$(GOBUILD) $(GOFLAGS) -ldflags '$(LDFLAGS)' -o "cloudlist" cmd/cloudlist/main.go
test:
$(GOTEST) $(GOFLAGS) ./...
tidy:
$(GOMOD) tidy
47 changes: 35 additions & 12 deletions PROVIDERS.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ Amazon Web Services can be integrated by using the following configuration block
```yaml
- # provider is the name of the provider
provider: aws
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# aws_access_key is the access key for AWS account
aws_access_key: $AWS_ACCESS_KEY
@@ -35,7 +35,7 @@ Google Cloud Platform can be integrated by using the following configuration blo
```yaml
- # provider is the name of the provider
provider: gcp
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# gcp_service_account_key is the key token of service account.
gcp_service_account_key: '{}'
@@ -58,7 +58,7 @@ Microsoft Azure can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: azure
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# client_id is the client ID of registered application of the azure account (not requuired if using cli auth)
client_id: $AZURE_CLIENT_ID
@@ -134,6 +134,8 @@ Cloudflare can be integrated by using the following configuration block.
email: $CF_EMAIL
# api_key is the api_key for cloudflare
api_key: $CF_API_KEY
# api_token is the scoped_api_token for cloudflare (optional)
api_token: $CF_API_TOKEN
```

`api_key` can be generated from Cloudflare API Key manager. It needs to be Global API Key due to limitation of cloudflare new API tokens.
@@ -148,7 +150,7 @@ Heroku can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: heroku
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# heroku_api_token is the authorization token for Heroku account
heroku_api_token: $HEROKU_API_TOKEN
@@ -179,7 +181,7 @@ Fastly can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: fastly
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# fastly_api_key is the personal API token for fastly account
fastly_api_key: $FASTLY_API_KEY
@@ -198,7 +200,7 @@ Linode can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: linode
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# linode_personal_access_token is the personal access token for Linode account
linode_personal_access_token: $LINODE_PERSONAL_ACCESS_TOKEN
@@ -217,7 +219,7 @@ Namecheap can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: namecheap
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# namecheap_api_key is the api key for namecheap account
namecheap_api_key: $NAMECHEAP_API_KEY
@@ -243,7 +245,7 @@ Alibaba Cloud can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: alibaba
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# alibaba_region_id is the region id of the resources
alibaba_region_id: $ALIBABA_REGION_ID
@@ -268,7 +270,7 @@ Terraform can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: terraform
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
#tf_state_file is the location of terraform state file (terraform.tfsate)
tf_state_file: path/to/terraform.tfstate
@@ -282,7 +284,7 @@ Hashicorp Consul can be integrated by using the following configuration block.
provider: consul
# consul_url is the url for consul server
consul_url: http://localhost:8500/
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# consul_ca_file is the path to consul CA file
# consul_ca_file: <path-to-ca-file>.pem
@@ -310,7 +312,7 @@ Hashicorp Nomad can be integrated by using the following configuration block.
provider: nomad
# nomad_url is the url for nomad server
nomad_url: http://127.0.0.1:4646/
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# nomad_ca_file is the path to nomad CA file
# nomad_ca_file: <path-to-ca-file>.pem
@@ -337,11 +339,32 @@ Hetzner Cloud can be integrated by using the following configuration block.
```yaml
- # provider is the name of the provider
provider: hetzner
id is the name defined by user for filtering (optional)
# id is the name defined by user for filtering (optional)
id: staging
# auth_token is the is the hetzner authentication token
auth_token: $HETZNER_AUTH_TOKEN
```

References -
- https://docs.hetzner.cloud/#authentication

### Kubernetes

Kubernetes can be integrated by using the following configuration block.

```yaml
- # provider is the name of the provider
provider: kubernetes
# id is the name defined by user for filtering (optional)
id: staging
# kubeconfig is the path to kubeconfig file
kubeconfig: path/to/kubeconfig
# context is the context to be used from kubeconfig file (optional), if not specified, current-context will be used
context: <context-name>
```

References -
- https://www.redhat.com/sysadmin/kubeconfig
- https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
- https://learn.microsoft.com/en-us/azure/aks/control-kubeconfig-access#get-and-verify-the-configuration-information
- https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#store_info
Loading

0 comments on commit b665ee8

Please sign in to comment.