Skip to content

koaqiu/oss-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OSS管理工具

GitHub Release GitHub Actions Workflow Status GitHub go.mod Go version GitHub License

目前唯一的功能就是 更新 bucket的自定义域名的SSL证书。

要求必须先配置好一个自定义域名,以及正常可用的SSL证书(pemkey)。

使用

# powershell
# 克隆
git clone https://github.com/koaqiu/oss-utils.git
cd oss-utils
go env -w GOPROXY=https://goproxy.cn,direct ; go mod tidy ; go build # 编译
# 编译成功以后
.\oss-utils.exe ssl --bucket BUCKET --region cn-shanghai --cert domain.pem --key domain.key

配合certbot等证书工具使用更佳。

配置

  • 需要阿里云的RAM账号的 OSS_ACCESS_KEY_IDOSS_ACCESS_KEY_SECRET,并设置到环境变量中。程序会自动读取。
  • 需要为这个账号配置对于权限(参考下面的代码)https://ram.console.aliyun.com/policies/create

自定义策略

{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "oss:PutCname",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "yundun-cert:DescribeSSLCertificatePrivateKey",
        "yundun-cert:DescribeSSLCertificatePublicKeyDetail",
        "yundun-cert:CreateSSLCertificate"
      ],
      "Resource": "*"
    }
  ]
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Languages