updating files through ftp on a provisioned/testing IP - php

I am moving my files from one server to another. Our new hosting company has given us provisional IPs for each domain/sub-domain (which I have modified my hosts file with + dumped dns). Additionally, they have provided username/passwords for these "fake" IPs for ftp/ssh. Although, when I try to connect to these servers, via IP, I get connection errors, ranging from "host not found" to "username/password incorrect". I have tried though WinSCP, FileZilla, and Dreamweaver. Is there something that I am missing? I'm to 'thick' to ask my hosting company (call it ego) what's wrong.
Question: If I'm given a provisional IP/username/password for a domain, is there some other requirement in order to connect to a domain in order to modify files?

Well.. heres your options.
Firewalls in your company/house are blocking sftp (port 22)
They meant FTP not sftp
can you ping the IP (dependant on firewall too)
For the times you've had username/password rejections what were you using, as that at least made contact, or the error was misleading..

Answer: The company provisioning my IPs did not add my IP to their firewall, so I wasn't allowed access.

Related

Unknown SSL certificate showing up on ssllabs.com server test

I've recently ran a SSL test (ssllabs.com/ssltest) on our website: kimarineadventures.com.au
Two certificates showed up from different servers. (first one is ours) I'm looking for a solution on how to remove the other one. This is causing errors to some users (website loads unsecure).
Your domain was registered through crazydomains.com.au , and they manage your domain's DNS as well. The second IP address you see on the ssllabs.com report is one of theirs.
To solve the problem you'll need to log on to crazydomains.com.au, open the DNS settings and delete the AAAA record(s) with that IP address (2404:8280:a222:bbbb:bba1:78:ffff:ffff). Leave the A record(s) as they are, and don't touch anything else.
It may take a few minutes to take effect, but that should do it.

Cannot use CURLOPT_INTERFACE

There is a cPanel (CentOs) server, and an additional IP address has been added.
but users cannot use:
curl_setopt($ch, CURLOPT_INTERFACE, "eth0:cp1");
// OR
curl_setopt($ch, CURLOPT_INTERFACE, "IP_ADDRESS");
I turned off the firewall, tried adding by WHM and /etc/sysconfig/network-scripts/, reserving ips, adding A records to DNS Zone, and so on... but still it's not working.
After executing the cURL request, it just times out.
what kind of configuration are required before being able to use CURLOPT_INTERFACE?
In case some one else has this issue,
I re-installed the Server and did 4 things differently:
Did not enable CPHulk
Used a random (invalid) DNS when finishing cpanel installation (My domain has managed DNS pointing to the IP)
When creating the new host in cPanel I did not check "Use the nameservers specified at the Domain’s Registrar"
I added the IPs (using WHM) after creating the host this time
I'm still not sure which one was causing the previous weird issue.
Basically I did nothing. Install cPanel > Create Host (Create a New Account) > Add IP Addresses (using WHM) > Rebuild the IP Address Pool > Restart

Access to Rapla through Glype

There is a Rapla event planner running at my work. It is set to be accessible only from computers in our office, though (IP check?). I needed to have an access also from my home, but the administrator won't reconfigure Rapla. However, I have an sftp account at the server (which is the same as the one where Rapla is running - same IP addressess; this server is accessible from Internet at browser's port 80, since we have our homepage running there).
I figured out, that I can upload Glype proxy script to my acoount and run it like this from any IP address: www.mycompany-domain.com/myfolder/glype/index.php. It really works and redirects me to a lot of websites, while showing my company server's IP. However, when I try to connect to a 8051 port (Rapla's port) through Glype, I get the cURL error:
The requested resource could not be loaded. libcurl returned the
error: Failed to connect to /here goes the IP/: Permission denied
Later on, I found a script called Glypeahead, which, according to the author, should fix this issue. I wasn't able to find any info how to use it and being myself just an amateur programmer, I am stuck at this moment.
So, my question is the following: how can I connect, using Glype, to Rapla's port 8051? I am open to any non-Glype solution too :-).

Php not able to connect to MySQL workbench when using IP as host, but works fine when using localhost

