Tag: ssh

node.js paypal https请求

这里第一个问题,如果事实certificate是非常明显的道歉 我试图通过node.js调用贝宝自适应付款API,我得到一个580001无效的请求错误。 我可以用下面的消息和头文件通过curl做成功的调用,但不能通过节点。 任何帮助将非常感激。 var API_endpoint = "svcs.sandbox.paypal.com"; var API_user = ''; var API_pass = ''; var API_sig = ''; message='requestEnvelope.errorLanguage=en_US&actionType=PAY&senderEmail=test_1320882990_per@gmail.com&receiverList.receiver(0).email=test2_1320887729_biz@gmail.com& receiverList.receiver(0).amount=100.00&currencyCode=USD&cancelUrl=http://your_cancel_url& returnUrl=http://your_return_url' //var params = qs.parse(message); //params = qs.stringify(params); var req_options = { host: API_endpoint, method: 'POST', path: '/AdaptivePayments/Pay', headers: { 'Host': API_endpoint, 'Content-Type': 'application/x-www-form-urlencoded', //'Content-Type': 'text/namevalue', 'Content-Length': message.length, 'X-PAYPAL-REQUEST-DATA-FORMAT:':'NV', 'X-PAYPAL-RESPONSE-DATA-FORMAT':'NV', 'X-PAYPAL-SECURITY-USERID':API_user, 'X-PAYPAL-SECURITY-PASSWORD':API_pass, 'X-PAYPAL-SECURITY-SIGNATURE':API_sig, […]

ssh与nodejs child_process,在服务器上找不到命令

