cPanel stopped responding to curl requests - bash

I'm on a VPS and use a bash script to deploy websites to subdirectories inside on of my accounts. I've been using this script with no issues until today, randomly, cPanel decided to ignore curl.
In this script I automatically create a database and add a user to it, which is accomplished via curling cPanel with the appropriate information.
Here's what I was doing and previously was working flawlessly.
curl -k -v -G -d db=$db_name https://$cpanel_user:$cpanel_password#$cpanel_host:2083/frontend/x3/sql/addb.html
I isolated this line to a separate script to debug. Here's the kicker, the server simply doesn't respond. Curl just says Trying X.X.X.X... and then eventually the connection times out. Curl works for everything else so I know that's not it. Just for grins I tried wget and it can't establish a connection either.
I have [had] security tokens disabled in cPanel.
My question is what would cause the connection to fail? I'm stumped as this worked yesterday.
I don't mind investigating and debugging, but with no errors or anything I simply don't know where to look. I talked to my host and they said there hasn't been any firewall/security updates rolled out.
Suggestions on issues or where to look?
Edit: So if I run that curl command locally in OSX it fires up and creates the DB no problem. So for some reason the URL isn't responding to my own server (itself) o.O
Edit 2: It seems my server can't curl itself on that port I need (dunno why it would have stopped). For example if I curl my server IP or a domain on my server (from the server) it works. If I try to curl my ip:2083 it won't resolve.
How can I allow curl to work with port 2083?

My firewall CSF just allow incomming TCP connexion on port 2083 to the server. But the other one blocked the outgoing tcp connexion on port 2083.
So opening both port IN-OUT on both server solved the issue.

Related

`ddev get --list` doesn't work (lookup api.github.com: i/o timeout)

I need to add Solr to a DDEV project but am encountering errors when attempting to gather information about available services.
I'm following guidance here:
https://ddev.readthedocs.io/en/stable/users/extend/additional-services/
When I attempt to list all available services: ddev get --list, I receive this response after approx 30 seconds:
Failed to list available add-ons: Unable to get list of available services: Get "https://api.github.com/search/repositories?q=topic:ddev-get+fork:true+org:drud": dial tcp: lookup api.github.com: i/o timeout
I'm not sure what the problem is. If I curl the URL from the error message, ie curl https://api.github.com/search/repositories?q=topic:ddev-get+fork:true+org:drud, I receive a JSON response from Github with information about the repository.
This has happened for over two days now. I may be overlooking something but am not sure what, exactly. I'm able to run DDEV projects using the standard installation (mariadb, nginx, nodejs, mailhog) but continue to run into errors re listing add-ons.
I have ddev v.1.21.4 installed.
I'm using an M1 Mac on macOS 13.1.
Thank you.
Your system is unable to do a DNS lookup of the hostname api.github.com, and this is happening on your macOS host. Are you able to ping api.github.com? Have you tried rebooting?
You may want to temporarily disable firewall, VPN, virus checker to see if that changes things. But you'll want to be able to get to where you can ping api.github.com.
There is an obscure golang problem on macOS affecting situations where people have more than one DNS server, so that could be it if you're in that category. You also might want to consider changing the DNS server for your system to 1.1.1.1, as this can sometimes be a problem with your local DNS server (but of course the fact that you can curl the URL argues against that).

Localhost refused to connect on WSL2 when accessed via https://localhost:8000/ but works when using internal WSL IP adress

What I'm Trying to Achieve
To access localhost from my local machine during the development of a Symfony web app.
My Environment
WSL2 running on Windows 10
Linux, Apache2, MySQL, PHP-7.4 stack (with Xdebug3 intalled)
Debian 10
Symfony 5.4 (although not sure on if relevant to this problem)
Steps I've Taken
Set up WSL2 according to this Microsoft WSL2 tutorial
Set up LAMP stack according to this Digital Ocean tutorial
Set up Symfony according to this Symfony tutorial
Run the following bash script on startup to start my services and set the host to the virtual WSL IP in my xdebug.ini file
#!/bin/sh
REMOTEIP=`cat /etc/resolv.conf | grep nameserver | sed 's/nameserver\s//'`
sed -i -E "s/client_host=[0-9\.]+/client_host=$REMOTEIP/g" /etc/php/7.4/mods-available/xdebug.ini
service php7.4-fpm start
service apache2 start
service mysql start
Run my Symfony project on the development server using symfony serve -d (Symfony then tells me "The Web server is using PHP FPM 7.4.23 https://127.0.0.1:8000")
Go to https://localhost:8000/ in Chrome where the app is running
What I Expect to Happen
My Symfony web app to be running on https://localhost:8000/ when I visit the URL in my Chrome browser
What Actually Happens
I get "This site can't be reached localhost refused to connect." in the Chrome browser
What I've Tried
This used to happen less frequently and I would give my laptop a restart, repeat the process above, and I could connect via https://localhost:8000/. However, it refuses to connect more regularly now (like 8/10 times I start up for the day)
Connecting to https://127.0.0.1:8000 yields the same result.
Connecting to the site using the internal WSL IP address, found using hostname -I and replacing localhost with this IP (still on port 8000). This is an adequate workaround to use my app, however I am unable to interact with my database via MySQL Workbench without having to set up a new connection, therefore a fix where I can use localhost would be very helpful!
(Based off comments) Only ran symfony serve -d without starting apache and PHP services separately - still sometimes allows connections to localhost but sometimes doesn't work.
Conclusion
The behaviour is odd as it works sometimes but other times it doesn't when the exact same steps are carried out. I am unsure where else to look for answers and I can't seem to find anything online with this same problem. Please let me know if any config files, etc would be helpful. Thank you so much for your help! :)
When it's working normally, as you are clearly aware, the "localhost forwarding" feature of WSL2 means that you can access services running inside WSL2 using the "localhost" address of the Windows host.
Sometimes, however, that feature breaks down. This is known to happen when you either:
Hibernate
Have the Windows "Fast Startup" feature enabled (and it is the default). Fast Startup is a pseudo-hibernation which triggers the same problem.
Typically the best solution is to disable Hibernation and Fast Startup. However, if you do need these features, you can reset the WSL localhost feature by:
Exiting any WSL instances
Issuing wsl --shutdown
Restarting your instance
It's my experience that localhost forwarding will work after that. However, if it doesn't, thanks to #lwohlhart in the comments for mentioning that another thing to try is disabling IPv6 on WSL2, since (I believe) there's a possibility that the application is listening on IPv6 while the Windows->WSL2 connection localhost connection is being attempted on IPv6.
You can disable IPv6 on WSL2 per this Github comment by creating or editing .wslconfig in your Windows user profile directory with the following:
[wsl2]
kernelCommandLine=ipv6.disable=1
A wsl --shutdown and restart will be necessary to complete the changes.
If you find that this works, it may be possible to solve the issue by making sure to either use the IPv4 (127.0.0.1) or IPv6 (::1) address specifically in place of localhost on the Windows side, or by configuring the service to listen on both addresses.
Try to run command netstat -nltp. It shows active addresses and ports. Your nginx process should be run at 0.0.0.0:8000. 0.0.0.0 means the nginx process is available from anywhere.
If your nginx process is ran by any specific ip address, you should access it by that ip address, e.g http://192.168.4.2:8000.

