Giter VIP home page Giter VIP logo

soss's Introduction

SOSS (Secure Object Storage Service)

一个可以在把文件上传到阿里云OSS之前加密,下载时自动解密的小工具。

准备工作

pip install -r requirements.txt

在你的阿里云管理系统内,找到下面的内容:

  • OSS Bucket的endpoint(例如oss-cn-hangzhou.aliyuncs.com
  • OSS Bucket的名字
  • 你的用户的access key(推荐使用RAM用户)
    • export OSS_ACCESS_KEY_ID=<KEY ID>
    • export OSS_ACCESS_KEY_SECRET=<KEY SECRET>

config.json中,配置好endpointbucket。如果不想使用config.json,也可以在命令行作为参数输入。

使用说明

文件列表

# 如果配置好了config.json
python soss.py list
python soss.py list --prefix data/

# 如果想在命令行输入bucket和endpoint
python soss.py list -b bucket_name -e endpoint

上传文件

python soss.py upload -k my_password text.txt image.png

# 支持上传整个文件夹的内容,文件夹所有内容会保持结构上传到bucket根目录
python soss.py upload -k my_password data/

# 设置bucket保存路径的prefix,文件夹所有内容会保持结构上传到data/目录
python soss.py upload -k my_password --prefix data/ data/

# 如果encrypt key是一个32或者64位的hex,则直接作为AES的key使用,否则进行SHA256,转换成32 byte的key
python soss.py upload -k deadbeef12345678deadbeef87654321 text.txt

# 同样也可以传入bucket和endpoint
python soss.py upload -b bucket -e endpoint -k my_password text.txt

下载文件

python soss.py download -k my_password text.txt image.png

# 指定保存文件夹
python soss.py download -k my_password --output_dir ./data text.txt image.png

# 剩下的参数和upload一样

LICENSE

Copyright 2024 Tian Gao.

Distributed under the terms of the Apache 2.0 license

soss's People

Contributors

gaogaotiantian avatar xiaoqingma0 avatar

Stargazers

 avatar DBArtist avatar masx200 avatar Terminal avatar  avatar 黄泳 avatar  avatar Ryze avatar JanLam avatar Jiajie Zhang avatar  avatar  avatar Bader avatar Neo avatar TooYooG avatar oy avatar Jiaqigege avatar wuwang avatar J.-C. Jiang avatar wangsl avatar 张千军 avatar Hao Luan avatar 冷柠 avatar harutono avatar 新檀黎斗 avatar Haotian Zou avatar

Watchers

 avatar  avatar

soss's Issues

视频评论区被控评了,来这贴一条

阿里云OSS有现成的管理客户端啊,自己本地做下加密解密就好,自己的数据最好还是做多硬盘备份,成本比上云要划算很多,云厂商都是初始便宜,续费贵的要死,而且一旦密钥泄漏了,虽然别人看不到你的内容,但是可以给你删了,让你付费赎回,过来人奉劝各位小白,白嫖玩玩就好,数据无价,千万谨慎!

这种方案来存私密文件对小白来说缺点大于优点

我个人认为oss不适用于这个场景,反而 我觉得比较正常的方案是,找个文件加密软件,机密之后 多个网盘存一份不就好了。
这样你就有多个备份,而不是aliyun oss 一家,况且就是前不久 aliyun也出现服务中断事故,比起这一家出现事故的概率,
和多个网盘的备份,显然多个网盘不可用的概率更小。以上是个人观点

你真的需要OSS吗?

使用阿里云OSS的利与弊

优点

  • S3兼容,阿里云OSS可以在大多数S3兼容的应用中使用
  • 直链,允许公网直链访问

缺点

  • 安全性,存在流量盗刷、秘钥泄漏等安全问题。
  • 成本,OSS本身的存储成本就不低,流量和https请求数都是额外计费项目。虽然可以通过CDN来降低流量成本,但是CDN的成本也不低。
  • 性能,OSS的带宽和IOPS都不高。

你真的需要使用OSS吗?

替代方案

  • 云盘存储,例如百度网盘。尽管百度网盘的速度为人诟病,但是在没有S3API需求的情况下,它的存储成本和流量成本都远远低于OSS;更何况免费用户也有2T的存储空间。
  • 自建NAS,如果有公网IP,那么你完全可以使用它来搭建一个NAS,这样你就可以在家里、公司、学校等地方访问你的文件了。

实际场景

如果你的文件较为重要,那么你应当使用多端备份以提高安全性。

例如,可以使用百度网盘的免费2TB空间,以及其他网盘的免费空间作为冷备份,使用本地存储或者NAS存储和热更新数据。

如果没有公网IP,那么你可以选择以下方式,使你的文件可以在任何地方访问:

  • FRP内网穿透服务,例如Natapp等。
  • 使用自有的VPS搭建FRP/Ngrok服务。
  • 使用Cloudflare免费的Argo Tunnel服务,缺点是速度较慢。

平替方案

SFSS-本地文件的AES加密

真是吃相难看,控制评论区,战老的脸都被丢光了

评论区设置关键字吞评论,还删评论,那咋不直接关了评论区呢?

后来只能发倒图评论,但是几小时后又被手动删除了,我把原评论图片贴在这里,大家看看我要是说的不对的,您使劲怼我,我公开道歉,后面还有我小号录屏的视频证明我当时确实发出去了,但是现在无了,可以确认是UP手动删除的。

如果还有其他有志之士的评论被删除了,也请你们贴在下方,感谢!

WechatIMG862

57_1710681732.mp4

Why not use AES-GCM instead of AES-CTR for encryption?

Hello,

First, thank you for the hard work and effort put into developing the SOSS project. I have a question regarding the encryption method used in the soss.py script.

Currently, the script uses AES in CTR (Counter Mode) for encryption:

cipher = AES.new(self.encrypt_key, AES.MODE_CTR, nonce=nonce)

While AES-CTR is a robust encryption method, it does not inherently provide data integrity and authenticity checks. On the other hand, AES-GCM (Galois/Counter Mode) combines encryption and integrity verification in one step, offering the following advantages:

  1. Built-in Authentication: AES-GCM provides both encryption and authentication, ensuring that the data has not been tampered with.
  2. Performance: AES-GCM is often optimized in modern processors, providing better performance than AES-CTR combined with a separate HMAC.
  3. Simplicity: Using AES-GCM can simplify the code by reducing the need for separate integrity checks.

Given these benefits, I was wondering if there was a specific reason for choosing AES-CTR over AES-GCM for the encryption in soss.py. Are there any considerations or constraints that led to this decision?

Thank you for your time and looking forward to your response.

Best regards,

xkrme

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.