Thursday, August 24, 2017

cpanel autossl not working

Logs :

WARN The domain “redacted” failed domain control validation: The system

queried for a temporary file at “
href="http://redacted/2ECBADE46934FE927D361915199E5FDC.txt">http://abc

cted/2ECBADE46934FE927D361915199E5FDC.txt
”, but the web server

responded with the following error: 404 (Not Found). A
title="Domain Name System">DNS
or web server misconfiguration

may exist.


Edit .htaccess with following code-


RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(txt|tmp)$

++++

Why is AutoSSL not working on cPanel?

One of the most common issues for cPanel users while activating AutoSSL is to find that the AutoSSL is not working at all, even if cPanel said it was finished.
There may be a few reasons on why your AutoSSL is not working, let’s explore each one of them:

1)  The domain failed domain control validation: The system queried for a temporary file at but the web server responded with the following error: 403 (Forbidden). A DNS or web server misconfiguration may exist. at bin/autossl_check.pl line 565.

This means AutoSSL verification script is not able to create a temporary file for the domain
To fix it, just try to assign 755 permissions and the correct owner to your public_html directory:
chmod 755 /home/user/public_html -v
chown user.user /home/user/public_html/ -R
Make sure you change user.user with your real cPanel user for that website.
And also check your .htaccess in case you have allow/deny directives that may be preventing the cPanel AutoSSL verification script to access your website.
That will do the trick and allow cPanel to write the temporary file.

2) The domain “mail.yourdomain.com” failed domain control validation: “mail.yourdomain.com” does not resolve to any IPv4 addresses on the internet. at bin/autossl_check.pl line 565.

There is a missing record for your mail.domain.com DNS record, just add a record to fix it.

3) Your domain doesn’t not resolve properly to the server.

As suggested by @tekgurl_kayla, make sure the domain resolves to the server & check redirects, too. Make sure you’re aware of the limits as well.

4) The certificate is not available. (processing)

You noticed this is ‘processing’, and in some cases that can take minutes (normal) or even hours, in this cases AutoSSL process is stuck and it continues to be unable to retrieve a valid AutoSSL certificate.
cPanel & WHM’s AutoSSL/SSL ordering process works on this way: cPanel system will automatically stop attempting to retrieve a certificate after 1 day (86400 secs), so if it hasn’t been completely issued within 24 hours, then it will be removed from the autossl queue.
When you find AutoSSL is not working, the first thing to do is to check the autossl logs, as you see in this image below:
Screenshot of AutoSSL Log Manager, the best tool to figure out why AutoSSL not working
Screenshot of AutoSSL Log Manager, the best tool to figure out why AutoSSL is not not working
Log for the AutoSSL run for “nixcp”: Saturday, February 11, 2017 4:25:39 AM GMT-3 (cPanel (powered by Comodo))[/B][/SIZE]
10:20:32 PM This system has AutoSSL set to use “cPanel (powered by Comodo)”.
10:20:32 PM Checking websites for “nixcp” …
10:20:32 PM The website “nixcp.com”, owned by “nixcp”, has no SSL certificate. AutoSSL will attempt to obtain a new certificate and install it.
10:20:33 PM The system will attempt to renew SSL certificates for the following websites:
10:20:33 PM nixcp.com (nixcp.com nixcp.org. [URL='http://www.nixcp.com']www.nixcp.com[/URL] [URL='http://www.nixcp.org']www.nixcp.org[/URL])
10:20:33 PM The system has completed the AutoSSL check for “cpaeltips.com”.
10:20:33 PM The system has finished checking 1 user.
The following script runs every 5 minutes, you can run it manually to see what’s going on and get your SSL processed:
/usr/local/cpanel/bin/autossl_check_cpstore_queue
After running this script, it will try to force a queue run for your pending autossl requests. The result may look similar to this:
[root@server.nixcp.com:~]/usr/local/cpanel/bin/autossl_check_cpstore_queue
Polling for “user1”’s new certificate for “yoursite.org” (order item ID “113902861”) … The certificate is available. The system will now attempt to install it. The certificate is now installed!

Polling for “user2”’s new certificate for “yoursite2.com” (order item ID “113902877”) … The certificate is available. The system will now attempt to install it. The certificate is now installed! [root@server.nixcp.com:~]
If you still have problems and your autossl not working after running that script, check out this post on cPanel forums, or contact your hosting provider for support.

Saturday, February 11, 2017

Find List of email ids belong to all domains exist in cpanel server

Unfortunately there is no built-in way in WHM/cPanel to list every POP3/IMAP account for every domain in one listing, however, using the command line and our built-in API system, you can run a query to list true email accounts:

