Hi everyone!

Recently we've faced hostname issue on container running on CentOS with
cPanel.

When container is rebooted, hostname became "server1" instead of "
server1.example.com". We understand that hostname shouldn't be FQDN, but
unfortunately it breaks cPanel (we've faced at least 2 issues such as
invalid HELO name and revoked certificate for WHM). So we made a patch for
script /etc/vz/dists/scripts/redhat-set_hostname.sh. If the server running
cPanel, it doesn't apply hostname. It would be great to add it to future
updates of OpenVZ.

Details of the patch are below:

--- redhat-set_hostname.sh 2017-09-21 02:27:57.080899967 -0600
+++ redhat-set_hostname_new.sh 2017-09-21 02:30:24.921061967 -0600
@@ -28,8 +28,8 @@

  if [ -f /etc/hostname ]; then
  # New style: RHEL7/Fedora15+
- # Note hostname(5) says it should NOT be FQDN
- val=${val%%.*}
+ # Note hostname(5) says it should NOT be FQDN, but it breaks cPanel
+ [ -e /usr/local/cpanel/version ] || val=${val%%.*}
  echo "$val" > /etc/hostname
  else
  # "Classic" style

--
Best regards,
NK Support Team
http://www.nksupport.com/
_______________________________________________
Users mailing list
Users@openvz.org
https://lists.openvz.org/mailman/listinfo/users

Reply via email to