SOLVED WHM command line config changes

izghitu

Well-Known Member
Aug 9, 2006
56
2
158
Hi,

I am trying to automate certain cPanel config changes using chef via command line and require the below to be done but I am unsure where and if I do them correctly:

1. Disable root login to pure-ftp:
Create /var/cpanel/conf/pureftpd/root_password_disabled
Modify /var/cpanel/conf/pureftpd/main and set RootPassLogins: 'no'
Run /scripts/ftpupdate and /scripts/setupftpserver pure-ftpd

2. Max hourly emails per domain and disable boxtrapper
Set /etc/email_send_limits to:
Code:
#version 1.0
#format DOMAIN: MAX_EMAIL_PER_HOUR,MAX_DEFER_FAIL_PERCENTAGE,MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION
*: 100,0,5
Set skipboxtrapper=1 in /var/cpanel/cpanel.config
Rebuild exim conf with /scripts/buildeximconf

3. Disable Reset Password for cPanel accounts and Reset Password for Subaccounts
I have set resetpass_sub=0 and resetpass=0 in /var/cpanel/cpanel.config but I can also see that Post actions are required as well:
Processing post action for Reset Password for Subaccounts
Processing post action for Reset Password for cPanel accounts

Any ideas what are the post actions required?
Also amd I doing it correctly at 1 and 2? Anything else required?
Please help. Thanks in advance.
 

izghitu

Well-Known Member
Aug 9, 2006
56
2
158
Yes, I am doing on a sandbox with new install but eventually I will want to do it on servers with existing accounts
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello @izghitu,

1. Disable root login to pure-ftp:
Create /var/cpanel/conf/pureftpd/root_password_disabled
Modify /var/cpanel/conf/pureftpd/main and set RootPassLogins: 'no'
Run /scripts/ftpupdate and /scripts/setupftpserver pure-ftpd
You could use the following commands based on the procedure from our FTP FAQ document:

Code:
rm -f /var/cpanel/conf/pureftpd/main.cache
touch /var/cpanel/conf/pureftpd/root_password_disabled
replace "RootPassLogins: 'yes'" "RootPassLogins: 'no'" -- /var/cpanel/conf/pureftpd/main
/scripts/setupftpserver pure-ftpd -—force
2. Max hourly emails per domain and disable boxtrapper
Set /etc/email_send_limits to:
Code:
#version 1.0
#format DOMAIN: MAX_EMAIL_PER_HOUR,MAX_DEFER_FAIL_PERCENTAGE,MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION
*: 100,0,5
Set skipboxtrapper=1 in /var/cpanel/cpanel.config
Rebuild exim conf with /scripts/buildeximconf

3. Disable Reset Password for cPanel accounts and Reset Password for Subaccounts
I have set resetpass_sub=0 and resetpass=0 in /var/cpanel/cpanel.config but I can also see that Post actions are required as well:
Processing post action for Reset Password for Subaccounts
Processing post action for Reset Password for cPanel accounts
You can configure these values before the installation using the instructions at:

Installation Guide - Customize Your Installation - Version 64 Documentation - cPanel Documentation

No additional actions are required when using this method. On existing installations, you can utilize the following WHM API 1 function:

WHM API 1 Functions - set_tweaksetting - Software Development Kit - cPanel Documentation

Thank you.
 

izghitu

Well-Known Member
Aug 9, 2006
56
2
158
Hello @izghitu,



You could use the following commands based on the procedure from our FTP FAQ document:

Code:
rm -f /var/cpanel/conf/pureftpd/main.cache
touch /var/cpanel/conf/pureftpd/root_password_disabled
replace "RootPassLogins: 'yes'" "RootPassLogins: 'no'" -- /var/cpanel/conf/pureftpd/main
/scripts/setupftpserver pure-ftpd -—force


You can configure these values before the installation using the instructions at:

Installation Guide - Customize Your Installation - Version 64 Documentation - cPanel Documentation

No additional actions are required when using this method. On existing installations, you can utilize the following WHM API 1 function:

WHM API 1 Functions - set_tweaksetting - Software Development Kit - cPanel Documentation

Thank you.
Hi Michael,

Thank you for your reply. I have tried the api command line command as per documentation like below:
Code:
[[email protected] home]# whmapi1 set_tweaksetting key=maxemailsperhour value=201
---
metadata:
  command: set_tweaksetting
  reason: OK
  result: 1
  version: 1
But nothing changed other than getting that response and the value from cpanel.config. The email_send_limits file is still showing default values.
Code:
[[email protected] home]# cat /etc/email_send_limits
#version 1.0
#format DOMAIN: MAX_EMAIL_PER_HOUR,MAX_DEFER_FAIL_PERCENTAGE,MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION
*: 0,0,5
The same goes for resetpass_sub and resetpass. If I set them to 0 then no post actions are being executed and no services are being reloaded. Just confirmation messages that the change in cpanel.config was successful. Do I need to do something else or am I doing it wrong?

Please advise.
Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look and open an internal case if necessary?

Thank you.
 

izghitu

Well-Known Member
Aug 9, 2006
56
2
158
Hi,

So the command I was looking for to run after the whmapi1 for max emails per hour was:
/scripts/updateuserdomains

If anyone needs it for the future.
 
  • Like
Reactions: Infopro