diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml new file mode 100644 index 0000000..7d95ce8 --- /dev/null +++ b/.github/workflows/containers.yml @@ -0,0 +1,47 @@ +# REF: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub-and-github-packages + +name: Publish Docker Image + +on: + release: + types: [published] + +jobs: + push_to_registries: + name: Push Docker image to multiple registries + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to GitHub Container Registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + magneticstain/ip-2-cloudresource + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 59e6c01..e6d48bd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -35,8 +35,10 @@ changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - '^[Dd]eploy: ' + - '^[Mm]inor: ' + - '^[Tt]est: ' + - '^Merge ' release: github: owner: magneticstain @@ -65,6 +67,3 @@ brews: name: homebrew-ip2cr token: "{{ .Env.HOMEBREW_GITHUB_TOKEN }}" - - # pull_request: - # enabled: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..69744dd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 + +FROM golang:alpine3.19 + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download && go mod verify + +COPY . . +RUN go build -o ./ip2cr + +ENTRYPOINT [ "./ip2cr" ] +CMD [ "--help" ] \ No newline at end of file diff --git a/README.md b/README.md index 589ecac..aa82ee5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# ip-2-cloudresource +![IP2CR Logo](./assets/logo-transparent.png) + +--- [![Build and Test - Main Branch](https://github.com/magneticstain/ip-2-cloudresource/actions/workflows/build_main.yml/badge.svg)](https://github.com/magneticstain/ip-2-cloudresource/actions/workflows/build_main.yml) [![Build and Test - Release Branches](https://github.com/magneticstain/ip-2-cloudresource/actions/workflows/build_release.yml/badge.svg)](https://github.com/magneticstain/ip-2-cloudresource/actions/workflows/build_release.yml) @@ -7,7 +9,7 @@ [![Codacy Badge - Quality](https://app.codacy.com/project/badge/Grade/5137ec7cf2d14a9c9fc3eac1cd37e0d3)](https://app.codacy.com/gh/magneticstain/ip-2-cloudresource/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge - Coverage](https://app.codacy.com/project/badge/Coverage/5137ec7cf2d14a9c9fc3eac1cd37e0d3)](https://app.codacy.com/gh/magneticstain/ip-2-cloudresource/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) -![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/magneticstain/ip-2-cloudresource/v1.3.0) +![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/magneticstain/ip-2-cloudresource/v1.4.0) ![GitHub issues](https://img.shields.io/github/issues/magneticstain/ip-2-cloudresource) ![GitHub pull requests](https://img.shields.io/github/issues-pr/magneticstain/ip-2-cloudresource) ![GitHub all releases](https://img.shields.io/github/downloads/magneticstain/ip-2-cloudresource/total) @@ -16,7 +18,7 @@ IP-2-CloudResource (IP2CR) is a tool used for correlating a cloud IP address with its associated resources. It focuses on providing as much context to the user as possible, as fast as possible. -![IP2CR Demo](https://raw.githubusercontent.com/magneticstain/ip-2-cloudresource/main/assets/demo.gif) +![IP2CR Demo](./assets/demo.gif) ## Features @@ -44,6 +46,12 @@ IP-2-CloudResource (IP2CR) is a tool used for correlating a cloud IP address wit - [X] Add Support For Concurrent Account-Based Resource Searches When Running With AWS Org Support ( [Issue #141](https://github.com/magneticstain/ip-2-cloudresource/issues/141) ) - [X] Network path calculation ( [Issue #44](https://github.com/magneticstain/ip-2-cloudresource/issues/44) ) +#### 2024 + +- [X] Docker Support ( [Issue #367](https://github.com/magneticstain/ip-2-cloudresource/issues/367) ) +- [ ] GCP Support ( [Issue #361](https://github.com/magneticstain/ip-2-cloudresource/issues/361) ) +- [ ] Azure Support ( [Issue #362](https://github.com/magneticstain/ip-2-cloudresource/issues/362) ) + ## Prerequisites ### OS @@ -59,6 +67,36 @@ IP2CR supports running on n-1 minor versions of Golang, aka [stable and old-stab ## Install +### Docker + +The most portable way to install and run IP2CR is by using Docker. + +#### Via Container Registry + +The easiest way to run IP2CR in Docker is by using the public containers hosted on container registries. IP2CR images are available on both Docker Hub and GitHub Container Registry. See the commands below for how to run IP2CR using each registry. + +##### Docker Hub + +```bash +docker run --rm --name=ip-2-cloudresource magneticstain/ip-2-cloudresource +``` + +##### Github Container Registry + +```bash +docker run --rm --name=ip-2-cloudresource ghcr.io/magneticstain/ip-2-cloudresource +``` + +#### Via Local Build + +In the case that container registries are unavailable, there's also the option to build the image locally. To do that, check out the `main` branch of this repo, build the IP2CR image, and run it. + +```bash +git clone https://github.com/magneticstain/ip-2-cloudresource.git +docker build -t ip-2-cloudresource . +docker run --rm --name=ip-2-cloudresource ip-2-cloudresource +``` + ### Homebrew The easiest way to install IP2CR if you're using Mac OS is to use [Homebrew](https://brew.sh). With homebrew installed, run the following to install IP2CR: @@ -95,8 +133,8 @@ cd /opt/ip2cr/ After installing, run the `ip2cr` binary to see available parameters: ```bash -> ./ip2cr --help -Usage of ./ip2cr: +> ip2cr --help +Usage of ip2cr: -adv-ip-fuzzing Toggle the advanced IP fuzzing feature to perform a more intensive heuristics evaluation to fuzz the service (not recommended for IPv6 addresses) (default true) -ip-fuzzing diff --git a/assets/logo-transparent.png b/assets/logo-transparent.png new file mode 100644 index 0000000..9754be9 Binary files /dev/null and b/assets/logo-transparent.png differ diff --git a/main.go b/main.go index 231ee28..24ae7bf 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,7 @@ import ( "github.com/magneticstain/ip-2-cloudresource/utils" ) -const APP_VER = "v1.3.0" +const APP_VER = "v1.4.0" func outputResults(matchedResource resource.Resource, networkMapping bool, silent bool, jsonOutput bool) { acctAliasFmted := strings.Join(matchedResource.AccountAliases, ", ")