Preface
We often need to send text, links or files to friends on WeChat, QQ or other similar chat tools, but you should know that in the current severe environment (which will become increasingly severe in the future), everything you send is recorded and will be kept for 3-5 years. Although we are all law-abiding citizens and have nothing to hide... but it is always very annoying to have others look at what you send at will, and at this time, "burn after reading" is a very good solution (it can generate a one-time link or QR code, and once the link or QR code is opened and viewed once, it becomes invalid). Unfortunately, in our country, services like "burn after reading" are taboo, for reasons you know, so if you want to use this type of service, the best way is to use one provided by others or build it yourself.
For someone like me who practices "self-reliance" and owns a decent-sized "home data center," I of course, absolutely, and definitely chose to self-host. Naturally, this brought up the question of choice, as there are quite a few options out there:
PasteMe
Actually, this project is quite good. Unfortunately, after being summoned by authorities once, it hasn't been updated for over 2 years. Its original features were very powerful:


It's clear that PasteMe's strength lies mainly in text sharing and its compatibility with curl and wget to retrieve code. However, after being investigated, the new version of PasteMe in an unlogged-in state only allows reading once or expires after 5 minutes, with no option for multiple reads. Most importantly, the user system hasn't even been started yet... Therefore, its usage is extremely limited, and it can only be used simply as a self-destructing service. What a pity.
NaiveBoom
This one is indeed overly simple. It has no options at all; you can only paste text content and generate a one-time link. Minimalists might like it, but it's similar to the crippled PasteMe:

Privatebin
This one is much more powerful:

Optional "expiration time" (up to 1 hour), optional "burn after reading" (check to read once, uncheck for unlimited reads), optional "password", optional "attachment", and optional "format" (plain text, source code, markdown). Overall, the features provided are powerful enough and completely sufficient, making it a viable option.
cryptgeon

In terms of features, it is pretty much the same as Privatebin, with some differences in the details:
Number of views:
For example, cryptgeon allows you to set the number of views, up to a maximum of 100 times; Privatebin only lets you choose to read once or keep it forever, and when kept forever, it even allows open discussions.
Expiration time:
cryptgeon's expiration time can be set up to 6 hours; Privatebin's is up to 1 hour.
Password:
In cryptgeon, besides setting the password manually, it can also be automatically generated (Privatebin only supports manual setup).
After comparison, both 3 and 4 meet my requirements in terms of features, but 3 wins in terms of customizability:
Privatebin has more customization options and can be used with MariaDB or MySQL. If you want to store text data long-term, Privatebin wins hands down, because cryptgeon's content can only be stored in memory, and once restarted, everything is gone. Reasonably, I should have chosen Privatebin. But the problem is, this is going on the public internet... Why did PasteMe get investigated? Precisely because it allowed permanent storage, which was then exploited by people to spread certain things. If it supported registration, I wouldn't be as worried, but the key is that neither 3 nor 4 supports it. So after much thought, I still chose cryptgeon because it cannot achieve permanent storage: either 100 views or 6 hours.
Deploy cryptgeon
Because Redis acceleration is required, an additional bridge named "public-net" needs to be created to connect Redis and cryptgeon.
Create public-net network
docker network create public-net
Deploy redis
Creating the directory on the host machine that needs to be mounted inside the container
mkdir -p /docker/redis/data
Deploy redis
The docker run command format is as follows:
docker run --name redis -d --restart=always --net=public-net \
-p 6379:6379 \
-v /docker/redis/data:/data \
redis
Create cryptgeon
The docker run command format is as follows:
docker run --name cryptgeon -d --restart=always --net=public-net \
-e redis=redis://redis \ #指定redis的地址
-e SIZE_LIMIT=100M \ #单个note的最大大小,这个大家根据自己的需要进行设置
-p 9030:8000 \ #映射宿主机的端口到容器内部的8000,宿主机端口大家根据自己实际环境设置
cupcakearmy/cryptgeon
Deploy Privatebin (Bonus Content)
-v /docker/redis/data:/data \
Creating the directory on the host machine that needs to be mounted inside the container
mkdir -p /docker/privatebin/data
Deploy Privatebin
docker run --name privatebin -d --restart=always --net=public-net \
--read-only \ #该镜像支持以只读模式运行。使用这种模式可略微降低攻击面,因为利用其中一个镜像服务的漏洞无法覆盖容器中的任意文件。只有 /tmp、/var/tmp、/var/run 和 /srv/data 可被写入
-p 8080:8080 \ #映射宿主机的8080端口到容器的8080端口,这个大家可以根据自己实际情况进行调整
-v /docker/privatebin/conf.php:/srv/cfg/conf.php:ro \ #可选项,如果大家准备使用mariadb或者mysql,或进行其他定制化,例如广告等,则可以进行此操作,不过需要先创建一次容器然后将conf.php文件复制出来
-v /docker/privatebin/data:/srv/data #系统文件夹的路径,粘贴和其他服务数据保存在该文件夹中。这样可以确保在停止和重启镜像或更换镜像后,粘贴不会丢失。
privatebin/nginx-fpm-alpine
Configure public network access
-e redis=redis://redis \ # Specify the Redis address
1、Docker Series: Building Your Own Reverse Proxy Based on NPM Using Docker
2、Linux Panel Series: Configuring Reverse Proxy and Publishing Using Non-443 Ports
3、Home Data Center Series: Getting Cloudflare for Free via Domestic ICP-Filed Cloud Hosts to Achieve Fast Access to Domestic Sites from Abroad
4、Home Data Center Series: Getting Cloudflare for Free via Home Broadband Without Public IP to Achieve Fast Website Building (Universal)
Among them, the 1st and 2nd methods are suitable for environments with a public IP but without a legal 443 port (home broadband, non-filed cloud hosts), where non-standard ports need to be added after the URL (if using Cloudflare to build a website, no port needs to be added, but you need to customize the origin server port, which you can refer to:Home Data Center Series: Solving the Problem of Having a Public IP but No Legal 80 or 443 Ports for Website Building via Cloudflare's Origin Rules). The 3rd method is suitable for cloud hosts with ICP filing, and the 4th method is suitable for all environments (including environments without a public IP), which is also my recommended method (regardless of whether your environment has a public IP, because this method does not require running HTTPS traffic directly on the public network).
Afterword
-e SIZE_LIMIT=100M \ # Maximum size of a single note, set this according to your needs
-p 9030:8000 \ # Map the host port to port 8000 inside the container, set the host port according to your actual environment


cupcakearmy/cryptgeonGiven that some friends might be more stubborn and prefer permanent storage, I am also putting up the deployment commands for Privatebin for everyone to study.。
docker run --name privatebin -d --restart=always --net=public-net \
--read-only \ # This image supports running in read-only mode. Using this mode slightly reduces the attack surface, as exploiting a vulnerability in one of the image services cannot overwrite arbitrary files in the container. Only /tmp, /var/tmp, /var/run, and /srv/data can be written to
-p 8080:8080 \ # Map port 8080 of the host to port 8080 of the container, you can adjust this according to your actual situation