R - getURL - no PORT COMMAND - r

I have been connecting to a ftp server for some time now, but it has stopped working this week.
The connection to the ftp works fine when accessing through FileZilla Client. But not when I try to go through R or internet explorer (both was working untill now).
I have made sure that no firewalls are blocking the access.
I am using the Rcurl, getUrl functions to retrieve the data.
When I compare the output in R with the output log from Filezilla, I can see that both succeed in logging in, then run the PASV command. But since the PASV is diabled, filezilla manage to run the PORT command and collect the data.
From Filezilla log:
2017-08-07 13:57:02 2372 1 Command: PASV
2017-08-07 13:57:02 2372 1 Response: 500 PASV command is disabled. Use PORT command.
2017-08-07 13:57:02 2372 1 Command: PORT 10,45,9,89,222,62
2017-08-07 13:57:02 2372 1 Response: 200 PORT command successful
2017-08-07 13:57:02 2372 1 Command: LIST
2017-08-07 13:57:02 2372 1 Response: 150 Opening ASCII data connection for ls /.
From R:
get url_data_grouped transactions
library(RCurl)
Loading required package: bitops
url2<-c("ftp://"user"#IP address")
filenames<-getURL(url2, userpwd="user:pwd", ftp.use.epsv = FALSE, verbose=TRUE, dirlistonly = TRUE)
* Trying "IP"...
* Connected to "IP" ("IP") port 21 (#0)
< 220-This server is for private use only
< 220-If you do not have access to this server
< 220-Please disconnect now
< 220 Please enter your login name now.
> USER "user"
< 331 Password required for user
> PASS "Password"
< 230 User user logged in.
> PWD
< 257 "/" is current directory
* Entry path is '/'
> CWD PMA
* ftp_perform ends with SECONDARY: 0
< 250 "/PMA" is current directory.
> PASV
* Connect data stream passively
< 500 PASV command is disabled. Use PORT command.
* Bad PASV/EPSV response: 500
* Remembering we are in dir "PMA/"
* Connection #0 to host "IP" left intact
Error in function (type, msg, asError = TRUE) :
Bad PASV/EPSV response: 500
Has anyone got good inputs for this issue?

Related

Windows Rstudio 4.1.2 and neo4r_0.1.1 connection problem

Probably my fault but I have Neo4j desktop open and running with an active project in the viewer. This shows as localhost:7687 Create a neo4r con object with correct password as
con <- neo4j_api$new(
url = "http://localhost:7687",
user = "neo4j",
password = "xxxx"
)
and then
con$ping()
[1] 200
con$get_relationships()
A tibble: 1 x 1
labels
1 list(oidc_providers = list())
con$get_version()
NULL
So the 200 says good boy but the con functions say no. I used powershell as
Test-NetConnection localhost -port 7687
WARNING: TCP connect to (::1 : 7687) failed
ComputerName : localhost
RemoteAddress : 127.0.0.1
RemotePort : 7687
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : 127.0.0.1
TcpTestSucceeded : True
which I think means the port does exist. I would greatly appreciate advice to let me continue with neo4r.
Withdrawn. Similar questions can be found under neo4j tag.

Phabricator not sending outbound emails

I have set up my outbound emails on phabricator by following this guide.
However, my emails don't arrive. All the emails are queued. When I went to the daemons in Phabricator UI, I see that several tasks are failing. They all look like this.
Task 448: PhabricatorMetaMTAWorker
Task 448
Task StatusQueuedTask ClassPhabricatorMetaMTAWorkerLease StatusLeasedLease Owner13195:1624502950:mail.icicbcoin.com:11Lease Expires1 h, 59 mDurationNot Completed
Data phabricator/ $ ./bin/mail show-outbound --id 154
Retries
Failure Count5Maximum Retries250Retries After1 m, 2 m, 4 m, 6 m, 8 m, 11 m, 14 m, 17 m, 20 m, 23 m, 27 m, ...
I'm curious of this data part. To me it sounds like phabricator fails running this command which is weir because if I run ./bin/mail show-outbound --id 154 manually I get this:
ID: 154
Status: queued
Related PHID:
Message: fputs(): send of 28 bytes failed with errno=32 Broken pipe
PARAMETERS
sensitive: 1
mustEncrypt:
subject: [Phabricator] Welcome to Phabricator
to: ["PHID-USER-qezqlvc7rxton2lshjue"]
force: 1
HEADERS
TEXT BODY
Welcome to Phabricator!
admin (John Doe) has created an account for you.
Username: some.person
To log in to Phabricator, follow this link and set a password:
http://phabricator.innolabsolutions.rs/login/once/welcome/9/b2jf7j6mg5xomwjhmcfcxbigs7474jyq/10/
After you have set a password, you can log in to Phabricator in the future by going here:
http://phabricator.innolabsolutions.rs/
Love,
Phabricator
HTML BODY
(This message has no HTML body.)
Actually, the problem was the SMTP server configuration, even though this error didn't tell me that. I changed the SMTP port from 465 to 587, restarted the daemons and it worked.
I had the same problem twice.
The second time, it was because I could not resolve the smtp server name:
$ ping gandi.net
ping: gandi.net: Temporary failure in name resolution
Then I added a dns server in /etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8 # <--- added
search home
and restarted the service
sudo service systemd-resolved restart
Right after, Phabricator automatically sent all the queued emails.

C64 + DigiConnect SP messages sending as 1 char connections instead of full strings using BASIC

Using a Commodore 64 with a GLINK LT RS-232 adapter connected to a Digi-Connect SP configured to send RAW TCP to a static IP/port on my home network. Destination is a socat process passing traffic elsewhere with verbose logging.
Testing hitting socat from a bash shell on an OS X machine, issuing curl http://192.168.1.91:1234 I get a valid response and the socat log shows
> 2018/12/29 22:06:50.168550 length=81 from=0 to=80
GET / HTTP/1.1\r
Host: 192.168.1.91:1234\r
User-Agent: curl/7.54.0\r
Accept: */*\r
\r
< 2018/12/29 22:06:50.169509 length=144 from=0 to=143
(followed by http response)
But when I run the following on the C64 BASIC code SNIPPET:
100 OPEN 2,2,3,CHR$(6)+CHR$(0)
110 GET#2,A$: REM TOSS NULL TO OPEN RCVR CHANNEL
120 PRINT#2,"GET /"
...
the socat log shows:
> 2018/12/29 22:11:38.952005 length=1 from=167 to=167
G> 2018/12/29 22:11:38.983674 length=1 from=168 to=168
E> 2018/12/29 22:11:39.015464 length=1 from=169 to=169
T> 2018/12/29 22:11:39.051758 length=1 from=170 to=170
> 2018/12/29 22:11:39.084476 length=1 from=171 to=171
/> 2018/12/29 22:11:39.117131 length=1 from=172 to=172
I'm not sure if I'm doing something wrong on the C64 side to cause the individual char's to be sent or if it's an incorrect Digi-Connect setting.
Digi serial settings are:
TCP Client Settings:
Automatically establish TCP connections
Always connect and maintain connection
Establish connection to the following network service:
Server: 192.168.1.91
Service: Raw TCP
TCP Port: 1234
Enable TCP Keep-Alive: On
Basic Serial Settings
Baud: 300
Data bits: 8
Parity: None
Stop Bits: 0
Flow Control: Hardware
Advanced Serial Settings
(nothing configured here)
The individual characters was a red herring, the fix is simply to add a LF (ASCII 10) to the end of the message so the downstream web service understands that the message is finished.
Working example:
100 OPEN 2,2,3,CHR$(6)+CHR$(0)
110 PRINT#2,"GET /"
120 PRINT#2,CHR$(10)
(also of note - anything requiring correct upper/lower case will need PETSCII <-> ASCII conversions)

R: Connect to SFTP with RCurl

I'm trying to connect to a SFTP server. It is an encrypted server that uses FIPS mode. I am able to connect and perform file transfer through WinSCP, FileZilla, and through bash sftp commands with no problems.
But, I cannot, access this same SFTP from R using RCurl (R version=3.3.2, RCurl version=1.95-4.10, windows 10). This is what my code looks like and the error message that is being produced:
RCurl::ftpUpload(what="path/to/my/local/file.ext",
to = "sftp://my.eftp.server:portNumber/path/to/my/file.ext",
userpwd = "user:password",
.opts=curlOptions(verbose=TRUE))
The error message is:
* Trying ###.###.###.##...
* Connected to my.eftp.server (###.###.###.##) port ## (#0)
* Failure establishing ssh session
* Closing connection 0
Error in function (type, msg, asError = TRUE) :
Failure establishing ssh session
Any help would be wonderful. I've referenced the following with no luck:
sftp with R - sftp not a protocol with RCurl,
Using RCurl with SFTP
and the RCurl documentation (and other links).
I've also tried:
RCurl::ftpUpload(what="path/to/my/local/file.ext",
to = "sftp://user:password#my.eftp.server:portNumber/path/to/my/file.ext",
.opts=curlOptions(verbose=TRUE))
Also, I've checked my curlVersion()$protocols and scp and sftp protocols are listed (with the others).

RCurl SSH public key authentication failed: Callback returned error

I need to get config file from the Linux server that is authenticated using ssh keys. I am stuck with "Callback returned error" message.
conf = scp(host="10.10.10.10", path="/home/admin/codebase/config.txt",
user="admin", keypasswd = "", verbose=TRUE,
key=c("C:/echinn/.ssh/my_public_key", "C:/echinn/.ssh/my_private_key"))
I get the following output
* Trying 10.10.10.10...
* Connected to 10.10.10.10 (10.10.10.10) port 22 (#0)
* SSH MD5 fingerprint: 8fa4562037d2f1e68c7ff419f9dc7656
* SSH authentication methods available: publickey,gssapi-keyex,gssapi-with-mic
* Using SSH public key file 'C:/echinn/.ssh/my_public_key'
* Using SSH private key file 'C:/echinn/.ssh/my_private_key'
* SSH public key authentication failed: Callback returned error
* Failure connecting to agent
* Authentication failure
* Closing connection 0
Error in function (type, msg, asError = TRUE) : Authentication failure
I also tried with "getURL()" but ended up with the same error. I am able to successfully connect using putty and WinSCP with (.ppk format of) the same public/private keys.
On the Linux server /var/log/secure I see the following for every execution
sshd[xxxx]: Connection closed by x.x.x.x [preauth]
From the R Documentation for the scp function, it looks like your key does not have a passphrase, so try setting keypasswd = NA or removing the argument altogether.

Resources