How can I make sshuttle working on a dedicated IP of other VPN service?

This is the first time I use the sshuttle.
I am running into an issue working with sshuttle.
I run the sshuttle to connect my local with a remote server on my local machine.
I can access the server by using ssh and pem file.
I used the following command on my MacOS.
sshuttle --dns -vr dev 10.0.0.0/0 --ssh-cmd 'ssh -i ~/.ssh/dev.pem'
I have set ssh config to use the dev hostname in .ssh/config file
host dev
HostName xx.xxx.xx.xx
user root
IdentityFile ~/.ssh/dev
But I couldn't connect my local to the remote server, even all the internet traffic keeps loading and never loads anything.
I am using a dedicated IP on VPN service (PureVPN). Wihtout VPN, sshuttle is working well so meaning that running sshuttle on top of other VPN service is a problem?
I don't think it's a problem since it's a dedicated IP. And if it's a problem, how can I address this issue since I must use the dedicated IP for an another service.
If you have faced the same issue before, please let me know.
Thank you in advance!
From the looks of what you mentioned there could be two things that can be the cause. One, the credentials that are given to you by the third party hosting are incorrect. But since you mentioned that you are able to access the sshuttle without a VPN, this clearly indicates that you need to get your dedicated IP approved from the hosting service if it's not marked spam. If you are looking for a dedicated IP VPN service provider try Ivacy.

Bypass IP restriction SSH

I have a Laravel app with CI/CD setup at BuddyWorks which lets you create deployment pipelines.
I want to use SSH action to run some config scripts (artisan...) after uploading the source code.
Unfortunately, it turned out that SSH connectivity to the hosting server is restricted to my home country, ergo can’t use BuddyWorks to do the job for me. The hosting company refused my request to whitelist BuddyWorks IP’s.
So here am, looking for a solution to bypass restriction.
Currently, I’m investigating SSH reverse for , but not sure I’m on good path.
Any help would be appreciated!
I ended up writing a small http->ssh proxy server with basic authentication which receives commands from pipeline via post requests and connects to the host server via ssh, executes the commands and logs to slack.

Accessing webmin through browser port :10000

Recently set up a Debian 9.1 x64 server with SSH and LAMP stack (PHP ver7.0). PHP and Apache are both installed correctly since I get their landing pages. UFW is also active.
I have now installed webmin(using apt-get) and also tried following the instructions from http://www.webmin.com/deb.html on a different occasion. I "sucessfully" completed the installation(s) via terminal and it directed me to goto https://MY_Domain:10000 and to log in with root.
After multiple attempts, even tried using https://MY_IP_ADDRESS:10000 I am greeted with "Safari cannot open MY_IPADDRESS because it cant connect to the server".
I have tried the following to solve my problem:
-Reinstalling webmin,
-Restarting webmin,
-Stopping my UFW firewall,
-Allowing ports 10000 ,HTTPS port (443 I think), port 22, port22 v6
-Opening webmin config and changing the port/listen line to listen to another port such as 44321,
-Opening error logs. The only "error" that appeared was something about not being able to do something with IPv6,
-Using different browsers,
I have read many forum posts of users having similar problems but none of the solutions have been effective. I have heard of IPtables but for some reason I cannot implement that solution. Im very new to server configuration therefore I'd appreciate the help.
Similar post: Unable to access Webmin through browser
Ok so I finally fixed it. To fix this, log in as root then nano to
sudo nano /etc/webmin/miniserv.conf
Turn off SSL by setting it to 0.
The restart webmin and try to connect.
Im about to research into whether this is a safe practice.
I get the same problem only after system restart. All works fine, firewall configured for webmin port and all, also tried with fireall disabled, after system restart all goes down the drain, webmin service is ufo and after uninstall and reinstall webmin the story replays. I am at my wits end. Good bye opensuse!

Resources