PrivateBin¶
PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data.
Data is encrypted and decrypted in the browser using 256bit AES in Galois Counter mode.
License¶
PrivateBin consists of PHP and JS code which was originally written by Sébastien Sauvage in 2012 and falls under the Zlib/libpng license. All relevant legal information can be found in the Github repository of the project.
Prerequisites¶
We’re using PHP in the stable version 8.1:
[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '8.1'
[isabell@stardust ~]$
The domain you want to use must be set up:
[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$
Installation¶
Download the source¶
Check Github for the latest release and copy the download link to the .tar.gz file.
Then cd
to your ~/html
folder and use wget
to download it. Replace the URL with the one you just copied.
[isabell@stardust ~]$ cd ~/html
[isabell@stardust html]$ wget https://github.com/PrivateBin/PrivateBin/archive/1.5.0.tar.gz
[…]
Saving to: ‘1.5.0.tar.gz’
100%[=================================================>] 3,172,029 3.45MB/s in 0.9s
2022-11-17 16:27:44 (8.32 MB/s) - ‘1.5.0.tar.gz’ saved [523648]
[isabell@stardust html]$
Untar the archive and then delete it. Replace the version in the file name with the one you downloaded.
[isabell@stardust html]$ tar -xzf 1.5.0.tar.gz --strip-components=1
[isabell@stardust html]$ rm 1.5.0.tar.gz
[isabell@stardust html]$
Activate the .htaccess file¶
PrivateBin provides a .htaccess file, which blocks some known robots and link-scanning bots. Activate it by renaming it from .htaccess.disabled
to .htaccess
.
[isabell@stardust html]$ mv .htaccess.disabled .htaccess
[isabell@stardust html]$
Moving files outside of DocumentRoot¶
It is recommended to move the configuration, data files, templates and PHP libraries outside of your document root.
To do that, create a folder privatebin-data
in /var/www/virtual/isabell/
and move the folders to the new location (remember to replace isabell
with your own username!).
If not already there, go to the html
directory before running mv
.
[isabell@stardust ~]$ cd ~/html
[isabell@stardust html]$ mkdir /var/www/virtual/isabell/privatebin-data
[isabell@stardust html]$ mv -t /var/www/virtual/isabell/privatebin-data cfg/ lib/ tpl/ vendor/
[isabell@stardust html]$
Changing index.php¶
Now edit ~/html/index.php
to inform PrivateBin about to the new location of the folders.
[...]
// change this, if your php files and data is outside of your webservers document root
define('PATH', '/var/www/virtual/isabell/privatebin-data/');
[...]
Configuration¶
Configure your PrivateBin Instance¶
Note
You don’t need to change any of the default settings as they are mostly secure.
You can find an example configuration file at cfg/conf.sample.php
with the default settings. To change these, copy the sample file to cfg/conf.php
and adapt the values as needed.
[isabell@stardust ~]$ cd /var/www/virtual/isabell/privatebin-data
[isabell@stardust html]$ cp cfg/conf.sample.php cfg/conf.php
[isabell@stardust html]$
The file is in ini format, meaning that lines beginning with semicolons ;
are comments,
configuration options are grouped in sections, marked by square brackets [
and ]
and the option keys are separated by the values with equal signs =
.
A full list of the possible configuration values can be found here.
Best practices¶
Robots.txt¶
PrivateBin comes with a robots.txt
file in the root directory.
It disallows all robots from accessing your pastes.
If you followed this guide, it is already at the right place in your DocumentRoot.
However, if you installed PrivateBin into a subdirectory, you have to move robots.txt
back into the DocumentRoot.
Of course also adjust the file if you already use a robots.txt.
Updates¶
Note
Check the update feed regularly to stay informed about the newest version.
Updating is quite easy. Just repeat all steps of the Installation chapter. Your configuration file won’t get overwritten.
Check the Release-Notes if the configuration changed between cfg/conf.sample.php
and your conf.php
.
Also check .htaccess.disabled
if further adjustments needed to be made.
Tested with PrivateBin 1.5.0, Uberspace 7.13, PHP 8.1
Written by: Nepomacs <https://github.com/Nepomacs/>