Skip to content

Commit

Permalink
new design for fancyindex by @DavidCraftDev
Browse files Browse the repository at this point in the history
Signed-off-by: Zoey <[email protected]>
Co-Authored-By: David <[email protected]>
  • Loading branch information
Zoey2936 and DavidCraftDev committed Jun 9, 2024
1 parent 22ab2db commit 396596d
Show file tree
Hide file tree
Showing 20 changed files with 252 additions and 7,949 deletions.
2 changes: 1 addition & 1 deletion .github/delete-merged-branch-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ exclude:
- main
- stable
- develop
delete_closed_pr: true
delete_closed_pr: true
3 changes: 1 addition & 2 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
yarn global add prettier @prettier/plugin-php prettier-plugin-tailwindcss
sed -i "s|doctype|DOCTYPE|g" /home/runner/.config/yarn/global/node_modules/prettier/plugins/html.js
sed -i "s|doctype|DOCTYPE|g" /home/runner/.config/yarn/global/node_modules/prettier/plugins/html.mjs
prettier src -w --end-of-line crlf --print-width 10000 --plugin /home/runner/.config/yarn/global/node_modules/@prettier/plugin-php/standalone.js --plugin /home/runner/.config/yarn/global/node_modules/prettier-plugin-tailwindcss/dist/index.mjs
prettier rootfs -w --end-of-line crlf --print-width 10000
prettier . -w --end-of-line crlf --print-width 10000 --plugin /home/runner/.config/yarn/global/node_modules/@prettier/plugin-php/standalone.js --plugin /home/runner/.config/yarn/global/node_modules/prettier-plugin-tailwindcss/dist/index.mjs
- name: push
run: |
git add -A
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
- name: Run Shellcheck
uses: ludeeus/action-shellcheck@master
with:
check_together: 'yes'
check_together: "yes"
env:
SHELLCHECK_OPTS: --shell sh -e SC1091 -e SC2153 -e SC2154
1 change: 1 addition & 0 deletions .github/workflows/tailwindcss-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
params: "--minify"
- name: push changes
run: |
git add --force src/public/tailwind.css
git config user.name "GitHub"
git config user.email "[email protected]"
git diff-index --quiet HEAD || git commit -sm "tailwindcss-update"
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ src/public/tailwind.css
src/composer.lock
src/vendor

rootfs/app/nftd
rootfs/app/fancyindex
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN apk upgrade --no-cache -a && \
echo "APPSEC_FAILURE_ACTION=deny" | tee -a /src/crowdsec-nginx-bouncer/lua-mod/config_example.conf && \
sed -i "s|BOUNCING_ON_TYPE=all|BOUNCING_ON_TYPE=ban|g" /src/crowdsec-nginx-bouncer/lua-mod/config_example.conf

FROM zoeyvid/nginx-quic:288
FROM zoeyvid/nginx-quic:290
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

