kmahyyg / ztncui-aio

Licensed Under AGPL v3
GNU General Public License v3.0
154 stars 147 forks source link

can't find the password #25

Closed shuncon closed 1 year ago

shuncon commented 1 year ago

-e ZTNCUI_PASSWD=admin123 did not take effect docker logs -f can't find the password

kmahyyg commented 1 year ago

Could you please give me the full command that you create the container?

kmahyyg commented 1 year ago

According to:

https://github.com/kmahyyg/ztncui-aio/blob/a40f648e335fbfb6f50e0eb931f928153b9dd92a/argon2g/main.go#LL43C46-L43C46

This program should print the password. I just guess that might be something wrong.

shuncon commented 1 year ago

docker run -d -p3443:3443 -p3000:3000 \ -v /data/ztncui/ztncui:/opt/key-networks/ztncui/etc \ -v /data/ztncui/zt-conf:/etc/zt-mkworld \ -v /data/zt1:/var/lib/zerotier-one \ -e ZTNCUI_PASSWD=admin123 \ --env-file .env \ --name ztncui \ ghcr.io/kmahyyg/ztncui-aio

kmahyyg commented 1 year ago
-e ZTNCUI_PASSWD=admin123
--env-file .env

Please check the content of .env, if you have two environment variable with the same name, the content of environment variable might be replaced.

shuncon commented 1 year ago

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service entryinit: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started Set Your IP Address to continue. If you don't do that, I will automatically detect. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 14 100 14 0 0 16 0 --:--:-- --:--:-- --:--:-- 16 YOUR IP: 1xx.xx.xx.xx YOUR DOMAIN: xxx.com ALREADY_INITED detected. s6-rc: info: service entryinit successfully started s6-rc: info: service ztone: starting s6-rc: info: service ztone successfully started s6-rc: info: service ztncui: starting s6-rc: info: service ztncui successfully started /usr/sbin/zerotier-one: WARNING: failed to drop privileges (kernel may not support required prctl features), running as root s6-rc: info: service fileserv: starting Set Your IP Address to continue. If you don't do that, I will automatically detect. s6-rc: info: service fileserv successfully started % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 100 14 100 14 0 0 23 0 --:--:-- --:--:-- --:--:-- 23 YOUR IP: 1xx.xx.xx.xx YOUR DOMAIN: imcvpn.imctop.top ZTNCUI ENV CONFIGURATION: NODE_ENV=production MYADDR=1xx.xx.xx.xx HTTP_PORT=3000 HTTP_ALL_INTERFACES=yes Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process. Listening for HTTP requests on port 3000 on all interfaces Listening for HTTPS requests on port 3443 on all interfaces GET /login 200 269.668 ms - 2292 GET /bscss/bootstrap.min.css 304 9.030 ms - - GET /stylesheets/style.css 304 10.042 ms - - GET /jqjs/jquery.min.js 304 1.793 ms - - GET /bsjs/bootstrap.min.js 304 1.816 ms - - GET /images/key-logo.svg 304 1.771 ms - - GET /fonts/glyphicons-halflings-regular.woff2 304 2.098 ms - -

shuncon commented 1 year ago
-e ZTNCUI_PASSWD=admin123
--env-file .env

请检查 的内容,如果有两个同名的环境变量,则可能会替换环境变量的内容。.env At the beginning, I wrote the password in .env and it didn’t work

kmahyyg commented 1 year ago

Please try remove -f after docker log, this param is already removed according to your feedback.

Try to reproduce

I use the following environment variable:

NODE_ENV=production
ZTNCUI_PASSWD=admin123
MYDOMAIN=<YOUR DOMAIN>
HTTP_PORT=3000
HTTP_ALL_INTERFACES=yes
AUTOGEN_PLANET=1

With command:

docker run -d -p3443:3443 -p3180:3180 -p9993:9993/udp \
    -v /mydata/ztncui:/opt/key-networks/ztncui/etc \
    -v /mydata/zt1:/var/lib/zerotier-one \
    -v /mydata/zt-mkworld-conf:/etc/zt-mkworld \
    --env-file ./env-test-docker\
    --restart always \
    --cap-add=NET_ADMIN --device /dev/net/tun:/dev/net/tun \
    --name ztncui \
    ghcr.io/kmahyyg/ztncui-aio

It successfully runs. And password admin123 works.

I have to WARN you that please do NOT expose this directly to the internet and do not use weak password since this program does NOT have a protection mechanism against brute force.

You should see log like this:

20230502-iTerm2-002698

Submitted log analysis

20230502-Google Chrome-002700

According to: https://github.com/kmahyyg/ztncui-aio/blob/621de7f0cd7f95397dd6b99488d91066cc72facf/start_ztncui.sh#L52

To prevent from re-initialize multiple times to override the password, if you've already initialized before, the password won't be reset to prevent from third-party attack.

You should delete the /mydata/ztncui/passwd to reset password. Or you could use /usr/local/bin/argon2g to generate yourself and replace the file.

shuncon commented 1 year ago

tks

shuncon commented 1 year ago

I operate according to the docker run parameters you provided and still have no password. I am no longer deliberately looking for difficulties.

shuncon commented 1 year ago

docker exec/logs Waiting for parameters still doesn't work

shuncon commented 1 year ago

It must be placed in the directory under /mydata/ to see the password, and I am in the /data directory. Does this limit the user's use of the environment?

kmahyyg commented 1 year ago

docker exec/logs Waiting for parameters still doesn't work

Please do offer:

It must be placed in the directory under /mydata/ to see the password, and I am in the /data directory. Does this limit the user's use of the environment?

No. Check the docs of docker: https://docs.docker.com/storage/volumes/

I operate according to the docker run parameters you provided and still have no password. I am no longer deliberately looking for difficulties.

Cannot understand what you say.

kmahyyg commented 1 year ago

Also, docs is updated in README, please check.