The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED WHM command line config changes

Discussion in 'cPanel Developers' started by izghitu, May 10, 2017.

  1. izghitu

    izghitu Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    156
    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.
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,493
    Likes Received:
    31
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Hi,

    Are you doing these actions on a new install?
     
  3. izghitu

    izghitu Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    156
    Yes, I am doing on a sandbox with new install but eventually I will want to do it on servers with existing accounts
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  5. izghitu

    izghitu Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    156
    Hi Michael,

    Thank you for your reply. I have tried the api command line command as per documentation like below:
    Code:
    [root@ip-172-31-6-154 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:
    [root@ip-172-31-6-154 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
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  7. izghitu

    izghitu Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    50
    Likes Received:
    1
    Trophy Points:
    156
    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.
     
    Infopro likes this.
Loading...

Share This Page