This is the error I get when using php code
"mysql_connect($host,$user,$password)", where $host="IP_of_my_system" :
Warning: mysql_connect(): Host 'xxx' is not allowed to connect to this MySQL server in C:\xampp\htdocs\mysqltest\insert.php on line 4
But when using localhost instead of IP, it works fine.
Why is this behavior?
Its quite simple if you understand how Userid's work in MySQL.
Each userid has a location associated with it from where that userid is allowed to logon from. This can be from anywhere % but normally its an ip address or set of ip addresses.
So the userid you are using is probably setup to be allowed access from localhost and 127.0.0.1 and maybe ::1 all of which are ways of addressing the PC that the MySQL Server is running on.
These should suffice so use localhost or 127.0.0.1 or change the userid definition in MySQL to be allowed to acess from 192.168.0.99 or whatever you ip address is, but using one of the alias's for this PC should be all you need.
Using the alias's also helps when you move your code to another machine and/or MySQL server. I fyou use a specific IP it probably wont.
Please Mention the port no like 192.168.0.1:3306 ( by default mysql port ) in $hostname.
For server port no contact your server administratior
Two possible reasons for your problem:
1) Your firewall is blocking IP_of_my_system:3306
2) you haven't configured proper access in MySql.
For the item #1, check your system.
For the #2, in Workbench, enter as administrator of your database.
Then, click on "Users and Privileges". In this page, you must grant to your user (MySQL user, not Windows user!), the permissions to login from an address or a network. This permission is "per host" and "per schema". In the following image, you can see that the user "testmvc" may login form any host (%) and from localhost:
In the next image you can see the "Schema Privilege" tab:
where you can see that the user "testmvc", from any host (%) may access the "testmvc" schema with the specified privileges.
The combination of access and privileges grants your user to access the MySQL server and operate on it.
I had a similar problem and only worked solution is creating a new user with same specification as old user. Strange, but hope it helps someone else with the same problem.

"php_connect_nonb() failed: Operation now in progress (115)" happens intermittently

We send some files across to a third party with a PHP cron job via FTP.
However sometimes we get the following error:
ErrorException [ 2 ]: ftp_put(): php_connect_nonb() failed: Operation
now in progress (115) ~ MODPATH/fileop/classes/Drivers/Fileop/Ftp.php [ 37 ]
When I say "sometimes" I mean exactly that; most times it goes across fine but about 1 in 5 times we get that error. It's not to do with the files themselves, because they will go happily if we try again.
We've found similar issues online - relating to a bug in PHP with NAT devices or to do with firewall configuration but again the implication is that if this were the case it would never work.
So, why would this work some times and not others?
ftp_set_option($ftpconn, FTP_USEPASVADDRESS, false);
This line of code before setting passivity of the connection ftp_pasv($ftpconn, true);
Solved my problem
FTP(S) uses random ports to set up data connections; an intermittent success rate indicates that not all ports are allowed by a firewall on the client and/or server machines. The port range for incoming (PASV) data connections can be set in the FTP server.
This page has a nice summary:
The easy way is to simply allow FTP servers and clients unlimited
access through your firewall, but if you like to limit their access to
"known" ports, you have to understand the 4 different scenarios.
1) The FTP server should be allowed to accept TCP connections to port
21, and to make TCP connections from port 20 to any (remote ephemeral)
port.
2) The FTP server should be allowed to accept TCP connections to port
21, AND to accept TCP connections to any ephemeral port as well!
3) The FTP client should be allowed to make TCP connections to port
21, and to accept TCP connections from port 20 to any ephemeral port.
4) The FTP client should be allowed to make TCP connections to port
21, and to make TCP connections to any other (remote ephemeral) port
as well!
So, I'm writing this answer after doing some investigation on my FTP server and reading the link you provided elitehosts.com.
I'm using FileZilla FTP server, and there is a specific setting that I had to enter to make it work. Going into the server settings, there is an area titled "Passive mode settings". In that dialog, there is an area titled "IPv4 specific", and within that area there is a setting labeled "External Server IP Address for passive mode transfers:". It's a radio button selection set, and it was on "Default", but since the FTP server is NAT'ed, I changed that radio selection from "Default" to "Use the following IP:" and entered in the external-facing IP address of my gateway provided by my ISP.
After I set this up, it worked! Not terribly sure if your FTP server is NAT'ed, but I thought I would provide the answer on this thread because it seems related.
In addition to Cees answer, I am running vsftp on ec2 and had to comment out the listen_ipv6=YES, listen=YES then "service vsftpd restart".
Although documentation says it will listen on ipv4 as well it wasn't and this resolved the issue.
For me all I had to do was to remove the ftp_pasv( $ftpconn, true ); and everything worked perfectly. I'm not yet sure why but I am trying to find out and I will surely come back when I do get the reason behind it.
This should be a comment under jj_dev2 comment, but I cannot add one due to reputation. But maybe it will be helpful for someone, so I post it here.
We had the same issue as described in the original post. In our case it worked with many customers - except one.
The solution in jj_dev2 comment did work for us. So we investigated what does ftp_set_option($conn, FTP_USEPASVADDRESS, false) actually do. And based on that we found out that in fact customer's FTPS server was configured incorrectly.
In response to PASV command (ftp_pasv($conn, true)) FTP server returns an IP address which the PHP FTP client then will use for data transfers. In our case the FTP server was returning an internal IP address and not the public IP address that we connect to. Customer had to fix their FTP server settings so FTP server would send external IP address in the PASV command response.

Categories