我试图通过nodejs child_process运行一个简单的ssh命令。 当我通过nodejs代码运行命令,它失败,说我发送到服务器的命令没有find。 当我运行相同的命令只是复制和粘贴到我的terminal窗口,它运行良好。 这里是我想要做的命令行版本: ssh user@example.com 'ls -lai' 这里是使用child_process的相同ssh命令的nodejs版本 var cproc = require('child_process'); var exec = cproc.exec; var spawn = cproc.spawn; var command = "ssh"; var args = ["user@example.com", "'ls -lai'"]; var child = spawn(command, args); child.stdout.on('data', function(data) { console.log('stdout: ' + data); }); child.stderr.on('data', function(data) { console.log('stderr: ' + data); }); child.on('close', function(code) […]

node.js – 将子快捷键发送给subprocess

我的程序产生“ssh”作为subprocess,与服务器连接,然后能够写入stream并读取其输出。 这一切工作正常。 当我把“ls”写入进程stream时,我得到了一个文件列表。 但现在,我想发送快捷键到这个进程,以便我可以放弃在ssh会话中运行的进程。 我知道这也可以通过stream,但我可以在哪里读到我必须发送到stream程,使其了解我的快捷键? 谢谢你的帮助!

如何使用ssh克隆git仓库与nodegit

我试图使用库nodegit(版本0.2.4)和ssh从node.js中的teamforge服务器中克隆git仓库。 我们的服务器请求来自用户的身份validation,当我试图只使用克隆方法而不传递选项时,我得到错误:“callback无法初始化SSH凭据”。 我有private.key和public.key文件中的私钥和公钥。 他们在我已经设置为web风暴工作目录的目录中,所以位置不应该是一个问题。 没有find例子如何做到这一点(也许我错过了),但下面的代码是最接近我得到: 'use strict'; var nodegit = require("nodegit"), Clone = nodegit.Clone, cred = nodegit.Cred; var options = { remoteCallbacks: { credentials: function () { return cred.sshKeyNew('user', 'public.key', 'private.key', ''); } } }; Clone.clone("ssh://user@teamforgeserver.net/reponame", "localTmp", options) .then(function(repo) { var r = repo; }, function(err){ var e = err; } ); 我得到这个错误: TypeError: Object […]

为Elastic Beanstalk上的github专用回购访问设置SSH密钥

我的Node.JS项目包含对github上托pipe的私有NPM repos的引用。 这在当地工作正常,但我很努力使这个工作在Elastic Beanstalk。 dependencies: { … "express": "^4.12.4", "jsonwebtoken": "^5.0.5", "my-private-module": "git@github.com:<my-user>/<my-repo>.git#<my-version>", … } – 我需要的是能够在我的Elastic Beanstalk实例上为git设置一个可用的SSHconfiguration,而不必在源代码控制中存储密钥等。 显然,EB实例没有所需的SSH密钥来访问我的私人github回购。 如果我使用内联username:password@github.com HTTPS风格的git URL,它可以正常工作。 它也可以使用github提供的oauth token方法 (本质上是一个user:pass)。 但我不希望有任何凭据检查源代码控制,所以我试图从github克隆到我的EB实例上通过SSH工作。 我已经尝试了一百万种方法,包括根据这个博客文章 npm preinstall脚本,它曾经工作,直到npm2,其中一个更改进行预安装后,运行树build立,和PR来解决这个问题仍悬而未决。 我已经尝试了一个.ebextensions命令configuration,试图调用git config将git@github.com上的一个insteadof放到一个HTTPS URL中,该环境variables来自一个OAUTH标记(本身很棘手,因为envvariables没有设置为这一次在启动周期中,缺less$ HOME会让git config感到困惑)。 我也尝试过使用.ebextensions在我的EB实例上设置SSH的各种不同方法,包括从所提到的博客文章的评论中提供的这个解决scheme 。 这基本上是我卡在现在的地方。 我已经成功地创build了一个密钥对,在我的githubconfiguration文件中进行设置,并validation私钥可以从我的本地客户端使用,以克隆我的回购 我已经把我的私钥和一个sshconfiguration文件放在一个专用的S3存储桶中 我已经创build了一个.ebextensions filesconfiguration,将这两个文件从我的S3存储桶复制到/tmp/.ssh/ ,根据这个例子 我创build了一个debuggingcommands .ebextensionsconfiguration,其中列出了/tmp/.ssh,并显示这些文件是从S3成功下载的: /tmp/.ssh/config包含: Host github.com IdentityFile /tmp/.ssh/deploy_key IdentitiesOnly yes UserKnownHostsFile=/dev/null StrictHostKeyChecking no /tmp/.ssh/deploy_key包含我的私钥,经validation可以在本地使用。 […]

如何使用NodeJS在SSH2上执行多个命令

我试图部署从GitHub使用我想执行多个命令,按照数组的顺序。 我现在使用的代码包含在下面。 async.series([ … // Deploy from GitHub function (callback) { // Console shizzle: console.log(''); console.log('Deploying…'.red.bold); console.log(); console.log(); var deployFunctions = [ { command: 'cd ' + envOptions.folder + ' && pwd', log: false }, { command: 'pwd' }, { command: 'su ' + envOptions.user, log: false }, { command: 'git pull' }, { command: […]

BASH脚本启动一个node.js套接字服务器作为服务

基本上我想完成的是一些脚本或方法,以启动一个node.js套接字服务器脚本作为服务。 这是为了让我不必在SSH上运行'node server.js',而必须在打开时坐在那里。 任何帮助,将不胜感激。 感谢Scott

操作系统升级后,无法在OSX El Capitan上启动NodeJS应用程序(Appium)

所以我有一段触发Appium的.Net代码,它是一个在Mac OS上运行的NodeJS应用程序。 它曾经在优胜美地工作,但在XCode和El Capitan更新后停止工作。 我正在尝试运行下面的命令作为代码的一部分: ssh.RunCommand("/usr/local/bin/forever start /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js –address 0.0.0.0 –port 4723 –log-level debug –device-name \"iPhone 6\" –platform-name iOS –platform-version \"8.4\" –app \"/Applications/my.app\" –browser-name iOS -l –log /Library/Logs/Appium/current.log"); 而且我正在Visual Studio中获得“env:node:No such file or directory” System Policy: deny file-write-data /usr/bin/env 在system.log我猜OS X不允许我访问/ usr / bin / env了,有什么办法可以绕过吗? 干杯!

Nodejs Numtel通过SSH连接的Mysql

我在使用numtel meteor软件包通过networking发送和接收MySql信息时遇到问题(数据库位于服务器上)。 目前,它能够使用他的软件包将数据库中的信息推送到屏幕上,但问题发生在第一次加载之后。 在第一次加载时,它能够从数据库中检索信息,并将其显示到屏幕上,但之后的任何事情似乎触发器都被破坏了,但只是有所不同。 我能够发送信息到服务器,但它似乎失败了dynamic检索。 信息发送到服务器就好了,但信息不会被检索并显示回屏幕上。 它也只是打破了一次,因为我添加了隧道代码。 它以前工作,并在同一台机器上使用数据库时得到更新。 messages = new MysqlSubscription('getMessages'); messages.addEventListener('update', function(diff, data) { console.log("Event listener"); }); if (Meteor.isClient) { Template.messageHistory.helpers({ messages: function () { return messages.reactive(); } }); } if (Meteor.isServer) { var Tunnel = Meteor.npmRequire('tunnel-ssh'); var config = { host: "ourhost", username: "uname", password: "password", port:22, dstPort:3306, srcPort:3307, }; Tunnel.tunnel(config, function(err) […]

服务器上的多个github私有npm存储库

我有一个私人存储库中的github节点应用程序。 这个节点应用程序也有我制作的自定义模块,它们在一个单独的私有存储库中。 这是示例节点应用程序url: git@github.com:thomas/node-application.git 这些都是节点应用程序使用的节点模块。 git@github.com:thomas/node-module1.git git@github.com:thomas/node-module2.git 你可以使用下面的命令在github上安装一个私有的npm模块。 npm install git+ssh://git@github.com:thomas/node_module1.git 为了这个工作机器需要有ssh密钥设置。 我的本地机器有我的github用户密钥设置和访问所有我的回购。 在我的服务器上,但是我正在使用部署密钥。 我知道如何使用多个部署密钥的唯一方法如下。 Host na.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-application ForwardAgent yes Host nm1.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-module1 ForwardAgent yes Host nm2.github.com HostName github.com User git IdentityFile ~/.ssh/gh_node-module2 ForwardAgent yes 所以我需要安装在服务器上的模块 npm install git+ssh://git@nm1.github.com:thomas/node_module1.git ^^^ 这意味着生产和发展的依赖将会不同 "node-module": "git+ssh://git@github.com:thomas/node-module1.git" VS "node-module": […]