remove setuid option

This commit is contained in:
Amrit Panesar committed 2017-12-25 22:30:42 -08:00
1 parent 21e5071bea
commit 325a21f38d
2 files changed
+132 -25

No files matched your search

+128 -21
View File
@@ -1,37 +1,144 @@
## Welcome to GitHub Pages
## GoFiche!
![Logo](https://neo-desktop.github.io/go-fiche/logo.png)
You can use the [editor on GitHub](https://github.com/Neo-Desktop/go-fische/edit/master/README.md) to maintain and preview the content for your website in Markdown files.
### A Go fork of [Fiche](https://github.com/solusipse/fiche "fiche")
Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
Command line pastebin for sharing terminal output.
### Markdown
-----
Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
# Server-side usage
```markdown
Syntax highlighted code block
## Installation From Source
# Header 1
## Header 2
### Header 3
1. Clone:
- Bulleted
- List
```
git clone https://github.com/Neo-Desktop/go-fiche.git
```
1. Numbered
2. List
2. Build:
**Bold** and _Italic_ and `Code` text
```
go get github.com/ahmetb/govvv
govvv build
```
3. Install:
```
cp go-fiche /usr/local/bin
```
-------------------------------------------------------------------------------
## Usage
```
Usage of go-fiche:
-B, --buffer int 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. (default 32768)
-d, --domain string This will be used as a prefix for an output received by the client. Value will be prepended with http[s]. (default "localhost")
-h, --help Prints this help message
-S, --https If set, Go-Fiche returns url with https prefix instead of http.
-l, --log string Log file. This file has to be user-writable.
-o, --output string Relative or absolute path to the directory where you want to store user-posted pastes. (default "./code")
-p, --port int Port in which the service should listen on. (default 9999)
[Link](url) and ![Image](src)
```
For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).
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. See section below for more info.
### Jekyll Themes
### Settings
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/Neo-Desktop/go-fische/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
-------------------------------------------------------------------------------
### Support or Contact
#### Output directory `-o`
Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
Relative or absolute path to the directory where you want to store user-posted pastes.
```
go-fiche -o ./code
```
```
go-fiche -o /home/www/code/
```
__Default value:__ `./code`
-------------------------------------------------------------------------------
#### Domain `-d`
This will be used as a prefix for an output received by the client.
Value will be prepended with `http`.
```
go-fiche -d domain.com
```
```
go-fiche -d subdomain.domain.com
```
```
go-fiche -d subdomain.domain.com/some_directory
```
__Default value:__ `localhost`
-------------------------------------------------------------------------------
#### Slug size `-s`
This will force slugs to be of required length:
```
go-fiche -s 6
```
__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
-------------------------------------------------------------------------------
#### HTTPS `-S`
If set, fiche returns url with https prefix instead of http
```
go-fiche -S
```
__Output url with this parameter__: `https://localhost/xxxx`,
where x is a randomized character
-------------------------------------------------------------------------------
#### 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.
```
go-fiche -B 2048
```
__Default value:__ 32768
-------------------------------------------------------------------------------
#### Log file `-l`
```
go-fiche -l /home/www/fiche-log.txt
```
__Default value:__ not set
__WARNING:__ this file has to be user-writable
+4 -4
View File
@@ -31,14 +31,13 @@ func init() {
pflag.StringP("domain", "d", "localhost", "This will be used as a prefix for an output received by the client. Value will be prepended with http[s].")
pflag.IntP("port", "p", 9999, "Port in which the service should listen on.")
pflag.BoolP("https", "S", false, fmt.Sprintf("If set, %s returns url with https prefix instead of http.", AppName))
pflag.StringP("username", "u", "", fmt.Sprintf("%s will try to switch to the requested user on startup if any is provided.", AppName))
pflag.IntP("buffer", "B", 32768, "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.")
pflag.StringP("log", "l", "", "Log file. This file has to be user-writable.")
pflag.Parse()
viper.BindPFlags(pflag.CommandLine)
if viper.GetBool("help") {
fmt.Printf("%s!\n Version %s, Built: %s [%s:%s-%s)\n\n", AppName, Version, BuildDate, GitBranch, GitCommit, GitState)
fmt.Printf("%s! - Version %s, Built on %s from Git tag [%s:%s-%s)\n", AppName, Version, BuildDate, GitBranch, GitCommit, GitState)
pflag.Usage()
os.Exit(2)
}
@@ -90,10 +89,10 @@ func handleConnection(conn net.Conn) {
remoteHost = conn.RemoteAddr().String()
}
defer func() {
log.Printf("Closing connection to: %s (%s).\n", remoteHost, conn.RemoteAddr())
log.Printf("Closing connection to: %s (%s).\n", remoteHost, conn.RemoteAddr().String())
conn.Close()
}()
log.Printf("Incoming connection from: %s (%s).\n", remoteHost, conn.RemoteAddr())
log.Printf("Incoming connection from: %s (%s).\n", remoteHost, conn.RemoteAddr().String())
conn.SetReadDeadline(time.Now().Add(time.Second * 5))
slug := generateSlug(time.Now().UnixNano())
@@ -103,6 +102,7 @@ func handleConnection(conn net.Conn) {
file, err := os.Create(slugFullpath)
if err != nil {
log.Fatalf("Unable to create slug file: %s", slugFullpath)
conn.Write([]byte(fmt.Sprintf("%s", "Internal error encountered - Please try again later...")))
return
}