Skip to content

Commit 1672b47

Browse files
authored
Merge pull request #113 from Sunny6889/fix_risk_scan
fix: audit risk
2 parents 39e5322 + 6442b91 commit 1672b47

29 files changed

Lines changed: 1436 additions & 137 deletions

.github/workflows/docker-s3-deploy.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,47 @@ jobs:
3636
exit 1
3737
fi
3838
39-
- name: Import GPG key
40-
uses: crazy-max/ghaction-import-gpg@v6
41-
with:
42-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
43-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
39+
- name: Install cosign
40+
uses: sigstore/cosign-installer@v3
4441

45-
- name: Sign tron-docker.zip with GPG
42+
- name: Sign tron-docker.zip with Sigstore cosign (keyless)
43+
# Keyless signing using GitHub OIDC — no private keys to manage or leak.
44+
# The signature is bound to this workflow's identity (repo, ref, commit SHA).
45+
# Verification: cosign verify-blob --certificate tron-docker.zip.cert \
46+
# --signature tron-docker.zip.sig \
47+
# --certificate-identity-regexp "https://github.com/tronprotocol/tron-docker" \
48+
# --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
49+
# tron-docker.zip
4650
run: |
47-
gpg --detach-sign --armor tron-docker.zip
48-
# This creates tron-docker.zip.asc (ASCII-armored signature)
51+
cosign sign-blob tron-docker.zip \
52+
--yes \
53+
--output-signature tron-docker.zip.sig \
54+
--output-certificate tron-docker.zip.cert
4955
50-
- name: Configure AWS Credentials
56+
- name: Configure AWS Credentials (OIDC — no long-lived keys)
5157
uses: aws-actions/configure-aws-credentials@v4
5258
with:
53-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
54-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55-
aws-region: ${{ github.event.inputs.aws-region }} # Use input for region
59+
# Uses GitHub OIDC provider to assume an IAM role with short-lived credentials.
60+
# No static keys needed — credentials expire after the workflow run.
61+
# Prerequisites:
62+
# 1. Create an IAM OIDC identity provider for token.actions.githubusercontent.com
63+
# 2. Create an IAM role with trust policy allowing this repo:
64+
# "Condition": {
65+
# "StringEquals": {
66+
# "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
67+
# "token.actions.githubusercontent.com:sub": "repo:tronprotocol/tron-docker:ref:refs/heads/main"
68+
# }
69+
# }
70+
# 3. Attach S3 put-object policy scoped to the target bucket only
71+
# 4. Delete the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets from GitHub
72+
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }}
73+
aws-region: ${{ github.event.inputs.aws-region }}
5674

5775
- name: Upload tron-docker.zip to S3
76+
env:
77+
BUCKET_NAME: ${{ github.event.inputs.bucket-name }}
78+
VERSION: ${{ github.event.inputs.version }}
5879
run: |
59-
zip -r publish.zip tron-docker.zip tron-docker.zip.asc
60-
aws s3 cp publish.zip s3://${{ github.event.inputs.bucket-name }}/package/publish-latest.zip
61-
aws s3 cp publish.zip s3://${{ github.event.inputs.bucket-name }}/package/publish-${{github.event.inputs.version}}.zip
80+
zip -r publish.zip tron-docker.zip tron-docker.zip.sig tron-docker.zip.cert
81+
aws s3 cp publish.zip "s3://${BUCKET_NAME}/package/publish-latest.zip"
82+
aws s3 cp publish.zip "s3://${BUCKET_NAME}/package/publish-${VERSION}.zip"

conf/private_net_config_witness1.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ genesis.block = {
272272
}
273273

274274
localwitness = [
275-
# address TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY
275+
# IMPORTANT: This is a DEMO private key for local testing ONLY
276+
# Address: TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY
277+
# WARNING: Replace with your own generated key for any real deployment
278+
# NEVER use this key on mainnet with real funds
276279
da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 # you must enable this value and the witness address are match.
277280
]
278281

conf/private_net_config_witness2.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ genesis.block = {
274274
}
275275

276276
localwitness = [
277-
# address TCjptjyjenNKB2Y6EwyVT43DQyUUorxKWi
277+
# IMPORTANT: This is a DEMO private key for local testing ONLY
278+
# Address: TCjptjyjenNKB2Y6EwyVT43DQyUUorxKWi
279+
# WARNING: Replace with your own generated key for any real deployment
280+
# NEVER use this key on mainnet with real funds
278281
0ab0b4893c83102ed7be35eee6d50f081625ac75a07da6cb58b1ad2e9c18ce43 # you must enable this value and the witness address are match.
279282
]
280283

conf/private_net_layout.toml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1+
# SECURITY WARNING: This file contains sensitive configuration for remote node deployment.
2+
# DO NOT commit actual credentials, SSH keys, or real hostnames to the repository.
3+
# Use environment variables, .env files (added to .gitignore), or secure credential management systems.
4+
# See: https://12factor.net/config
5+
#
6+
# Example configuration for private network layout:
7+
18
# [[nodes]]
2-
# node_ip = "192.168.1.1" # Remote node's IP
9+
# node_ip = "127.0.0.1" # Remote node's IP
310
# node_directory = "/path/to/direcotry" # Remote node's working direcotry for node
411
# config_file = "/path/to/config" # Config file for remote node
5-
# docker_compose_file =/path/to/config # Config docker-compose file for remote node
12+
# docker_compose_file ="/path/to/config" # Config docker-compose file for remote node
613
# node_type = "fullnode/sr" # Fullnode or SR node
714
# ssh_port = 22
815
# ssh_user = "user1"
916
# ssh_password = "password1" # Optional; uncomment if using password auth
1017
# # ssh_key = "/path/to/key1" # Optional; uncomment if using key auth
1118