ARG CRS_VER=v4.3.0
Expand Down
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ running at home or otherwise, including free TLS, without having to know too muc
- [Quick Setup](#quick-setup)
<!---
- [Screenshots](https://nginxproxymanager.com/screenshots)
--->
--->

<!---
**Note: To fix [this issue](https://github.com/SpiderLabs/ModSecurity/issues/2848), instead of running `nginx -s reload`, this fork stops nginx and starts it again. This can result in a 502 error when you update your hosts. See https://github.com/ZoeyVid/NPMplus/issues/296 and https://github.com/ZoeyVid/NPMplus/issues/283.** <br>
--->

**Note: Reloading the NPMplus UI can cause a 502 error. See https://github.com/ZoeyVid/NPMplus/issues/241.** <br>
**Note: NO armv7, route53 and aws cloudfront ip ranges support.** <br>
**Note: add `net.ipv4.ip_unprivileged_port_start=0` at the end of `/etc/sysctl.conf` to support PUID/PGID in network mode host.** <br>
Expand All @@ -24,8 +25,8 @@ running at home or otherwise, including free TLS, without having to know too muc
**Note: Other Databases like MariaDB may work, but are unsupported.** <br>
**Note: access.log/stream.log, logrotate and goaccess are NOT enabled by default bceuase of GDPR, you can enable them in the compose.yaml.** <br>


## Project Goal

I created this project to fill a personal need to provide users with an easy way to accomplish reverse
proxying hosts with TLS termination and it had to be so easy that a monkey could do it. This goal hasn't changed.
While there might be advanced options they are optional and the project should be as simple as possible
Expand All @@ -36,7 +37,6 @@ so that the barrier for entry here is low.
<a href="https://www.buymeacoffee.com/jc21" target="_blank"><img src="http://public.jc21.com/github/by-me-a-coffee.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
--->


## Features

- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io)
Expand All @@ -46,7 +46,6 @@ so that the barrier for entry here is low.
- Advanced Nginx configuration available for super users
- User management, permissions and audit log


# List of new features

- Supports HTTP/3 (QUIC) protocol.
Expand All @@ -56,9 +55,9 @@ so that the barrier for entry here is low.
- If the core ruleset blocks valid requests, please check the `/opt/npm/etc/modsecurity/crs-setup.conf` file.
- Try to whitelist the Content-Type you are sending (for example, `application/activity+json` for Mastodon and `application/dns-message` for DoH).
- Try to whitelist the HTTP request method you are using (for example, `PUT` is blocked by default, which also affects NPM).
<!---
<!---
- Note: To fix [this issue](https://github.com/SpiderLabs/ModSecurity/issues/2848), instead of running `nginx -s reload`, this fork stops nginx and starts it again. This will result in a 502 error when you update your hosts. See https://github.com/ZoeyVid/NPMplus/issues/296 and https://github.com/ZoeyVid/NPMplus/issues/283.
--->
--->
- Darkmode button in the footer for comfortable viewing (CSS done by [@theraw](https://github.com/theraw))
- Fixes proxy to https origin when the origin only accepts TLSv1.3
- Only enables TLSv1.2 and TLSv1.3 protocols
Expand Down Expand Up @@ -93,6 +92,7 @@ so that the barrier for entry here is low.
- If you want to redirect all HTTP traffic to HTTPS, you can use the `compose.override.yaml` file.

## migration

- **NOTE: migrating back to the original is not possible**, so make first a **backup** before migration, so you can use the backup to switch back
- if you use custom certificates, you need to upload the CA/Intermediate Certificate (file name: `chain.pem`) in the `/opt/npm/tls/custom/npm-[certificate-id]` folder
- some buttons have changed, check if they are still correct
Expand All @@ -101,8 +101,10 @@ so that the barrier for entry here is low.
- if you have a healthcheck defined in your compose yaml file, remove it - this fork defines its own healthcheck in the Dockerfile, so you don't need to have it in compose anymore

# Crowdsec

1. Install crowdsec using this compose file: https://github.com/ZoeyVid/NPMplus/blob/develop/compose.crowdsec.yaml
2. open `/opt/crowdsec/conf/acquis.d/npmplus.yaml` and fill it with:

```yaml
filenames:
- /opt/npm/nginx/access.log
Expand All @@ -111,13 +113,13 @@ labels:
---
source: docker
container_name:
- npmplus
- npmplus
labels:
type: npmplus
---
source: docker
container_name:
- npmplus
- npmplus
labels:
type: modsecurity
---
Expand All @@ -128,6 +130,7 @@ source: appsec
labels:
type: appsec
```
3. make sure to use `network_mode: host` in your compose file
4. run `docker exec crowdsec cscli bouncers add npmplus -o raw` and save the output
5. open `/opt/npm/etc/crowdsec/crowdsec.conf`
Expand All @@ -138,29 +141,35 @@ labels:
10. redeploy the `compose.yaml`

# coreruleset plugins

1. Download the plugin (all files inside the `plugins` folder of the git repo), most time: `<plugin-name>-before.conf`, `<plugin-name>-config.conf` and `<plugin-name>-after.conf` and sometimes `<plugin-name>.data` and/or `<plugin-name>.lua` or somilar files
2. put them into the `/opt/npm/etc/modsecurity/crs-plugins` folder
3. maybe open the `/opt/npm/etc/modsecurity/crs-plugins/<plugin-name>-config.conf` and configure the plugin

# Use as webserver

1. Create a new Proxy Host
2. Set `Scheme` to `https`, `Forward Hostname / IP` to `0.0.0.0`, `Forward Port` to `1` and enable `Websockets Support` (you can also use other values, since these get fully ignored)
3. Maybe set an Access List
4. Make your TLS Settings
5.
a) Custom Nginx Configuration (advanced tab), which looks the following for file server:
5. a) Custom Nginx Configuration (advanced tab), which looks the following for file server:

- Note: the slash at the end of the file path is important

```
location / {
include conf.d/include/acme-challenge.conf;
alias /var/www/<your-html-site-folder-name>/;
}
```

b) Custom Nginx Configuration (advanced tab), which looks the following for file server and **php**:

- Note: the slash at the end of the file path is important
- Note: first enable `PHP82` and/or `PHP83` inside your compose file
- Note: you can replace `fastcgi_pass php82;` with `fastcgi_pass php83;`
- Note: to add more php extension using envs you can set in the compose file

```
location / {
include conf.d/include/acme-challenge.conf;
Expand All @@ -177,51 +186,64 @@ location / {
```

# custom acme server

1. Open this file: `nano` `/opt/npm/ssl/certbot/config.ini`
2. uncomment the server line and change it to your acme server
3. maybe set eab keys
4. create your cert using the npm web ui

# Quick Setup

1. Install Docker and Docker Compose (or portainer)

- [Docker Install documentation](https://docs.docker.com/engine)
- [Docker Compose Install documentation](https://docs.docker.com/compose/install/linux)

2. Create a compose.yaml file similar to [this](https://github.com/ZoeyVid/NPMplus/blob/develop/compose.yaml) (or use it as a portainer stack):
3. Bring up your stack by running (or deploy your portainer stack)

```bash
docker compose up -d
```

4. Log in to the Admin UI
When your docker container is running, connect to it on port `81` for the admin interface.
Sometimes this can take a little bit because of the entropy of keys.
You may need to open port 81 in your firewall.
You may need to use another IP-Address.
[https://127.0.0.1:81](https://127.0.0.1:81)
Default Admin User:
When your docker container is running, connect to it on port `81` for the admin interface.
Sometimes this can take a little bit because of the entropy of keys.
You may need to open port 81 in your firewall.
You may need to use another IP-Address.
[https://127.0.0.1:81](https://127.0.0.1:81)
Default Admin User:

```
Email: [email protected]
Password: iArhP1j7p1P6TA92FA2FMbbUGYqwcYzxC4AVEe12Wbi94FY9gNN62aKyF1shrvG4NycjjX9KfmDQiwkLZH1ZDR9xMjiG2QmoHXi
```
Immediately after logging in with this default user you will be asked to modify your details and change your password.
### prerun scripts (EXPERT option) - if you don't know what this is, ignore it
run order: entrypoint.sh (prerun scripts) => start.sh => launch.sh <br>
if you need to run scripts before NPMplus launches put them under: `/opt/npm/etc/prerun/*.sh` (please add `#!/bin/sh` / `#!/bin/bash` to the top of the script) <br>
you need to create this folder yourself - **NOTE:** I won't help you creating those patches/scripts if you need them you also need to know how to create them
## Contributing
All are welcome to create pull requests for this project, against the `develop` branch.
CI is used in this project. All PR's must pass before being considered. After passing,
docker builds for PR's are available on ghcr for manual verifications.
## Contributors/Sponsor upstream NPM
Special thanks to [all of our contributors](https://github.com/NginxProxyManager/nginx-proxy-manager/graphs/contributors).
If you want to sponsor them, please see [here](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/master/README.md).
# Please report Bugs first to this fork before reporting them to the upstream Repository
## Getting Support
1. [Found a bug?](https://github.com/ZoeyVid/NPMplus/issues)
2. [Discussions](https://github.com/ZoeyVid/NPMplus/discussions)
<!---
3. [Reddit](https://reddit.com/r/nginxproxymanager)
--->
--->
4 changes: 2 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
network_mode: host
volumes:
- "/opt/npm:/data"
# - "/var/www:/var/www" # optional, if you want to use it as webserver for html/php
# - "/opt/npm-letsencrypt:/etc/letsencrypt" # Only needed for first time migration from original nginx-proxy-manager to this fork
# - "/var/www:/var/www" # optional, if you want to use it as webserver for html/php
# - "/opt/npm-letsencrypt:/etc/letsencrypt" # Only needed for first time migration from original nginx-proxy-manager to this fork
environment:
- "TZ=Europe/Berlin" # set timezone, required
# todo move to ui
Expand Down
30 changes: 30 additions & 0 deletions rootfs/app/fancyindex/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
</div>
<p id="notice">Powered by <a href="https://github.com/ZoeyVid/NPMplus">NPMplus</a></p>
<script>
var input = document.createElement("input");
input.id = "search";
input.type = "text";
input.placeholder = "Search here...";
document.querySelector("h1").after(input);
var items = [].slice.call(document.querySelectorAll("#list tbody tr"));
function filterItems(item, filter) {
return !item.querySelector("td").textContent.trim().includes(filter);
}
input.addEventListener("keyup", function () {
items.forEach((item) => {
item.hidden = false;
});
items
.filter((item) => filterItems(item, this.value.trim()))
.forEach((item) => {
item.hidden = true;
});
});

var tableDiv = document.createElement("div");
tableDiv.id = "tableDiv";
tableDiv.appendChild(document.querySelector("table"));
document.getElementById("search").after(tableDiv);
</script>
</body>
</html>
Loading

0 comments on commit 396596d

Please sign in to comment.