Files
fiche/README.md

233 lines
4.7 KiB
Markdown
Raw Normal View History

2014-09-09 05:49:43 +02:00
fiche [![Build Status](https://travis-ci.org/solusipse/fiche.svg?branch=master)](https://travis-ci.org/solusipse/fiche)
2013-09-05 18:59:56 -07:00
=====
Command line pastebin for sharing terminal output.
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
# Client-side usage
Self-explanatory live examples (using public server):
```
echo just testing! | nc termbin.com 9999
```
```
cat file.txt | nc termbin.com 9999
```
In case you installed and started fiche on localhost:
```
ls -la | nc localhost 9999
```
## Requirements
To use fiche you have to have netcat installed. You probably already have it - try typing `nc` or `netcat` into your terminal!
-------------------------------------------------------------------------------
# Server-side usage
2013-09-06 04:01:55 +02:00
## Installation ##
2017-09-02 18:53:43 +02:00
1. Clone:
2013-09-06 04:01:55 +02:00
```
2017-09-02 18:53:43 +02:00
git clone https://github.com/solusipse/fiche.git
2013-09-06 04:01:55 +02:00
```
2017-09-02 18:53:43 +02:00
2. Build:
2013-09-06 04:01:55 +02:00
```
make
```
3. Install:
```
sudo make install
```
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
## Settings
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
### Usage
2013-09-06 04:01:55 +02:00
```
2016-03-15 14:13:08 +01:00
usage: fiche [-D6epbsdSolBuw].
2013-09-14 01:00:23 +02:00
[-d domain] [-p port] [-s slug size]
[-o output directory] [-B buffer size] [-u user name]
[-l log file] [-b banlist] [-w whitelist]
2013-09-06 04:01:55 +02:00
```
2017-09-02 18:53:43 +02:00
These are command line arguments. You don't have to provide any of them to run the application. Default settings will be used in such case.
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
### Examples
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### Output directory `-o`
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
Relative or absolute path to the directory where you want to store user-posted pastes.
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
fiche -o ./code
2013-09-14 01:00:23 +02:00
```
```
2013-09-15 23:41:16 +02:00
fiche -o /home/www/code/
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
__Default value:__ `./code`
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### Domain `-d`
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
This will be used as a prefix for an output received by the client.
Value will be prepended with `http`.
2013-09-09 01:15:55 +02:00
```
fiche -d domain.com
```
```
2013-09-14 01:00:23 +02:00
fiche -d subdomain.domain.com
2013-09-09 01:15:55 +02:00
```
2017-09-02 18:53:43 +02:00
__Default value:__ `localhost`
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
#### Slug size `-s`
This will force slugs to be of requires length:
2013-09-06 04:01:55 +02:00
2013-09-14 01:00:23 +02:00
```
fiche -s 6
```
2017-09-02 18:53:43 +02:00
__Output url with default value__: `http://localhost/xxxx`,
where x is a randomized character
__Output url with example value 6__: `http://localhost/xxxx`,
where is a randomized character
__Default value:__ 4
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### User name `-u`
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
Fiche will try to switch to the requested user on startup if any is provided.
2013-09-14 01:00:23 +02:00
```
2015-09-04 16:40:29 +02:00
fiche -u _fiche
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
__Default value:__ not set
2015-09-04 16:40:29 +02:00
2017-09-02 18:53:43 +02:00
__WARNING:__ This requires that fiche is started as a root.
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### Buffer size `-B`
This parameter defines size of the buffer used for getting data from the user.
Maximum size (in bytes) of all input files is defined by this value.
2013-09-14 01:00:23 +02:00
```
fiche -B 2048
```
2017-09-02 18:53:43 +02:00
__Default value:__ 32768
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### Log file `-l`
2013-09-14 01:00:23 +02:00
```
fiche -l /home/www/fiche-log.txt
```
2017-09-02 18:53:43 +02:00
__Default value:__ not set
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
__WARNING:__ this file has to be user-writable
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
#### Ban list `-b`
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
Relative or absolute path to a file containing IP addresses of banned users.
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
fiche -b fiche-bans.txt
2013-09-14 01:00:23 +02:00
```
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
__Format of the file:__ this file should contain only addresses, one per line.
2017-09-02 18:53:43 +02:00
__Default value:__ not set
2017-09-02 18:53:43 +02:00
__WARNING:__ not implemented yet
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2017-09-02 18:53:43 +02:00
#### White list `-w`
2017-09-02 18:53:43 +02:00
If whitelist mode is enabled, only addresses from the list will be able
to upload files.
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
fiche -w fiche-whitelist.txt
2013-09-14 01:00:23 +02:00
```
2017-09-02 18:53:43 +02:00
__Format of the file:__ this file should contain only addresses, one per line.
2013-09-14 01:00:23 +02:00
2017-09-02 18:53:43 +02:00
__Default value:__ not set
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
__WARNING:__ not implemented yet
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-06 04:01:55 +02:00
2017-09-02 18:53:43 +02:00
### Running as a service
2013-09-06 14:44:38 +02:00
2017-09-02 18:53:43 +02:00
There's a simple systemd example:
2013-09-06 14:44:38 +02:00
```
[Unit]
Description=FICHE-SERVER
[Service]
2017-09-02 18:53:43 +02:00
ExecStart=/usr/local/bin/fiche -d yourdomain.com -o /path/to/output -l /path/to/log -u youruser
2013-09-06 14:44:38 +02:00
[Install]
WantedBy=multi-user.target
```
2017-09-02 18:53:43 +02:00
__WARNING:__ In service mode you have to set output directory with `-o` parameter, there's example:
2013-09-09 01:15:55 +02:00
2017-09-02 18:53:43 +02:00
-------------------------------------------------------------------------------
2013-09-09 01:15:55 +02:00
2017-09-02 18:53:43 +02:00
## Example nginx config
2013-09-06 04:20:35 +02:00
2017-09-02 18:53:43 +02:00
Fiche has no http server built-in, thus you need to setup one if you want to make files available through http.
2013-09-06 04:20:35 +02:00
2017-09-02 18:53:43 +02:00
There's a sample configuration for nginx:
2013-09-06 04:20:35 +02:00
```
server {
listen 80;
server_name mysite.com www.mysite.com;
2013-09-14 01:00:23 +02:00
charset utf-8;
2013-09-06 04:20:35 +02:00
location / {
root /home/www/code/;
2013-09-14 01:00:23 +02:00
index index.txt index.html;
2013-09-06 04:20:35 +02:00
}
}
```
2017-09-02 18:53:43 +02:00
# License
2013-09-06 04:01:55 +02:00
Fiche is MIT licensed.