From 5dc07cea1a48e25747e6c5803238be1a484ff8ab Mon Sep 17 00:00:00 2001 From: Anton Yurchenko Date: Sat, 29 Jan 2022 22:26:32 +0200 Subject: [PATCH] 1.1.0 --- .github/workflows/release.yml | 18 +++++++--- CHANGELOG.md | 8 +++++ README.md | 5 +-- internal/app/config.go | 2 +- scripts/install.sh | 1 + scripts/install_arm64.sh | 56 ++++++++++++++++++++++++++++++++ scripts/install_cronjob.sh | 1 + scripts/install_cronjob_arm64.sh | 16 +++++++++ 8 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 scripts/install_arm64.sh create mode 100644 scripts/install_cronjob_arm64.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7ddabe..f457705 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,15 +32,23 @@ jobs: - name: Test run: go test -v $(go list ./... | grep -v vendor | grep -v mocks) -race -coverprofile=coverage.txt -covermode=atomic - - name: Build - run: GOOS=linux GOARCH=amd64 go build -o ssh-manager + - name: Build AMD64 + run: | + GOOS=linux GOARCH=amd64 go build -o ssh-manager + zip ssh-manager-linux-amd64.zip ssh-manager LICENSE.md + rm -f ssh-manager - - name: Pack - run: zip ssh-manager.zip ssh-manager LICENSE.md + - name: Build ARM64 + run: | + GOOS=linux GOARCH=arm64 go build -o ssh-manager + zip ssh-manager-linux-arm64.zip ssh-manager LICENSE.md + rm -f ssh-manager - name: Release uses: docker://antonyurchenko/git-release:v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: ssh-manager.zip + args: | + ssh-manager-linux-amd64.zip + ssh-manager-linux-arm64.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index ef48a21..3bd3470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.0] - 2022-01-29 +## Added +- Support ARM64 architecture + +## Changed +- Updated dependencies + ## [1.0.6] - 2021-07-28 ## Changed - Updated dependencies @@ -35,6 +42,7 @@ ## [1.0.0] - 2021-02-10 - First release +[1.1.0]: https://github.com/ReasonSoftware/ssh-manager/compare/v1.0.6...v1.1.0 [1.0.6]: https://github.com/ReasonSoftware/ssh-manager/compare/v1.0.5...v1.0.6 [1.0.5]: https://github.com/ReasonSoftware/ssh-manager/compare/v1.0.4...v1.0.5 [1.0.4]: https://github.com/ReasonSoftware/ssh-manager/compare/v1.0.3...v1.0.4 diff --git a/README.md b/README.md index 7df6df6..fdadfb8 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - Only public SSH key is used, private key never leave user's workstation - Leverage AWS IAM for service authentication - SystemD Service +- Supports AMD64/ARM64 ## Manual @@ -119,8 +120,8 @@ ### Installation -- Download installation script: `curl https://raw.githubusercontent.com/ReasonSoftware/ssh-manager/master/scripts/install.sh --output install.sh` - - Alternative script that relies on **crontab**: `curl https://raw.githubusercontent.com/ReasonSoftware/ssh-manager/master/scripts/install_cronjob.sh --output install.sh` +- Download installation script: `curl https://raw.githubusercontent.com/ReasonSoftware/ssh-manager/master/scripts/install.sh --output install.sh` (or `install_arm64.sh`) + - Alternative script that relies on **crontab**: `curl https://raw.githubusercontent.com/ReasonSoftware/ssh-manager/master/scripts/install_cronjob.sh --output install.sh` (or `install_cronjob_arm64.sh`) - Execute with elevated privileges: `sudo bash install.sh`
:information_source: Manual Installation diff --git a/internal/app/config.go b/internal/app/config.go index 8681df1..40576d7 100644 --- a/internal/app/config.go +++ b/internal/app/config.go @@ -9,7 +9,7 @@ import ( ) // Version contains current application version -const Version string = "1.0.6" +const Version string = "1.1.0" // Config represents a remote configuration type Config struct { diff --git a/scripts/install.sh b/scripts/install.sh index 7115d64..2cb95a1 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -6,6 +6,7 @@ mkdir -p /var/lib/ssh-manager wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ grep browser_download_url | \ + grep linux-amd64 | \ awk -F': ' '{print $2}' | \ tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip diff --git a/scripts/install_arm64.sh b/scripts/install_arm64.sh new file mode 100644 index 0000000..d98ab48 --- /dev/null +++ b/scripts/install_arm64.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +set -e + +rm -rf /var/lib/ssh-manager +mkdir -p /var/lib/ssh-manager + +wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ + grep browser_download_url | \ + grep linux-arm64 | \ + awk -F': ' '{print $2}' | \ + tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip + +unzip -j /var/lib/ssh-manager/ssh-manager.zip -d /var/lib/ssh-manager +rm -f /var/lib/ssh-manager/ssh-manager.zip + +SERVICE=$(cat <<-EOF +[Unit] +Description=Central SSH Management Service for AWS Linux EC2 +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/var/lib/ssh-manager/ssh-manager +StandardOutput=journal +User=root + +[Install] +WantedBy=multi-user.target +EOF +) + +echo "$SERVICE" > /etc/systemd/system/ssh-manager.service + +TIMER=$(cat <<-EOF +[Unit] +Description=Timer for Central SSH Management Service +Wants=network-online.target +After=network-online.target + +[Timer] +Unit=ssh-manager.service +OnBootSec=1min +OnUnitInactiveSec=60min +Persistent=true + +[Install] +WantedBy=multi-user.target +EOF +) + +echo "$TIMER" > /etc/systemd/system/ssh-manager.timer + +systemctl daemon-reload +systemctl enable ssh-manager.service +systemctl enable --now ssh-manager.timer diff --git a/scripts/install_cronjob.sh b/scripts/install_cronjob.sh index ad1ef21..394da11 100644 --- a/scripts/install_cronjob.sh +++ b/scripts/install_cronjob.sh @@ -6,6 +6,7 @@ mkdir -p /var/lib/ssh-manager wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ grep browser_download_url | \ + grep linux-amd64 | \ awk -F': ' '{print $2}' | \ tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip diff --git a/scripts/install_cronjob_arm64.sh b/scripts/install_cronjob_arm64.sh new file mode 100644 index 0000000..f61d0b7 --- /dev/null +++ b/scripts/install_cronjob_arm64.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +rm -rf /var/lib/ssh-manager +mkdir -p /var/lib/ssh-manager + +wget $(curl -si https://api.github.com/repos/ReasonSoftware/ssh-manager/releases/latest | \ + grep browser_download_url | \ + grep linux-arm64 | \ + awk -F': ' '{print $2}' | \ + tr -d '"') -O /var/lib/ssh-manager/ssh-manager.zip + +unzip -j /var/lib/ssh-manager/ssh-manager.zip -d /var/lib/ssh-manager +rm -f /var/lib/ssh-manager/ssh-manager.zip + +(echo "0 * * * * bash -lc '/var/lib/ssh-manager/ssh-manager > /var/lib/ssh-manager/execution.log'") | crontab -