Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

WHM API with asp classic

Discussion in 'General Discussion' started by Matheus Fernandes, May 11, 2018.

  1. Matheus Fernandes

    Matheus Fernandes Registered

    Joined:
    May 11, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    brazil
    cPanel Access Level:
    Root Administrator
    WHM version: 70
    OS: CLOUDLINUX 6.9

    Client API Server OS: Windows 2008 R2 Standard
    Client API Language: asp classic/vbscript

    I have the asp code below to communicate with whm api but it's not working.

    <%
    user = "root"
    token = "****"
    url = "https://whmurl:2087/json-api/createacct"
    query = "api.version=1&username=matheus&domain=mathexample.com&plan=teste&quota=0&password=*****&ip=n&cgi=1&contactemail=matheus%40domain.com.br&mxcheck=local&owner=root&language=pt_br"​

    Set http = Server.CreateObject("WinHttp.WinHttpRequest.5.1")

    With http
    Call .Open("GET", url, False)
    Call .SetRequestHeader("Content-Type", "text/plain; charset='utf-8'")
    Call .SetRequestHeader("Authorization", "whm "&user&":"&token)
    Call .Send(data)
    End With

    If Left(http.Status, 1) = 2 Then
    'Request succeeded with a HTTP 2xx response, do something...
    Else
    'Output error
    Call Response.Write("Server returned: " & http.Status & " " & http.StatusText)
    End If
    I always get this error:

    WinHttp.WinHttpRequest error '80072f8f'
    A security error occurred
    **.asp, line 13 (in bold)

    I debuged and I get:
    * About to connect() to whmurl port 2087 (#0)
    * Trying [ip]...
    * connected
    * Connected to whmurl ([ip]) port 2087 (#0)
    * error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
    * Closing connection #0

    Any clue? Is it related to TLS or SSL versions?
     
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,748
    Likes Received:
    187
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hello,


    I believe this is directly related to SSL/TLS protocols. It appears you're attempting to connect to the server over SSLv2 or SSLv3 when SSLvX support has been removed in favor of TLSv1.2

    In order to connect you'll need to do so over TLSv1.2 or use the less favorable option and enable support for SSLvX on the server. Because of vulnerabilities such as POODLE and DROWN we strongly urge you not to take this route.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Matheus Fernandes

    Matheus Fernandes Registered

    Joined:
    May 11, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    brazil
    cPanel Access Level:
    Root Administrator
    Yeah, maybe thats the issue. I'll try to force tls 1.2.. windows 2008 does not have it active by default ¬¬
    I'll come back later with the feedback
     
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,748
    Likes Received:
    187
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Matheus Fernandes

    You're right it doesn't and it's definitely an issue for more reasons than this application. Let us know if forcing TLSv1.2 resolves the issue.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice