Temporary OBS Credentials for a Small Cloud Server

举报
yd_292978551 发表于 2026/11/04 10:28:23 2026/11/04
【摘要】 When a small cloud server needs to upload backups or user files to OBS, do not put a long-lived Access Key and Secret Key on the server. A leaked key can be reused from anywhere until someone notic...

When a small cloud server needs to upload backups or user files to OBS, do not put a long-lived Access Key and Secret Key on the server. A leaked key can be reused from anywhere until someone notices and rotates it. Temporary credentials, scoped to one bucket and one purpose, reduce that blast radius.

1. Create a dedicated agency or user for uploads only

Give the upload identity no console login and no permissions beyond OBS. For example, allow only PutObject and GetObject on one bucket path, such as backups/app/*. Deny listing other buckets and deny delete if the workload does not need it. Test with a single small file before wiring it into a backup job.

2. Issue short-lived credentials at run time

Request temporary security credentials when the job starts, use them for that job, and let them expire. A lifetime of minutes to a few hours is usually enough for a backup upload. Avoid writing the temporary token to logs, shell history, or a world-readable config file. If a job needs to run unattended, prefer an agency attached to the server over a credential stored on disk.

3. Harden the server side as well

The credential is only one layer. Keep SSH key-only login, keep fail2ban or an equivalent login guard enabled, and allow outbound traffic to OBS only where the network policy permits it. Rotate the underlying long-lived credential if it was ever copied to a workstation, shared in chat, or committed to a repository, even by accident.

4. A simple checklist before you rely on it

  • One bucket, one path prefix, and only the actions the job needs.
  • Short expiry, and no credential in logs or version control.
  • A test upload, a test download, and a failed attempt from an out-of-scope path.
  • A rotation plan for the day a credential is exposed.

Least privilege is not extra paperwork for a small server. It is the difference between a single compromised upload job and a compromised storage account.

【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0)

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。