Files
fiche/README.md

269 lines
4.5 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
## Installation ##
1. Clone into repository:
```
https://github.com/solusipse/fiche.git
```
2. Build program:
```
make
```
3. Install:
```
sudo make install
```
## Client-side usage ##
Self explanatory live examples:
```
ls -la | nc localhost 9999
```
```
2013-09-14 01:00:23 +02:00
cat file.txt | nc solusipse.net 9999
2013-09-06 04:01:55 +02:00
```
```
echo just testing! | nc code.solusipse.net 9999
```
2013-09-14 01:00:23 +02:00
If you haven't already set up your server on localhost, try second or third command. My personal server is
providing fiche-based service all the time on this address `solusipse.net` and this port `9999`.
2013-09-06 04:01:55 +02:00
- To upload text you need to have netcat installed (to check if netcat is installed, simply type ```nc``` in terminal).
## Server-side usage ##
```
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
```
2013-09-14 01:00:23 +02:00
These are command line arguments. You don't have to provide any, but providing basic is recommended. Without them, program
2013-09-06 04:01:55 +02:00
will use these default settings:
2013-09-14 01:00:23 +02:00
```
2013-09-06 04:01:55 +02:00
domain = "http://localhost/";
basedir= "~/code/";
port = 9999;
slug_size = 4;
buffer_size = 8192;
```
2013-09-14 01:00:23 +02:00
### Arguments ###
Most important is providing **basedir** and **domain**.
-----------------
#### Basedir ####
Basedir should be **absolute** path to directory where you would like to store text files.
```
2013-09-15 23:41:16 +02:00
fiche -o /absolute/path/to/directory/
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
```
-----------------
#### Domain ####
Domain should be provided in such format ```domain.com```.
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
```
2013-09-14 01:00:23 +02:00
-----------------
2013-09-06 04:01:55 +02:00
2013-09-14 01:00:23 +02:00
#### Slug size ####
2013-09-06 04:01:55 +02:00
2013-09-14 01:00:23 +02:00
This will force fiche to create random slugs with given length, example:
2013-09-06 04:01:55 +02:00
2013-09-14 01:00:23 +02:00
```
fiche -s 6
```
```
http://domain.com/abcdef/
```
-----------------
#### User name ####
2015-09-04 16:40:29 +02:00
Set the user that fiche runs as using the `-u` option, example:
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
```
2015-09-04 16:40:29 +02:00
This option has effect only if fiche was started by root, otherwise it is ignored and fiche runs under the
current user id.
2013-09-14 01:00:23 +02:00
-----------------
#### Buffersize ####
This parameter defines max file size uploaded by user, by default it is set to `32768`.
Use `-B` parameter to change it:
```
fiche -B 2048
```
-----------------
#### Log file ###
Path to file where all logs will be stored:
```
fiche -l /home/www/fiche-log.txt
```
-----------------
#### Ban list ###
Path to file where you provided all banned IP adresses:
```
fiche -b /home/www/fiche-bans.txt
```
-----------------
#### White list ####
If whitelist mode is enabled, only addresses from list will be able to upload files. There's example:
```
fiche -w /home/www/fiche-whitelist.txt
```
2013-09-06 04:01:55 +02:00
2013-09-14 01:00:23 +02:00
-----------------
#### Whitelist and banlist syntax ####
There is no specific syntax, there files may contain not only addresses.
-----------------
#### Daemonize ####
Fork fiche to the background:
fiche -D
-----------------
#### Extended character set for the URL ####
Fork can extend the charcter set for the URL:
fiche -e
-----------------
2016-03-15 14:13:08 +01:00
#### Use IPv6 ####
this will allow fiche to accept connections from IPv6 clients:
fiche -6
-----------------
2013-09-14 01:00:23 +02:00
#### Examples ####
Logging connections with banlist:
```
fiche -d domain.com -l /home/www/log.txt -b /home/www/bans.txt
```
-----------------
Only for personal use with whitelist
```
fiche -d domain.com -w /home/www/whitelist.txt
```
-----------------
Custom output directory, bigger slug size, reduced buffer, custom port:
```
fiche -d domain.com -o /media/disk/fiche/ -s 8 -B 2048 -p 6666
```
2013-09-06 04:01:55 +02:00
2013-09-06 14:44:38 +02:00
## Running as service ##
You can run fiche as service, there is simple systemd example:
```
[Unit]
Description=FICHE-SERVER
[Service]
2015-09-04 16:40:29 +02:00
ExecStart=/usr/local/bin/fiche -d code.solusipse.net -o /home/www/code/ -l /home/www/log.txt -u _fiche
2013-09-06 14:44:38 +02:00
[Install]
WantedBy=multi-user.target
```
2013-09-14 01:00:23 +02:00
In service mode you have to set output directory with `-o` parameter, there's example:
2013-09-09 01:15:55 +02:00
```
fiche -o /home/www/code/
```
2013-09-06 04:20:35 +02:00
## Webserver ##
To make files available for users, you need to host them somehow. Http server is easiest option. Just set root
2013-09-14 01:00:23 +02:00
directory to ```BASEDIR```.
2013-09-06 04:20:35 +02:00
There is sample configuration for nginx:
```
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
}
}
```
## License ##
2013-09-06 04:01:55 +02:00
Fiche is MIT licensed.