Plesk admin panel C/C++ API examples - c++

I checked allover the internet to find any examples of ANSI C or C++ Plesk RPC API and I can find none. Any ideas? I just need to write a program that connects to my Plesk panel and enable/disable domain. Thanks!

XML-RPC don't dependence on language.
You need create valid xml and send to server (plesk https server 8443 port) recive her, and parse it. For example, you can to use opensource libs: libxml and curl.
Documentation XML-RPC http://download1.parallels.com/Plesk/PP11/11.0/Doc/en-US/online/plesk-api-rpc/
Also doc have C# example:
http://download1.parallels.com/Plesk/PP11/11.0/Doc/en-US/online/plesk-api-rpc/33182.htm

Related

API allowing to import a CSR to Microsoft CA and receive a certificate

I need to find a way to import/submit SCR and receive a certificate from Microsoft CA via some endpoint from my server. The best option is REST, but if there is another API/protocol allowing to do a request from our server to the CA will be good enough.
Terminal utils will not work for me.
I found that there are a few options here:
Usage of .Net platform allowing to send/import CSR
CA Web Enrollment
CA Web Services
Our server is an on-prem solution and written on Java and may run on Windows and Unix-based platforms. It means that our customer decides what OS to use.
It means that the first option is not really an option...
The second option allows uploading an SCR to Microsoft CA via a browser, i.e. I can try to submit an HTML form and parse a response...extract the link for the cert, but it feels it is not the best option.
I found that the windows server contains the component called CA Web Services that theoretically allowing what I want, but the problem I can't find how to use it.
I followed the guidance here:
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/hh831625(v=ws.11)
and Certificate Enrollment Policy Web Service and Certificate Enrollment Web Service are enabled on the server.
So I have the URL and I can put it in a browser or postman:
https://.../service.svc/CES
with basic authentication but for my try I received a bad request and I couldn't find the documentation about the endpoint.
So it will be nice if someone could say to me that I'm looking in the right direction and/or send me a link to the documentation.
And if it's not the right direction, maybe someone knows a better option.
Thanks in advance

embedded http server in c++ for chrome extension native client

i was trying to find some examples that would give me some pointers on how to create an http server within a chrome extension, but haven't had any luck. does anyone know a how to start an NPAPI,NACL http server?
Thanks
Short answer: not possible.
If you want to open a port on a local machine to allow connections, then that is not allowed by the web security model. NaCl runs with the same privileges as JavaScript, no extra holes. However, you may specify extra flags to chrome on start to get more permissions from NaCl, such as open debug port, or get access to raw network sockets.
If you want to 'emulate' an HTTP server to make your extension keep using it regardless of being offline, then it is easier to use the PostMessage API.

c++ how to listen HTTP requests

Im new in C++.
I need to listen HTTP requests.
Please advice me some good tutorials or examples
Thanks
update:
Platform: Windows
Language: C++
I will explain more clearly what i need
when user clicks row on this page: http://ucp-anticheat.org/monitor.html applications is automatically starts on client machine.
I want to make same thing.
I think on client side is service which listens http requests and if url starts with steam:// service automatically runs application...
Do i need to listen http requests?
What is best solution for my problem?
You can listen to http requests through a web server like mongoose , which can be easily used in C++ http://code.google.com/p/mongoose/ , and here is a good example of using mongoose web server http://code.google.com/p/mongoose/source/browse/examples/hello.c
I m not sure what you mean 'client side', if you are meaning Browser as your client, you can't control nothing outside your browser. If you want to control a machine, you need your client machine to run your exe, that has the code to act based on your server instructions.
You should create a simple server program, create a SOCKET listening on default http, https etc, ports. Usually we do it inside a loop (at each one you make a read).
Now... would be easer if you specified if you are on Unix like OS or Windows, but from now on you can google it. Like sys/socket.h or try "man 7 socket" on almost all linux (at least the ones I know).
If you want to sniff something you can google some specific apps around web.
If i get your question right, you want to be able to launch an application when someone clicks a link with a custom protocol, like steam:// or telnet://. You are looking for an Protocol Handler.
A simple way to register such an application is using the ftype program, as described here.

How to avoid QNetworkRequest to send the RHELP verb to the FTP Server?

The Scenario:
I'm implementing an FTP get functionality in my application, that uses Qt 4.7.x
Qt documentation states that the QFtp class is deprecated, to use QNetworkAccessManager instead, and so I'm doing ;) I tested the code I wrote with some FTP server out there and it seems to work fine.
The Problem:
When I connect to my local, homebrewed (and quite simple), ftp server using my ftp get class I get the following error: Request: 500 No Help Available.
I traced the ftp communication using tcpdump and actually I see that the QNetworkAccessManager/QNetworkRequest sends an HELP verb to the server, once it gets the 230 User Logged In
Unfortunately my server do not support that. Now is there a way to configure the Qt not to send the HELP verb? Reading the Qt Doc online for the involved classes did not helped.
There is probably no way to avoid this, unless you want to reimplement the FTP backend. By browsing the source code for the FTP backend, you can find out that the purpose for sending the HELP command is to find out if the server supports the "SIZE" and "MDTM" commands.
Probably the easiest solution would be to implement a minimal handler for HELP commands in your FTP server that responds with an appropriate 200/211/214 response.
EDIT: See http://qt.gitorious.org/qt/qt/blobs/4.8/src/network/access/qnetworkaccessftpbackend.cpp#line350 for what the backend expects from the response. It's not complicated.
It is not configurable.
You can see the source code of what's happening here: http://qt.gitorious.org/qt/qt/blobs/4.7/src/network/access/qnetworkaccessftpbackend.cpp#line300
If you can build your own version of Qt, then it can easily be suppressed. But it might be easier for you to upgrade your FTP server to support the HELP command.

Secure data transfer over http with custom server

I am pretty new to security aspect of application. I have a C++ window service (server) that listens to a particular port for http requests. The http requests can be made via ajax or C# client. Due to some scope change now we have to secure this communication between the clients and custom server written in C++.
Therefore i am looking for options to secure this communication. Can someone help me out with the possible approaches i can take to achieve this.
Thanks
Dpak
Given that you have an existing HTTP server (non-IIS) and you want to implement HTTPS (which is easy to screw up and hard to get right), you have a couple of options:
Rewrite your server as a COM object, and then put together an IIS webservice that calls your COM object to implement the webservice. With this done, you can then configure IIS to provide your webservice via HTTP and HTTPS.
Install a proxy server (Internet Security and Acceleration Server or Apache with mod_proxy) on the same host as your existing server and setup the proxy server to listen via HTTPS and then reverse proxy the requests to your service.
The second option requires little to no changes to your application; the first option is the better long-term architectural move.
Use HTTPS.
A good toolkit for securing your communication channel is OpenSSL.
That said, even with a toolkit, there are plenty of ways to make mistakes when implementing your security layer that can leave your data open to attack. You should consider using an existing https server and having it forward the requests to your server on the loopback channel.
It's reasonably easy to do this using either OpenSSL or Microsoft's SChannel SSPI interface.
How complex it is for you depends on how you've structured your server. If it's a traditional style BSD sockets 'select' type server then it should be fairly straight forward to take the examples from either OpenSSL or SChannel and get something working pretty quickly.
If you're using a more complex server design (async sockets, IOCP, etc) then it's a bit more work as the examples don't tend to show these things. I wrote an article for Windows Developer Magazine back in 2002 which is available here which shows how to use OpenSSL with async sockets and this code can be used to work with overlapped I/O and IOCP based servers if you need to.