Programatically Update FTP account quota in cPanel? - php

I am trying to update the quota of a cPanel FTP account through php.
https://username:password#mydomain.com:2083/frontend/x3/ftp/doeditquota.html?acct=mailid#mydomain.com&quota=50
I am making a HTTP Request with the above URL.
And I getting response message
The FTP account maildid#mydomain.com was successfully modified with a new quota of 50 Megabytes. 0Failed to determine FTP maildid#mydomain.com directory.
But in server quota is not updated . Actually whats issue?
And why this message :
0Failed to determine FTP maildid#mydomain.com directory.

Finally I got the solution.
https://username:password#mydomain.com:2083/frontend/x3/ftp/doeditquota.html?acct=mailid&quota=50
remove domain from the 'acct' parameter.

Related

How to ignore woocommerce_product_image_upload_error over REST API

I need to re-create a shop and need to do this parallel to the current online shop. I create a new server but didnt point the dns record for the domain to the new server. I create a entry in my and the server hosts file pointing to the new servers ip address.
I also configured the ssl connection with a selfsigned certificate.
Now I want to upload the products over the WooCommerce API but get an error:
{
"code": "woocommerce_product_image_upload_error",
"message": "Error retrieving the external image https://example.com/wp-content/uploads/2023/02/product_76548_1.jpg. Fehler: cURL error 35: error:0200100D:system library:fopen:Permission denied",
"data": {
"status": 400
}
}
I already changed the php configuration and add
curl.cainfo="/tmp/CA.pem"
openssl.cafile="/tmp/CA.pem"
All images are uploaded to the server and I can open the link and get the image. I also can open the link over the cli on the server with curl and get a 200 response.
I need to ignore this error and configure the products with the images.
Is that possible or do I need to take down the shop and do the stuff?

How to run php file along with maldet

I am running cpanel server with maldetect to keep server clean. When maldetect found malicious file , that account get suspended automatically.
What I want to do is , send email to user and inform him that your account is suspended. Is there any I can do that with with maldetect ?

APNS + PHP "stream_socket_client(): Failed to enable crypto"

I'm having trouble with using APNS with PHP and getting the following message:
stream_socket_client(): Failed to enable crypto
The problem only happens sometimes, and other times it would actually send the push.
Since I have the test script on a loop of 10 iterations, I would sometimes get this:
stream_socket_client(): SSL: Connection reset by peer
I'm testing using the sandbox server tls://gateway.sandbox.push.apple.com:2195
Here is what I tried:
I tried to reissue the PEM and all certificates with it.
I played around with the request protocol sslv3:// and tls://.
I played around with the passphrase (push worked without the passphrase btw)
I tried searching stackoverflow for a solution and nothing worked.
Checked pem file permissions 644
Checked pem parent directories permissions 755
It seems that all the solutions I found on Google and SO are people having problem pushing altogether.
I feel like the service is rate limited maybe? Because we waited a while (around 15 minutes) and then tried it again, and was able to successfully push around 100 messages until I started getting that message again.
The sandbox push service is rate limited. I have experienced this myself when testing but have never encountered any such limit using the production API.
You might also be hitting their other protections.
Are you opening a connection, sending a message, closing connection and then looping and doing it all over again?
That will get your notifications dropped. Apple wants you to send several push notifications using the same connection, not a new one each time.
Best Practices for Managing Connections
You may establish multiple connections to the same gateway or to
multiple gateway instances. If you need to send a large number of
remote notifications, spread them out over connections to several
different gateways. This improves performance compared to using a
single connection: it lets you send the remote notifications faster,
and it lets APNs deliver them faster.
Keep your connections with APNs open across multiple notifications;
don’t repeatedly open and close connections. APNs treats rapid
connection and disconnection as a denial-of-service attack. You should
leave a connection open unless you know it will be idle for an
extended period of time—for example, if you only send notifications to
your users once a day it is ok to use a new connection each day.
From Apple Docs # https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html
My PHP code was generating following error:
PHP Warning: stream_socket_client(): Failed to enable crypto in /private/tmp/t.php on line 12
PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /private/tmp/t.php on line 12
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /private/tmp/t.php on line 24
The problem was, the damn certificate, expired the day before yesterday! :-) Can you believe this?
So, I need to recreate my PEM file.
It is not necessary recreate your pem file
that error happens when you use an incorrect PassPhrase
regards
Emiliano
I had this problem. Disappeared after giving write permission for 'everyone' for the .pem file.
I have this problem because I foolishly forgot to include the file extension (.pem) when supplying the file path for local_cert.
few checks :
device token should be - with out spaces and with out < or >
make sure the path of certificate is correct and expired date of it.
make sure the passphrase you are using is the one u used to make certificate
In my case, the issue was with my mac (OSX Sierra). I uploaded php and cert to my server, ran it, and the notification was delivered.
I tried examples from book of Marin Todorov iOs 6 by Tutorials.
And before I could send push notifications for automatical update I had a lot of headache cause of handshake error - stream_socket_client(): Failed to enable crypto.
I did all of what I found in Stackoverflow - changed permissions on certificate and others.
What I did eventually?
I created selfsigned SSL certificate and setup Apache for serving SSL.
Also I changed SSL protocol from ssl to tls in hostname:
tls://gateway.push.apple.com:2195
After that service works.

updating files through ftp on a provisioned/testing IP

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.

Openfire add user using URL

I am trying create users on openfire using a url link but for some reason I'm getting an error.
I've installed the plugins and opened the right port, but I'm getting
RequestNotAuthorised errors.
This is the link I am referring to:
http://www.nkstream.com:9090/plugins/userService/userservice?type=add&secret=bigsecret&username=kafka&password=drowssap&name=franz&email=franz#kafka.com
Go into the Server > Server Settings > User Service and enable the user service. You will also find the secret key there. You will need to replace the "bigscret" in the URL with the secret key found in the area I just specified.
You can use "User Service" plugin: you can find it in the section plugin on your Openfire server.
Once installed:
Server -> Server Settings -> User Service
enable 'user service request' and note 'secret key'.
To create new user you can use PHP directly or using php wrapper for the plugin.
If you want you can use directly cURL from command line, it could be usefull for someone:
URL="http://<your_server>:<your_port>/plugins/userService/userservice"
PARAMETERS="secret=<yourSecretKey>&type=add&username=<user>&password=<psw>&name=<name>&email=<mail>"
curl ${URL}?${PARAMETERS}
If everithing works, you should receive:
<result>ok</result>
You receive
<error>RequestNotAuthorised</error>
because secret must be the FIRST parameter.
I've never used openfire so this is a stab in the dark. Based on the README, RequestNotAuthorised is returned if:
the secret does not match
the requester IP is invalid
Have you set the secret key (bigsecret) in the User Service page in the Openfire admin console?
Is there a setting for allowed IPs where you can specify your IP?

Categories