-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and, why not. Share arbitrary sets of files via HTTP/FTP/SFTP/WEBDAV/…
…RESTIC/... w/some access controls and expriring access-- poc w/rclone
- Loading branch information
John Major
committed
Jul 24, 2024
1 parent
11a66cf
commit 47cfa4f
Showing
9 changed files
with
257 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Set the path to your .aws directory | ||
AWS_DIR="$HOME/.aws" | ||
CREDENTIALS_FILE="$AWS_DIR/credentials" | ||
CONFIG_FILE="$AWS_DIR/config" | ||
|
||
# Function to read the AWS credentials | ||
read_aws_credentials() { | ||
local profile=$1 | ||
local aws_access_key_id aws_secret_access_key | ||
|
||
aws_access_key_id=$(grep -A 2 "\[$profile\]" "$CREDENTIALS_FILE" | grep aws_access_key_id | awk '{print $3}') | ||
aws_secret_access_key=$(grep -A 2 "\[$profile\]" "$CREDENTIALS_FILE" | grep aws_secret_access_key | awk '{print $3}') | ||
|
||
export AWS_ACCESS_KEY_ID=$aws_access_key_id | ||
export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key | ||
} | ||
|
||
# Function to read the AWS config | ||
read_aws_config() { | ||
local profile=$1 | ||
local region | ||
|
||
region=$(grep -A 2 "\[$profile\]" "$CONFIG_FILE" | grep region | awk '{print $3}') | ||
|
||
export AWS_REGION=$region | ||
} | ||
|
||
# Read the default profile by default, or use the AWS_PROFILE environment variable if set | ||
PROFILE="${AWS_PROFILE:-default}" | ||
|
||
# Read and export the AWS credentials and config | ||
read_aws_credentials $PROFILE | ||
read_aws_config $PROFILE | ||
|
||
# Print out the values to confirm | ||
echo "AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID" | ||
echo "AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY" | ||
echo "AWS_REGION: $AWS_REGION" | ||
|
||
# Example usage of rclone with the set environment variables | ||
# rclone ls s3:your-bucket-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[blms3] | ||
type = s3 | ||
provider = AWS | ||
env_auth = true | ||
region = us-west-2 | ||
location_constraint = us-west-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.