Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why peertube don't read /etc/hosts #2342

Open
EricThi opened this issue Dec 16, 2019 · 9 comments
Open

why peertube don't read /etc/hosts #2342

EricThi opened this issue Dec 16, 2019 · 9 comments

Comments

@EricThi
Copy link

@EricThi EricThi commented Dec 16, 2019

What happened?
On starting, peertube has a error to connected on my smtp.
This smtp is on "local" network and for any services deployed, i use private ip, not public ip for many reason (no nat hairpinning for example)

I need to use domain set on /etc/hosts for bypass dns set on vm (my dns via pihole)

At this time, peertube connect on my public ip

What do you expect to happen instead?
I need to access on my smtp via private ip set on my /etc/hosts

Steps to reproduce:

  1. I configure my smtp with domain (i use certificate ca_file)

2.peertube test connection on domain

3.log :
Dec 16 07:57:28 peertube systemd[1]: Starting PeerTube daemon...
Dec 16 07:57:58 peertube systemd[1]: Started PeerTube daemon.
Dec 16 07:57:59 peertube peertube[4353]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 16 07:57:59 peertube peertube[4353]: > node dist/server
Dec 16 07:58:00 peertube peertube[4353]: (node:4364) ExperimentalWarning: queueMicrotask() is experimental.
Dec 16 07:58:00 peertube peertube[4353]: [peertube.eric.ovh:443] 2019-12-16 07:58:00.943 info: Database peertube_prod is ready.
Dec 16 07:58:01 peertube peertube[4353]: [peertube.eric.ovh:443] 2019-12-16 07:58:01.079 info: Using smtp_domain:587 as SMTP server.
Dec 16 07:58:01 peertube peertube[4353]: [peertube.eric.ovh:443] 2019-12-16 07:58:01.082 info: Testing SMTP server...
Dec 16 07:58:01 peertube peertube[4353]: [peertube.eric.ovh:443] 2019-12-16 07:58:01.108 error: connect ECONNREFUSED public_ip:587 {
Dec 16 07:58:01 peertube peertube[4353]: "component": "smtp-connection",
Dec 16 07:58:01 peertube peertube[4353]: "sid": "xxxx"
Dec 16 07:58:01 peertube peertube[4353]: }
Dec 16 07:58:01 peertube peertube[4353]: [peertube.eric.ovh:443] 2019-12-16 07:58:01.109 error: Failed to connect to SMTP smtp_domain:587. {
Dec 16 07:58:01 peertube peertube[4353]: "err": {
Dec 16 07:58:01 peertube peertube[4353]: "stack": "Error: connect ECONNREFUSED public_ip:587\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)",
Dec 16 07:58:01 peertube peertube[4353]: "message": "connect ECONNREFUSED public_ip:587",
Dec 16 07:58:01 peertube peertube[4353]: "errno": "ECONNREFUSED",
Dec 16 07:58:01 peertube peertube[4353]: "code": "ESOCKET",
Dec 16 07:58:01 peertube peertube[4353]: "syscall": "connect",
Dec 16 07:58:01 peertube peertube[4353]: "address": "public_ip",
Dec 16 07:58:01 peertube peertube[4353]: "port": 587,
Dec 16 07:58:01 peertube peertube[4353]: "command": "CONN"
Dec 16 07:58:01 peertube peertube[4353]: }
Dec 16 07:58:01 peertube peertube[4353]: }
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! code ELIFECYCLE
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! errno 255
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! peertube@2.0.0 start: node dist/server
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! Exit status 255
Dec 16 07:58:01 peertube peertube[4353]: npm ERR!
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! Failed at the peertube@2.0.0 start script.
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! A complete log of this run can be found in:
Dec 16 07:58:01 peertube peertube[4353]: npm ERR! /var/www/peertube/.npm/_logs/2019-12-16T06_58_01_124Z-debug.log
Dec 16 07:58:01 peertube systemd[1]: peertube.service: Main process exited, code=exited, status=255/EXCEPTION
Dec 16 07:58:01 peertube systemd[1]: peertube.service: Failed with result 'exit-code'.
Dec 16 07:58:01 peertube systemd[1]: peertube.service: Service RestartSec=100ms expired, scheduling restart.
Dec 16 07:58:01 peertube systemd[1]: peertube.service: Scheduled restart job, restart counter is at 47.
Dec 16 07:58:01 peertube systemd[1]: Stopped PeerTube daemon.

