Skip to content

Commit

Permalink
Empty login/pw fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Oct 31, 2024
1 parent c644ed7 commit 18ba81e
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.1.1] - 2024-10-31
## [0.1.1] - 2024-11-01
### Added
- Login page for Config
- Version file
Expand Down
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
# ForAuth
[![Main-Docker](https://github.com/aceberg/forauth/actions/workflows/main-docker.yml/badge.svg)](https://github.com/aceberg/forauth/actions/workflows/main-docker.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/aceberg/forauth)](https://goreportcard.com/report/github.com/aceberg/forauth)
[![Maintainability](https://api.codeclimate.com/v1/badges/e8f67994120fc7936aeb/maintainability)](https://codeclimate.com/github/aceberg/forauth/maintainability)
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/aceberg/forauth)

<h1><a href="https://github.com/aceberg/forauth">
<img src="https://raw.githubusercontent.com/aceberg/forauth/main/assets/logo.png" width="35" />
</a>ForAuth</h1>

ForAuth (Forward Auth) - simple reverse proxy with session-cookie auth and notifications on login.

![Screenshot](https://raw.githubusercontent.com/aceberg/forauth/main/assets/Screenshot.png)


## Config


Configuration can be done through config file or environment variables

| Variable | Description | Default |
| -------- | ----------- | ------- |
| FA_AUTH | Enable Session-Cookie authentication | false |
| FA_AUTH_EXPIRE | Session expiration time. A number and suffix: **m, h, d** or **M**. | 7d |
| FA_AUTH_USER | Username | |
| FA_AUTH_PASSWORD | Encrypted password (bcrypt). [How to encrypt password with bcrypt?](docs/BCRYPT.md) | |

| Variable | Description | Default |
| -------- | ----------- | ------- |
| FA_HOST | Listen address for both Config and Proxy | 0.0.0.0 |
| FA_PORT | Port for Proxy | 8800 |
| FA_PORTCONF | Port for Config page | 8801 |
| FA_TARGET | Where to proxy after login (host:port). Example: `0.0.0.0:8840` | |
| FA_THEME | Any theme name from https://bootswatch.com in lowcase or [additional](https://github.com/aceberg/aceberg-bootswatch-fork) (emerald, grass, grayscale, ocean, sand, wood)| united |
| FA_COLOR | Background color: light or dark | dark |
| FA_NODEPATH | Path to local JS and Themes ([node-bootstrap](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap)) | |
| FA_NOTIFY | Shoutrrr URL. ForAuth uses [Shoutrrr](https://github.com/containrrr/shoutrrr) to send notifications. It is already integrated, just needs a correct URL. Examples for Discord, Email, Gotify, Matrix, Ntfy, Pushover, Slack, Telegram, Generic Webhook and etc are [here](https://containrrr.dev/shoutrrr/v0.8/services/gotify/) | |
| TZ | Set your timezone for correct time | |

## Options

| Key | Description | Default |
| -------- | ----------- | ------- |
| -d | Path to config dir | /data/ForAuth |
| -n | Path to local JS and Themes ([node-bootstrap](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap)) | |

## Local network only
By default, this app pulls themes, icons and fonts from the internet. But, in some cases, it may be useful to have an independent from global network setup. I created a separate [image](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap) with all necessary modules and fonts.
```sh
docker run --name node-bootstrap \
-v ~/.dockerdata/icons:/app/icons \ # For local images
-p 8850:8850 \
aceberg/node-bootstrap
```
```sh
docker run --name exdiary \
-v ~/.dockerdata/forauth:/data/forauth \
-p 8851:8851 \
aceberg/forauth -n "http://$YOUR_IP:8850"
```
Or use [docker-compose](docker-compose-local.yml)



## Thanks
- All go packages listed in [dependencies](https://github.com/aceberg/forauth/network/dependencies)
- [Bootstrap](https://getbootstrap.com/)
- Themes: [Free themes for Bootstrap](https://bootswatch.com)
- Favicon and logo: [Flaticon](https://www.flaticon.com/icons/)
Binary file added assets/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 0 additions & 25 deletions docker-compose-local.yml

This file was deleted.

15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

15 changes: 15 additions & 0 deletions docs/BCRYPT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# How to encrypt password with bcrypt?

It is not safe to store password unencrypted, so this app uses `bcrypt` encryption. There are several ways to encrypt your password.

## 1. Set password through web GUI
Then the app will encrypt it for you.

## 2. Encrypt password yourself
On Linux encryption can be done with `htpasswd` command:
```sh
htpasswd -nbBC 10 USER YourSecretPassword | sed 's/USER://'
```

## 3. Encrypt password online
There are online tools for `bcrypt` encryption.
4 changes: 4 additions & 0 deletions internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
// Auth - main auth func
func Auth(c *gin.Context, conf *Conf) bool {

if !conf.Auth || conf.User == "" || conf.Password == "" {
return true
}

sessionToken := getTokenFromCookie(c)

userSession, exists := allSessions[sessionToken]
Expand Down

0 comments on commit 18ba81e

Please sign in to comment.