Skip to content

Commit

Permalink
Release 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Nov 1, 2024
1 parent f20ac88 commit 8080a3f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 22 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-11-01
## [0.1.1] - 2024-11-02
### Added
- Login page for Config
- Version file
Expand Down
50 changes: 41 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,39 @@

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)
- [Security](https://github.com/aceberg/forauth#security)
- [Quick start](https://github.com/aceberg/forauth#quick-start)
- [Config](https://github.com/aceberg/forauth#config)
- [Options](https://github.com/aceberg/forauth#options)
- [Local network only](https://github.com/aceberg/forauth#local-network-only)
- [CURL](https://github.com/aceberg/forauth#curl)
- [Thanks](https://github.com/aceberg/forauth#thanks)

![Screenshot](https://raw.githubusercontent.com/aceberg/forauth/main/assets/Screenshot.png)
<details>
<summary>Screenshot 2</summary>

## Config
![Screenshot1](https://raw.githubusercontent.com/aceberg/forauth/main/assets/Screenshot1.png)
</details>

## Securuty
- This app is only safe when used with `https`
- Use strong password
- Make sure direct access to Target app is closed with firewall or other measures

## Quick start
```sh
docker run --name forauth \
-v ~/.dockerdata/ForAuth:/data/ForAuth \
-p 8800:8800 \ # Proxy port
-p 8801:8801 \ # Config port
aceberg/forauth
```
Then open Config page in browser and set up Auth and Target app.

## Config

Configuration can be done through config file or environment variables
Configuration can be done through config file or environment variables. Variable names is `config.yaml` file are the same, but in lowcase.

| Variable | Description | Default |
| -------- | ----------- | ------- |
Expand Down Expand Up @@ -47,19 +73,25 @@ Configuration can be done through config file or environment variables
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 \
docker run --name forauth \
-v ~/.dockerdata/ForAuth:/data/ForAuth \
-p 8800:8800 \
-p 8801:8801 \
aceberg/forauth -n "http://$YOUR_IP:8850"
```
Or use [docker-compose](docker-compose-local.yml)

## CURL
To access Target app with `curl`:

```sh
curl -X POST http://localhost:8800 -H "Content-Type: application/x-www-form-urlencoded" -d "username=user&password=pw" -c fileCookie
```
```sh
curl http://localhost:8800 -b fileCookie
```

## Thanks
- All go packages listed in [dependencies](https://github.com/aceberg/forauth/network/dependencies)
Expand Down
Binary file modified 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.
Binary file added assets/Screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions internal/web/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@
<div class="card border-primary mb-4">
<div class="card-header">About (<a href="https://github.com/aceberg/ForAuth/releases/tag/{{ .Version }}" target="_blank">{{ .Version }}</a>)</div>
<div class="card-body">
<p><b>● Proxy Port</b> - default 8800</p>
<p><b>● Config Port</b> - config GUI can be reached on this port. Default 8801</p>
<p><b>● Expire after</b> - session expiration time. A number and suffix: <b>m</b>, <b>h</b>, <b>d</b> or <b>M</b>. Example: <code>7d</code></p>
<p><b>● Proxy Port</b> - the Target app can be reached on this port after login. Default <code>8800</code></p>
<p><b>● Config Port</b> - config GUI can be reached on this port. Default <code>8801</code></p>
<p><b>● Target</b> - where to proxy after login (host:port). Example: <code>192.168.1.1:8840</code></p>
<p><b>● Node path</b> - path to local Fonts and Themes (<a href="https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap">node-bootstrap</a>)</p>
<p><b>● Notify URL</b> - provides notifications to Discord, Email, Gotify, Telegram and other services. <a href="https://containrrr.dev/shoutrrr/v0.8/">Link to documentation</a></p>
Expand Down
8 changes: 0 additions & 8 deletions internal/web/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
<!--Favicon-->
<link href="data:image/x-icon;base64,{{ .Config.Icon }}" rel="icon" type="image/x-icon" />
{{ if eq .Config.NodePath "" }}
<!-- Font for icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<!-- Bootstrap and theme -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
{{ else }} <!-- Local node_modules -->
<link rel="stylesheet" href="{{ .Config.NodePath }}/node_modules/bootstrap-icons/font/bootstrap-icons.css">
<link href="{{ .Config.NodePath }}/node_modules/bootswatch/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
{{ end }}
</head>
Expand All @@ -29,11 +26,6 @@
<a class="nav-link active" href="http://{{ .Config.Host }}:{{ .Config.Port }}">Proxy</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item">
<a class="nav-link active fs-3 ms-md-2" target="_blank" href="https://github.com/aceberg/ForAuth"><i class="bi bi-github"></i></a>
</li>
</ul>
</div>
</nav>
{{ end }}
9 changes: 7 additions & 2 deletions internal/web/webgui.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ func Gui(dirPath, nodePath string) {
routerConf.SetHTMLTemplate(templ) // templates
routerConf.StaticFS("/fs/", http.FS(pubFS)) // public

routerProxy.GET("/*any", loginHandler) // login.go
routerProxy.POST("/*any", loginHandler) // login.go
routerProxy.GET("/*any", loginHandler) // login.go
routerProxy.POST("/*any", loginHandler) // login.go
routerProxy.PUT("/*any", loginHandler) // login.go
routerProxy.DELETE("/*any", loginHandler) // login.go
routerProxy.PATCH("/*any", loginHandler) // login.go
routerProxy.HEAD("/*any", loginHandler) // login.go
routerProxy.OPTIONS("/*any", loginHandler) // login.go

routerConf.GET("/", configHandler) // config.go
routerConf.GET("/logout", logoutHandler) // config.go
Expand Down

0 comments on commit 8080a3f

Please sign in to comment.