Skip to content

Commit 9ef1240

Browse files
committed
Added tool to reset password of a user.
1 parent 504cfd8 commit 9ef1240

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ RUN \
157157
&& \
158158
rm -rf /tmp/* /tmp/.[!.]*
159159

160+
# Install bcrypt-tool.
161+
RUN \
162+
# Install packages needed by the build.
163+
add-pkg --virtual build-dependencies \
164+
go \
165+
upx \
166+
git \
167+
musl-dev \
168+
&& \
169+
mkdir /tmp/go && \
170+
env GOPATH=/tmp/go go get gophers.dev/cmds/bcrypt-tool && \
171+
strip /tmp/go/bin/bcrypt-tool && \
172+
upx /tmp/go/bin/bcrypt-tool && \
173+
cp -v /tmp/go/bin/bcrypt-tool /usr/bin/ && \
174+
# Cleanup.
175+
del-pkg build-dependencies && \
176+
rm -rf /tmp/* /tmp/.[!.]*
177+
160178
# Add files.
161179
COPY rootfs/ /
162180

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Nginx Proxy Manager enables you to easily forward to your websites running at ho
3030
* [Shell Access](#shell-access)
3131
* [Default Administrator Account](#default-administrator-account)
3232
* [Accessibility From The Internet](#accessibility-from-the-internet)
33+
* [Troubleshooting](#troubleshooting)
34+
* [Password Reset](#password-reset)
3335
* [Support or Contact](#support-or-contact)
3436

3537
## Quick Start
@@ -296,6 +298,21 @@ For more details about port forwarding, see the following links:
296298
- [How to Port Forward - General Guide to Multiple Router Brands](https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/)
297299
- [How to Forward Ports on Your Router](https://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/)
298300

301+
## Troubleshooting
302+
303+
### Password Reset
304+
305+
The password of a user can be reset to `changeme` with the following command:
306+
307+
```
308+
docker exec CONTAINER_NAME /opt/nginx-proxy-manager/reset-password.sh USER_EMAIL
309+
```
310+
311+
Where:
312+
313+
- `CONTAINER_NAME` is the name of the running container.
314+
- `USER_EMAIL` is the email of the address to reset the password.
315+
299316
[TimeZone]: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
300317

301318
## Support or Contact

appdefs.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@ For more details about port forwarding, see the following links:
8787
- [How to Forward Ports on Your Router](https://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/)
8888
</content>
8989
</section>
90+
<section>
91+
<title level="2">Troubleshooting</title>
92+
<content/>
93+
</section>
94+
<section>
95+
<title level="3">Password Reset</title>
96+
<content>
97+
The password of a user can be reset to `changeme` with the following command:
98+
99+
```
100+
docker exec CONTAINER_NAME /opt/nginx-proxy-manager/reset-password.sh USER_EMAIL
101+
```
102+
103+
Where:
104+
105+
- `CONTAINER_NAME` is the name of the running container.
106+
- `USER_EMAIL` is the email of the address to reset the password.
107+
</content>
108+
</section>
90109
</documentation>
91110
<!-- Changelog of the application. -->
92111
<history>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
usage() {
4+
echo "usage: $(basename "$0") USER_EMAIL [PASSWORD]
5+
6+
Reset password of a Nginx Proxy Manager user.
7+
8+
Arguments:
9+
USER_EMAIL Email address of the user to reset the password.
10+
PASSWORD Optional new password of the user. If not set, password
11+
is set to 'changeme'.
12+
"
13+
exit 1
14+
}
15+
16+
USER_EMAIL="$1"
17+
if [ -z "$USER_EMAIL" ]; then
18+
echo "ERROR: User email address must be set."
19+
usage
20+
fi
21+
PASSWORD_HASH="$(/usr/bin/bcrypt-tool hash "${2:-changeme}" 13)"
22+
23+
/usr/bin/mysql --execute "UPDATE user,auth SET auth.secret = '$PASSWORD_HASH' WHERE user.id = auth.user_id and user.email = '$USER_EMAIL'" nginxproxymanager

0 commit comments

Comments
 (0)