4 . my smtp_domain is set on /etc/hosts with good ip
5. mtr/nmap/gentest hosts return private ip except host
=> peertube via node bypass /etc/hosts ? how force it to use /etc/hosts before dns ?
6. after rollback on my previous smtp public, all is good and peertube started.

Additional information

  • PeerTube version or URL: V2.0.0 - https://peertube.eric.ovh/about/instance

  • Browser name/version: Firefox 72.0b6 (64 bits)

  • NodeJS version: node --version : v11.15.0

  • Link to browser console log if useful: /

  • Link to server log if useful (journalctl or /var/www/peertube/storage/logs/): /

Thank you,
Eric

@Chocobozzz

This comment has been minimized.

Copy link
Owner

@Chocobozzz Chocobozzz commented Dec 16, 2019

It should use your /etc/hosts because nodemailer fallbacks to dns.lookup: https://github.com/nodemailer/nodemailer/blob/master/lib/shared/index.js#L99

Please add console.log in this file (node_modules/nodemailer/lib/shared/index.js) to see what happens

@EricThi

This comment has been minimized.

Copy link
Author

@EricThi EricThi commented Dec 18, 2019

Hello,

Thank you for your answer and sorry for delay.

I'm not sur to console.log, i have set (i'm a ops :/ ):
console.log (dns.lookup(options.host), {}, (err, address) => {

And return it's same for me (little obfuscated) :
Dec 18 06:27:41 peertube systemd[1]: Starting PeerTube daemon...
Dec 18 06:28:11 peertube systemd[1]: Started PeerTube daemon.
Dec 18 06:28:11 peertube peertube[27264]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 18 06:28:11 peertube peertube[27264]: > node dist/server
Dec 18 06:28:13 peertube peertube[27264]: (node:27275) ExperimentalWarning: queueMicrotask() is experimental.
Dec 18 06:28:13 peertube peertube[27264]: [peertube.eric.ovh:443] 2019-12-18 06:28:13.597 info: Database peertube_prod is ready.
Dec 18 06:28:13 peertube peertube[27264]: [peertube.eric.ovh:443] 2019-12-18 06:28:13.728 info: Using public_ndd:587 as SMTP server.
Dec 18 06:28:13 peertube peertube[27264]: [peertube.eric.ovh:443] 2019-12-18 06:28:13.731 info: Testing SMTP server...
Dec 18 06:28:13 peertube peertube[27264]: [peertube.eric.ovh:443] 2019-12-18 06:28:13.763 error: connect ECONNREFUSED public_ip:587 {
Dec 18 06:28:13 peertube peertube[27264]: "component": "smtp-connection",
Dec 18 06:28:13 peertube peertube[27264]: "sid": "xxxx"
Dec 18 06:28:13 peertube peertube[27264]: }
Dec 18 06:28:13 peertube peertube[27264]: [peertube.eric.ovh:443] 2019-12-18 06:28:13.764 error: Failed to connect to SMTP public_ndd:587. {
Dec 18 06:28:13 peertube peertube[27264]: "err": {
Dec 18 06:28:13 peertube peertube[27264]: "stack": "Error: connect ECONNREFUSED public_ip:587\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)",
Dec 18 06:28:13 peertube peertube[27264]: "message": "connect ECONNREFUSED public_ip:587",
Dec 18 06:28:13 peertube peertube[27264]: "errno": "ECONNREFUSED",
Dec 18 06:28:13 peertube peertube[27264]: "code": "ESOCKET",
Dec 18 06:28:13 peertube peertube[27264]: "syscall": "connect",
Dec 18 06:28:13 peertube peertube[27264]: "address": "public_ip",
Dec 18 06:28:13 peertube peertube[27264]: "port": 587,
Dec 18 06:28:13 peertube peertube[27264]: "command": "CONN"
Dec 18 06:28:13 peertube peertube[27264]: }
Dec 18 06:28:13 peertube peertube[27264]: }
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! code ELIFECYCLE
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! errno 255
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! peertube@2.0.0 start: node dist/server
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! Exit status 255
Dec 18 06:28:13 peertube peertube[27264]: npm ERR!
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! Failed at the peertube@2.0.0 start script.
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! A complete log of this run can be found in:
Dec 18 06:28:13 peertube peertube[27264]: npm ERR! /var/www/peertube/.npm/_logs/2019-12-18T05_28_13_776Z-debug.log
Dec 18 06:28:13 peertube systemd[1]: peertube.service: Main process exited, code=exited, status=255/EXCEPTION
Dec 18 06:28:13 peertube systemd[1]: peertube.service: Failed with result 'exit-code'.
Dec 18 06:28:14 peertube systemd[1]: peertube.service: Service RestartSec=100ms expired, scheduling restart.
Dec 18 06:28:14 peertube systemd[1]: peertube.service: Scheduled restart job, restart counter is at 1722.
Dec 18 06:28:14 peertube systemd[1]: Stopped PeerTube daemon.

and
cat /var/www/peertube/.npm/_logs/2019-12-18T05_28_13_776Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v11.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle peertube@2.0.0prestart: peertube@2.0.0
6 info lifecycle peertube@2.0.0
start: peertube@2.0.0
7 verbose lifecycle peertube@2.0.0start: unsafe-perm in lifecycle true
8 verbose lifecycle peertube@2.0.0
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/peertube/versions/peertube-v2.0.0/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin
9 verbose lifecycle peertube@2.0.0start: CWD: /var/www/peertube/versions/peertube-v2.0.0
10 silly lifecycle peertube@2.0.0
start: Args: [ '-c', 'node dist/server' ]
11 silly lifecycle peertube@2.0.0start: Returned: code: 255 signal: null
12 info lifecycle peertube@2.0.0
start: Failed to exec start script
13 verbose stack Error: peertube@2.0.0 start: node dist/server
13 verbose stack Exit status 255
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid peertube@2.0.0
15 verbose cwd /var/www/peertube/versions/peertube-v2.0.0
16 verbose Linux 5.1.15-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v11.15.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 255
22 error peertube@2.0.0 start: node dist/server
22 error Exit status 255
23 error Failed at the peertube@2.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 255, true ]

@Chocobozzz

This comment has been minimized.

Copy link
Owner

@Chocobozzz Chocobozzz commented Dec 18, 2019

            try {
                console.log('Will lookup %s', options.host)
                dns.lookup(options.host, {}, (err, address) => {
                  console.log('Got result: %s', address)
@EricThi

This comment has been minimized.

Copy link
Author

@EricThi EricThi commented Dec 18, 2019

cat /var/www/peertube/peertube-latest/node_modules/nodemailer/lib/shared/index.js | grep "console.log('W" -B 5 -A 5

            });
            return callback(null, value);
        }

    try {
            console.log('Will lookup %s', options.host)
            dns.lookup(options.host, {}, (err, address) => {
              console.log('Got result: %s', address)
                if (err) {
                    if (cached) {
                        // ignore error, use expired value

log service :
Dec 18 08:48:18 peertube systemd[1]: Starting PeerTube daemon...
Dec 18 08:48:48 peertube systemd[1]: Started PeerTube daemon.
Dec 18 08:48:48 peertube peertube[12905]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 18 08:48:48 peertube peertube[12905]: > node dist/server
Dec 18 08:48:49 peertube peertube[12905]: (node:12916) ExperimentalWarning: queueMicrotask() is experimental.
Dec 18 08:48:50 peertube peertube[12905]: [peertube.eric.ovh:443] 2019-12-18 08:48:50.093 info: Database peertube_prod is ready.
Dec 18 08:48:50 peertube peertube[12905]: [peertube.eric.ovh:443] 2019-12-18 08:48:50.227 info: Using public_ndd:587 as SMTP server.
Dec 18 08:48:50 peertube peertube[12905]: [peertube.eric.ovh:443] 2019-12-18 08:48:50.230 info: Testing SMTP server...
Dec 18 08:48:50 peertube peertube[12905]: [peertube.eric.ovh:443] 2019-12-18 08:48:50.257 error: connect ECONNREFUSED public_ip:587 {
Dec 18 08:48:50 peertube peertube[12905]: "component": "smtp-connection",
Dec 18 08:48:50 peertube peertube[12905]: "sid": "xxx"
Dec 18 08:48:50 peertube peertube[12905]: }
Dec 18 08:48:50 peertube peertube[12905]: [peertube.eric.ovh:443] 2019-12-18 08:48:50.258 error: Failed to connect to SMTP public_ndd:587. {
Dec 18 08:48:50 peertube peertube[12905]: "err": {
Dec 18 08:48:50 peertube peertube[12905]: "stack": "Error: connect ECONNREFUSED public_ip:587\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)",
Dec 18 08:48:50 peertube peertube[12905]: "message": "connect ECONNREFUSED public_ip:587",
Dec 18 08:48:50 peertube peertube[12905]: "errno": "ECONNREFUSED",
Dec 18 08:48:50 peertube peertube[12905]: "code": "ESOCKET",
Dec 18 08:48:50 peertube peertube[12905]: "syscall": "connect",
Dec 18 08:48:50 peertube peertube[12905]: "address": "public_ip",
Dec 18 08:48:50 peertube peertube[12905]: "port": 587,
Dec 18 08:48:50 peertube peertube[12905]: "command": "CONN"
Dec 18 08:48:50 peertube peertube[12905]: }
Dec 18 08:48:50 peertube peertube[12905]: }
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! code ELIFECYCLE
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! errno 255
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! peertube@2.0.0 start: node dist/server
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! Exit status 255
Dec 18 08:48:50 peertube peertube[12905]: npm ERR!
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! Failed at the peertube@2.0.0 start script.
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! A complete log of this run can be found in:
Dec 18 08:48:50 peertube peertube[12905]: npm ERR! /var/www/peertube/.npm/_logs/2019-12-18T07_48_50_273Z-debug.log
Dec 18 08:48:50 peertube systemd[1]: peertube.service: Main process exited, code=exited, status=255/EXCEPTION
Dec 18 08:48:50 peertube systemd[1]: peertube.service: Failed with result 'exit-code'.
Dec 18 08:48:50 peertube systemd[1]: peertube.service: Service RestartSec=100ms expired, scheduling restart.
Dec 18 08:48:50 peertube systemd[1]: peertube.service: Scheduled restart job, restart counter is at 1981.
Dec 18 08:48:50 peertube systemd[1]: Stopped PeerTube daemon.

cat /var/www/peertube/.npm/_logs/2019-12-18T07_48_50_273Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v11.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle peertube@2.0.0prestart: peertube@2.0.0
6 info lifecycle peertube@2.0.0
start: peertube@2.0.0
7 verbose lifecycle peertube@2.0.0start: unsafe-perm in lifecycle true
8 verbose lifecycle peertube@2.0.0
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/peertube/versions/peertube-v2.0.0/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin
9 verbose lifecycle peertube@2.0.0start: CWD: /var/www/peertube/versions/peertube-v2.0.0
10 silly lifecycle peertube@2.0.0
start: Args: [ '-c', 'node dist/server' ]
11 silly lifecycle peertube@2.0.0start: Returned: code: 255 signal: null
12 info lifecycle peertube@2.0.0
start: Failed to exec start script
13 verbose stack Error: peertube@2.0.0 start: node dist/server
13 verbose stack Exit status 255
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid peertube@2.0.0
15 verbose cwd /var/www/peertube/versions/peertube-v2.0.0
16 verbose Linux 5.1.15-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v11.15.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 255
22 error peertube@2.0.0 start: node dist/server
22 error Exit status 255
23 error Failed at the peertube@2.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 255, true ]

I'm faulty or log don't change ? (for information, i clone my server to "server debug" for testing.
Same environement without data and external access to users on this instance.

@Chocobozzz

This comment has been minimized.

Copy link
Owner

@Chocobozzz Chocobozzz commented Dec 18, 2019

@EricThi

This comment has been minimized.

Copy link
Author

@EricThi EricThi commented Dec 18, 2019

I can send domain name with ip public and private via your email ?
I can send a log without public_dd and co and detail with commands :
host / nslookup => reply public ip -> logical
ping / nmap => reply private ip -> logical

other(s) needed ?

Information, my configuration to connect on smtp via private ip work for another instances on same network (nextcloud/mastodon/statping) => I extend to all services and the next is peertube.
I have testing command on instance nextcloud, i have the same return.

warf, on log : ReferenceError: address is not defined

console.log to resolver 4 and 6:

cat /var/www/peertube/peertube-latest/node_modules/nodemailer/lib/shared/index.js | grep "console.log('W" -A 2

		console.log('Will lookup %s', options.host)
    resolver(4, options.host, (err, addresses) => {
	    console.log('Got result: %s', address)
--
		console.log('Will lookup %s', options.host)
        resolver(6, options.host, (err, addresses) => {
		console.log('Got result: %s', address)
--
		    console.log('Will lookup %s', options.host)
                dns.lookup(options.host, {}, (err, address) => {
			console.log('Got result: %s', address)

Dec 18 10:19:50 peertube systemd[1]: Starting PeerTube daemon...
Dec 18 10:20:20 peertube systemd[1]: Started PeerTube daemon.
Dec 18 10:20:20 peertube peertube[30664]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 18 10:20:20 peertube peertube[30664]: > node dist/server
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.385 info: Database peertube_prod is ready.
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.512 info: Using public_ndd:587 as SMTP server.
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.514 info: Testing SMTP server...
Dec 18 10:20:22 peertube peertube[30664]: Will lookup public_ndd
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.535 error: uncaughtException: address is not defined
Dec 18 10:20:22 peertube peertube[30664]: ReferenceError: address is not defined
Dec 18 10:20:22 peertube peertube[30664]: at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36
Dec 18 10:20:22 peertube peertube[30664]: at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)
Dec 18 10:20:22 peertube peertube[30664]: at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10) {
Dec 18 10:20:22 peertube peertube[30664]: "error": {
Dec 18 10:20:22 peertube peertube[30664]: "stack": "ReferenceError: address is not defined\n at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36\n at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)\n at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10)",
Dec 18 10:20:22 peertube peertube[30664]: "message": "address is not defined"
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "stack": "ReferenceError: address is not defined\n at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36\n at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)\n at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10)",
Dec 18 10:20:22 peertube peertube[30664]: "exception": true,
Dec 18 10:20:22 peertube peertube[30664]: "date": "Wed Dec 18 2019 10:20:22 GMT+0100 (Central European Standard Time)",
Dec 18 10:20:22 peertube peertube[30664]: "process": {
Dec 18 10:20:22 peertube peertube[30664]: "pid": 30675,
Dec 18 10:20:22 peertube peertube[30664]: "uid": 1000,
Dec 18 10:20:22 peertube peertube[30664]: "gid": 1000,
Dec 18 10:20:22 peertube peertube[30664]: "cwd": "/var/www/peertube/versions/peertube-v2.0.0",
Dec 18 10:20:22 peertube peertube[30664]: "execPath": "/usr/bin/node",
Dec 18 10:20:22 peertube peertube[30664]: "version": "v13.3.0",
Dec 18 10:20:22 peertube peertube[30664]: "argv": [
Dec 18 10:20:22 peertube peertube[30664]: "/usr/bin/node",
Dec 18 10:20:22 peertube peertube[30664]: "/var/www/peertube/versions/peertube-v2.0.0/dist/server"
Dec 18 10:20:22 peertube peertube[30664]: ],
Dec 18 10:20:22 peertube peertube[30664]: "memoryUsage": {
Dec 18 10:20:22 peertube peertube[30664]: "rss": 153059328,
Dec 18 10:20:22 peertube peertube[30664]: "heapTotal": 95436800,
Dec 18 10:20:22 peertube peertube[30664]: "heapUsed": 67707464,
Dec 18 10:20:22 peertube peertube[30664]: "external": 1692585
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "os": {
Dec 18 10:20:22 peertube peertube[30664]: "loadavg": [
Dec 18 10:20:22 peertube peertube[30664]: 0.20361328125,
Dec 18 10:20:22 peertube peertube[30664]: 0.3134765625,
Dec 18 10:20:22 peertube peertube[30664]: 0.33984375
Dec 18 10:20:22 peertube peertube[30664]: ],
Dec 18 10:20:22 peertube peertube[30664]: "uptime": 73283
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "trace": [
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 36,
Dec 18 10:20:22 peertube peertube[30664]: "file": "/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": null,
Dec 18 10:20:22 peertube peertube[30664]: "line": 58,
Dec 18 10:20:22 peertube peertube[30664]: "method": null,
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 16,
Dec 18 10:20:22 peertube peertube[30664]: "file": "/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": "QueryReqWrap.callback",
Dec 18 10:20:22 peertube peertube[30664]: "line": 27,
Dec 18 10:20:22 peertube peertube[30664]: "method": "callback",
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 10,
Dec 18 10:20:22 peertube peertube[30664]: "file": "dns.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": "QueryReqWrap.onresolve [as oncomplete]",
Dec 18 10:20:22 peertube peertube[30664]: "line": 208,
Dec 18 10:20:22 peertube peertube[30664]: "method": "onresolve [as oncomplete]",
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:22 peertube peertube[30664]: ]
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! code ELIFECYCLE
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! errno 1
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! peertube@2.0.0 start: node dist/server
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! Exit status 1
Dec 18 10:20:25 peertube peertube[30664]: npm ERR!
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! Failed at the peertube@2.0.0 start script.
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! A complete log of this run can be found in:
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! /var/www/peertube/.npm/_logs/2019-12-18T09_20_25_549Z-debug.log
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Failed with result 'exit-code'.
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Scheduled restart job, restart counter is at 2151.
Dec 18 10:20:25 peertube systemd[1]: Stopped PeerTube daemon.

Dec 18 10:19:50 peertube systemd[1]: Starting PeerTube daemon...
Dec 18 10:20:20 peertube systemd[1]: Started PeerTube daemon.
Dec 18 10:20:20 peertube peertube[30664]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 18 10:20:20 peertube peertube[30664]: > node dist/server
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.385 info: Database peertube_prod is ready.
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.512 info: Using public_ndd:587 as SMTP server.
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.514 info: Testing SMTP server...
Dec 18 10:20:22 peertube peertube[30664]: Will lookup public_ndd
Dec 18 10:20:22 peertube peertube[30664]: [peertube.eric.ovh:443] 2019-12-18 10:20:22.535 error: uncaughtException: address is not defined
Dec 18 10:20:22 peertube peertube[30664]: ReferenceError: address is not defined
Dec 18 10:20:22 peertube peertube[30664]: at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36
Dec 18 10:20:22 peertube peertube[30664]: at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)
Dec 18 10:20:22 peertube peertube[30664]: at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10) {
Dec 18 10:20:22 peertube peertube[30664]: "error": {
Dec 18 10:20:22 peertube peertube[30664]: "stack": "ReferenceError: address is not defined\n at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36\n at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)\n at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10)",
Dec 18 10:20:22 peertube peertube[30664]: "message": "address is not defined"
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "stack": "ReferenceError: address is not defined\n at /var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:58:36\n at QueryReqWrap.callback (/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js:27:16)\n at QueryReqWrap.onresolve [as oncomplete] (dns.js:208:10)",
Dec 18 10:20:22 peertube peertube[30664]: "exception": true,
Dec 18 10:20:22 peertube peertube[30664]: "date": "Wed Dec 18 2019 10:20:22 GMT+0100 (Central European Standard Time)",
Dec 18 10:20:22 peertube peertube[30664]: "process": {
Dec 18 10:20:22 peertube peertube[30664]: "pid": 30675,
Dec 18 10:20:22 peertube peertube[30664]: "uid": 1000,
Dec 18 10:20:22 peertube peertube[30664]: "gid": 1000,
Dec 18 10:20:22 peertube peertube[30664]: "cwd": "/var/www/peertube/versions/peertube-v2.0.0",
Dec 18 10:20:22 peertube peertube[30664]: "execPath": "/usr/bin/node",
Dec 18 10:20:22 peertube peertube[30664]: "version": "v13.3.0",
Dec 18 10:20:22 peertube peertube[30664]: "argv": [
Dec 18 10:20:22 peertube peertube[30664]: "/usr/bin/node",
Dec 18 10:20:22 peertube peertube[30664]: "/var/www/peertube/versions/peertube-v2.0.0/dist/server"
Dec 18 10:20:22 peertube peertube[30664]: ],
Dec 18 10:20:22 peertube peertube[30664]: "memoryUsage": {
Dec 18 10:20:22 peertube peertube[30664]: "rss": 153059328,
Dec 18 10:20:22 peertube peertube[30664]: "heapTotal": 95436800,
Dec 18 10:20:22 peertube peertube[30664]: "heapUsed": 67707464,
Dec 18 10:20:22 peertube peertube[30664]: "external": 1692585
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "os": {
Dec 18 10:20:22 peertube peertube[30664]: "loadavg": [
Dec 18 10:20:22 peertube peertube[30664]: 0.20361328125,
Dec 18 10:20:22 peertube peertube[30664]: 0.3134765625,
Dec 18 10:20:22 peertube peertube[30664]: 0.33984375
Dec 18 10:20:22 peertube peertube[30664]: ],
Dec 18 10:20:22 peertube peertube[30664]: "uptime": 73283
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: "trace": [
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 36,
Dec 18 10:20:22 peertube peertube[30664]: "file": "/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": null,
Dec 18 10:20:22 peertube peertube[30664]: "line": 58,
Dec 18 10:20:22 peertube peertube[30664]: "method": null,
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 16,
Dec 18 10:20:22 peertube peertube[30664]: "file": "/var/www/peertube/versions/peertube-v2.0.0/node_modules/nodemailer/lib/shared/index.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": "QueryReqWrap.callback",
Dec 18 10:20:22 peertube peertube[30664]: "line": 27,
Dec 18 10:20:22 peertube peertube[30664]: "method": "callback",
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: },
Dec 18 10:20:22 peertube peertube[30664]: {
Dec 18 10:20:22 peertube peertube[30664]: "column": 10,
Dec 18 10:20:22 peertube peertube[30664]: "file": "dns.js",
Dec 18 10:20:22 peertube peertube[30664]: "function": "QueryReqWrap.onresolve [as oncomplete]",
Dec 18 10:20:22 peertube peertube[30664]: "line": 208,
Dec 18 10:20:22 peertube peertube[30664]: "method": "onresolve [as oncomplete]",
Dec 18 10:20:22 peertube peertube[30664]: "native": false
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:22 peertube peertube[30664]: ]
Dec 18 10:20:22 peertube peertube[30664]: }
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! code ELIFECYCLE
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! errno 1
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! peertube@2.0.0 start: node dist/server
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! Exit status 1
Dec 18 10:20:25 peertube peertube[30664]: npm ERR!
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! Failed at the peertube@2.0.0 start script.
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! A complete log of this run can be found in:
Dec 18 10:20:25 peertube peertube[30664]: npm ERR! /var/www/peertube/.npm/_logs/2019-12-18T09_20_25_549Z-debug.log
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Failed with result 'exit-code'.
Dec 18 10:20:25 peertube systemd[1]: peertube.service: Scheduled restart job, restart counter is at 2151.
Dec 18 10:20:25 peertube systemd[1]: Stopped PeerTube daemon.

cat /var/www/peertube/.npm/_logs/2019-12-18T09_20_25_549Z-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.13.4
3 info using node@v13.3.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle peertube@2.0.0prestart: peertube@2.0.0
6 info lifecycle peertube@2.0.0
start: peertube@2.0.0
7 verbose lifecycle peertube@2.0.0start: unsafe-perm in lifecycle true
8 verbose lifecycle peertube@2.0.0
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/peertube/versions/peertube-v2.0.0/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin
9 verbose lifecycle peertube@2.0.0start: CWD: /var/www/peertube/versions/peertube-v2.0.0
10 silly lifecycle peertube@2.0.0
start: Args: [ '-c', 'node dist/server' ]
11 silly lifecycle peertube@2.0.0start: Returned: code: 1 signal: null
12 info lifecycle peertube@2.0.0
start: Failed to exec start script
13 verbose stack Error: peertube@2.0.0 start: node dist/server
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:219:5)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:219:5)
13 verbose stack at maybeClose (internal/child_process.js:1027:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:285:5)
14 verbose pkgid peertube@2.0.0
15 verbose cwd /var/www/peertube/versions/peertube-v2.0.0
16 verbose Linux 5.1.15-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v13.3.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error peertube@2.0.0 start: node dist/server
22 error Exit status 1
23 error Failed at the peertube@2.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Command :
host public_ndd
public_ndd has address public_ip

nslookup public_ndd
Server: ip_private_dns
Address: ip_private_dns#53

Name: public_ndd
Address: public_ip

ping public_ndd
PING public_ndd (private_ip) 56(84) bytes of data.
64 bytes from public_ndd (private_ip): icmp_seq=1 ttl=64 time=0.433 ms
64 bytes from public_ndd (private_ip): icmp_seq=2 ttl=64 time=0.150 ms
^C
---public_ndd ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.150/0.291/0.433/0.141 ms

nmap -Pn public_ndd
Starting Nmap 7.80 ( https://nmap.org ) at 2019-12-18 09:56 CET
Nmap scan report for public_ndd (private_ip)
Host is up (0.00057s latency).
Not shown: 988 closed ports
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
110/tcp open pop3
143/tcp open imap
443/tcp open https
465/tcp open smtps
587/tcp open submission
993/tcp open imaps
995/tcp open pop3s

Nmap done: 1 IP address (1 host up) scanned in 1.49 seconds

cat /etc/hosts | grep mail
private_ip public_ndd mail

@Chocobozzz

This comment has been minimized.

Copy link
Owner

@Chocobozzz Chocobozzz commented Dec 18, 2019

It's addresses for the two first resolvers

@EricThi

This comment has been minimized.

Copy link
Author

@EricThi EricThi commented Dec 18, 2019

Hum, I understand :
https://nodemailer.com/smtp/

Hostnames for the host field are resolved using dns.resolve(). If you are using a non-resolvable hostname (eg. something listed in /etc/hosts or you are using different resolver for you Node apps) then provide the IP address of the SMTP server as host and for the actual hostname user tls.servername parameter. This way not hostname resolving is attempted but TLS validation still works.

Hum, I cannot for validate cert

@EricThi

This comment has been minimized.

Copy link
Author

@EricThi EricThi commented Dec 18, 2019

Mouarf, I have use a bad fixing:
npm install nodemailer@4.7.0 --save

Dec 18 14:08:24 peertube systemd[1]: Starting PeerTube daemon...
Dec 18 14:08:54 peertube systemd[1]: Started PeerTube daemon.
Dec 18 14:08:54 peertube peertube[5670]: > peertube@2.0.0 start /var/www/peertube/versions/peertube-v2.0.0
Dec 18 14:08:54 peertube peertube[5670]: > node dist/server
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.068 info: Database peertube_prod is ready.
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.210 info: Using domain_pub:587 as SMTP server.
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.211 info: Testing SMTP server...
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.232 info: Connection established to private_IP:587 {
Dec 18 14:08:56 peertube peertube[5681]: "component": "smtp-connection",
Dec 18 14:08:56 peertube peertube[5681]: "sid": "xxx",
Dec 18 14:08:56 peertube peertube[5681]: "tnx": "network",
Dec 18 14:08:56 peertube peertube[5681]: "localAddress": "private_IP_instance-debug",
Dec 18 14:08:56 peertube peertube[5681]: "localPort": 52160,
Dec 18 14:08:56 peertube peertube[5681]: "remoteAddress": "private_IP",
Dec 18 14:08:56 peertube peertube[5681]: "remotePort": 587
Dec 18 14:08:56 peertube peertube[5681]: }
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.281 info: Connection upgraded with STARTTLS {
Dec 18 14:08:56 peertube peertube[5681]: "component": "smtp-connection",
Dec 18 14:08:56 peertube peertube[5681]: "sid": "xxx",
Dec 18 14:08:56 peertube peertube[5681]: "tnx": "smtp"
Dec 18 14:08:56 peertube peertube[5681]: }
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.286 info: User "username" authenticated {
Dec 18 14:08:56 peertube peertube[5681]: "component": "smtp-connection",
Dec 18 14:08:56 peertube peertube[5681]: "sid": "xxx",
Dec 18 14:08:56 peertube peertube[5681]: "tnx": "smtp",
Dec 18 14:08:56 peertube peertube[5681]: "username": "username",
Dec 18 14:08:56 peertube peertube[5681]: "action": "authenticated",
Dec 18 14:08:56 peertube peertube[5681]: "method": "PLAIN"
Dec 18 14:08:56 peertube peertube[5681]: }
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.286 info: Successfully connected to SMTP server.
Dec 18 14:08:56 peertube peertube[5681]: [peertube.eric.ovh:443] 2019-12-18 14:08:56.341 info: Cleaning HTML cache.

mouarf, it's always my debug instance... it's a very bad idea to rollback to 4.7 and for me, never, nodemailer can revert.

Do you have a idea to deprecated this version for peertube ? I need a little time t reverse-engeneering my configuration for nodemailer :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.