express.js通过转发的ssh远程端口https app

时间:2017-05-30 09:51:51

标签: express curl ssh https portforwarding

我像这样转发远程ssh端口:

ssh -N ec2-user@remote.server -R *:8005:localhost:8005 remote.server

端口8005在远程和本地系统上都已打开。

然后在本地启动Express应用程序:

var fs = require('fs')

var credentials = {
    key: fs.readFileSync('server.key'),
    cert: fs.readFileSync('server.crt'),
    passphrase: 'ABCDEFGHJ123'
};

var https = require('https');
var express = require('express');
var app = express();
var httpsServer = https.createServer(credentials, app);

app.get('/', (req,res) => {
    res.end('it works');
})

app.listen(8005)

现在curl到远程服务器:

$curl -k remote.server:8005
it works

现在添加https://

$curl https://remote.server:8005
curl: (35) gnutls_handshake() failed:
        The TLS connection was non-properly terminated.

为什么它在没有https://的情况下有效,并且不适用于https://

如果没有https://工作,连接是否安全?

0 个答案:

没有答案