1. as root change to /var/cpanel/users
# cd /var/cpanel/users

2. run the following one-line query against our API system:

# for file in *; do whmapi1 list_pops_for user=$file 2>/dev/null | grep \@ | grep -F @; done

This will result in an output such as:

root@server [/var/cpanel/users]# for file in *; do whmapi1 list_pops_for user=$file 2>/dev/null | grep \@ | grep -F @; done
- a@domain1.com
- x@domain1.com
- belle@domain2.com
- brian@domain3.com
- demos@domain3.com
- greypromo@domain3.com
- info@domain4.com
- kage@domain5.com
- news@domain6.com
- release@domain6.com
- sales@domain6.com

and so forth. These are all of the true email accounts on for every domain on your server.

Hope this information helps!

Friday, February 10, 2017

Tomcat/java



How to check java/tomcat version on cpanel 


+++
[root@ns1 /]# /etc/init.d/tomcat version

Server version: Apache Tomcat/7.0.65
Server built:   Jan 6 2016 18:50:03 UTC
Server number:  7.0.65.0
OS Name:        Linux
OS Version:     2.6.32-573.26.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.7.0_101-mockbuild_2016_04_21_13_21-b00
JVM Vendor:     Oracle Corporation
++++


Below is the code for test.jsp   testing script when java/tomcat is enabled on server.


++++

    Test JSP page
   
       

Working JSP page!


        This is a page to verify that .jsp support has been enabled


       
           
               
               
           
           
               
               
           
           
               
               
           
           
               
               
           
       
Date:<%= new java.util.Date() %>
Remote Address:<%= request.getRemoteAddr() %>
Request Method:<%= request.getMethod() %>
Servlet Path:<%= request.getServletPath() %>

   

++++

htaccess code 


As the servlet mapping only works on port 8080 and doesn't work on the Apache mod_jk proxy on port 80, we have to add below two lines needed for these to work with Apache into the user's .htaccess file at /home/user/public_html location:


+++
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
+++

Script to print tomcat version 


++++++++++++++
[root@ns1 public_html]# cat version.jsp

Server info: <%= application.getServerInfo() %>

Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>

JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>

Java version: <%= System.getProperty("java.version") %>
++++++++

You can view this script using http://website/version.jsp

Check Inode usage

You can check Inode usage using below script.

echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

add googlebot in csf

How to allow googlebot in CSF



Add below entries in /etc/csf/csf.rignore

.googlebot.com
.crawl.yahoo.net
.search.msn.com
.search.msn.com
.configserver.co.uk
.configserver.com
.aws.amazon.com

save this file and restart csf service.

Tuesday, January 31, 2017

INSTALL MYSQL 5.7 ON CPANEL SERVER

CPanel and WHM have been leaning towards support of MariaDB over other flavors. This is partly due to the upstream repos replacing the MySQL package with MariaDB (for example, on CentOS).
MySQL 5.6 is still supported though, which means they are keeping support for core MySQL products. But if you want to get some extra performance enhancements or enterprise features for free, without getting too many bells and whistles, you might want to install Percona Server.
I’ve done this work on a new dedicated server with the latest WHM and CPanel on CentOS 7, with MySQL 5.6 installed. Besides the backup, this is a fairly quick process.
It’s pretty simple. From the Percona Server for MySQL 5.7 installation doc, we can get the YUM repo. (Run commands as root if you can, otherwise as sudo.)

1

yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
Now that we have the repo, let’s install Percona XtraBackup in case we need to roll this back at any point:
This server had a drive mounted at /backup, so I created the backup with the following commands:
Now that we have a good backup, let’s remove MySQL:
Depending on your dependency chain, this could remove Percona XtraBackup, but that can be fixed. Let’s accept this uninstall.
Let’s install Percona Server for MySQL 5.7 and Percona Toolkit:
Now that it’s installed ensure the mysql service is running. If it isn’t, start it. Now let’s upgrade:
NOTE. This works if you can log in as root without a password; if you can’t, you will need to specify the -u and -p flags.
Once you run the upgrade, restart the mysql service:
And there you go, you are now running on Percona Server for MySQL 5.7. If your managed providers tell you it’s not supported, don’t worry! It works as long as CPanel supports MySQL 5.6.
If you have any issues, just restore the backup.
NOTE: One thing to keep in mind is that 5.7 breaks CPanel’s ability to create users in MySQL. I believe this is due to the changes to the mysql.user table. If this is an issue for you, you can always use Percona Server for MySQL 5.6.

Wednesday, December 28, 2016

check envtype on cpanel server

check envtype on cpanel server -(vmware or virtuozzo)

root@host [~]# cat /var/cpanel/envtype
vmware
root@host [~]#