1219
# [[nodes]]
13-
# node_ip = "192.168.1.2" # Changed IP to demonstrate different nodes
20+
# node_ip = "127.0.0.1" # Changed IP to demonstrate different nodes
1421
# node_directory = "/path/to/directory"
1522
# config_file = "/path/to/config"
16-
# docker_compose_file =/path/to/config # Config docker-compose file for remote node
23+
# docker_compose_file ="/path/to/config" # Config docker-compose file for remote node
1724
# node_type = "fullnode/sr"
1825
# ssh_port = 2222 # Custom SCP port for this node
1926
# ssh_user = "user2"
2027
# # No password or key; assumes SSH agent or pre-configured key
2128

2229

2330
[[nodes]]
24-
node_ip = "ec2-3-25-116-244.ap-southeast-2.compute.amazonaws.com"
25-
node_directory = "/home/ubuntu/mytest"
26-
config_file = "/Users/ubuntu/conf/private_net_config_others.conf"
27-
docker_compose_file = "/Users/ubuntu/docker-compose.yml"
31+
node_ip = "127.0.0.1" # Replace with your actual node IP or hostname
32+
node_directory = "/path/to/tron-node" # Replace with your actual node directory
33+
config_file = "/path/to/private_net_config.conf" # Replace with your actual config path
34+
docker_compose_file = "/path/to/docker-compose.yml" # Replace with your actual docker-compose path
2835
ssh_port = 22
29-
ssh_user = "ubuntu"
30-
# ssh_password = "password1"
31-
ssh_key = "/Users/ubuntu/Downloads/test-ci.pem" # Optional; uncomment if using key auth
36+
ssh_user = "ubuntu" # Replace with your actual SSH user
37+
# ssh_password = "password" # Optional; uncomment if using password auth (NOT RECOMMENDED)
38+
# ssh_key = "/path/to/your/private/key" # Optional; uncomment if using key auth
39+
# SECURITY WARNING: Never commit actual SSH keys or private credentials to the repository!
40+
# Use environment variables or secure credential management systems instead.

metric_monitor/REMOTE_WRITE_WITH_THANOS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,18 @@ docker-compose -f ./docker-compose/docker-compose-alloy.yml up -d
145145
The [Thanos Receive](https://thanos.io/tip/components/receive.md/#receiver) service implements the Prometheus Remote Write API. It builds on top of the existing Prometheus TSDB and retains its usefulness while extending its functionality with long-term-storage, horizontal scalability, and downsampling. Prometheus instances are configured to continuously write metrics to it. Thanos Receive exposes the StoreAPI so that Thanos Queriers can query received metrics in real-time.
146146

147147

148-
First, deploy [Minio](https://github.com/minio/minio) for long-term metric storage. Minio offers S3-compatible object storage functionality, allowing Thanos Receive to upload TSDB blocks to storage buckets at 2-hour intervals. While this guide uses Minio, you can opt for any storage service from the [Thanos Supported Clients](https://thanos.io/tip/thanos/storage.md/#supported-clients) list. For long-term monitoring, we recommend implementing a retention policy on your storage service to efficiently manage historical metric data. For instance, you might configure an S3 lifecycle policy when using AWS to automatically remove metrics older than one year.
148+
First, deploy [Minio](https://github.com/minio/minio) for long-term metric storage. Minio offers S3-compatible object storage functionality, allowing Thanos Receive to upload TSDB blocks to storage buckets at 2-hour intervals.
149+
150+
**⚠️ Important**: The MinIO configuration in this guide uses demo credentials (`minio`/`melovethanos`) for local testing only. For production deployments, use AWS S3 or other cloud storage services with proper IAM credentials, or generate strong unique credentials if using MinIO.
151+
152+
While this guide uses Minio, you can opt for any storage service from the [Thanos Supported Clients](https://thanos.io/tip/thanos/storage.md/#supported-clients) list. For long-term monitoring, we recommend implementing a retention policy on your storage service to efficiently manage historical metric data. For instance, you might configure an S3 lifecycle policy when using AWS to automatically remove metrics older than one year.
153+
149154
```sh
150-
# Start Minio
155+
# Start Minio (for local testing only)
151156
docker-compose -f ./docker-compose/minio.yml up -d
152157
153158
# First set the MinIO alias with root credentials to enable bucket creation permissions
159+
# Note: These are demo credentials - replace with your own in production
154160
docker exec minio mc alias set local http://localhost:9000 minio melovethanos
155161
156162
# Then create the bucket

metric_monitor/conf/bucket_storage.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ config:
33
bucket: "test-thanos-001"
44
endpoint: "minio:9000" # for example: s3.ap-southeast-1.amazonaws.com for AWS S3 on region ap-southeast-1
55
insecure: true # True for local test using http instead of https
6+
# ⚠️ DEMO CREDENTIALS FOR LOCAL TESTING ONLY ⚠️
7+
# These match the MinIO demo credentials and should NEVER be used in production
8+
# For production: Use AWS S3 with proper IAM roles or access keys
69
access_key: "minio"
710
secret_key: "melovethanos"

0 commit comments

Comments
 (0)