Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Validate Exim's Configuration File Syntax — validate_exim_configuration_syntax

This function will evaluate and validate Exim configuration file syntax. This function requires raw text from the configuration file as input.

Calling Functions

Using the XML API

To use the XML API to perform the validate_exim_configuration_syntax function from within your custom script:

  • Append the /xml-api/validate_exim_configuration_syntax function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/validate_exim_configuration_syntax

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the validate_exim_configuration_syntax function from within your custom script:

  • Append the /json-api/validate_exim_configuration_syntax function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/validate_exim_configuration_syntax

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The following variable is required:

  • cfg_text — The raw text of the Exim configuration file to validate. You can find an example of this input value below:

domainlist local_domains=lsearch;/etc/localdomains domainlist relay_domains=lsearch;/etc/localdomains : lsearch;/etc/secondarymx domainlist user_domains=${if exists{/etc/userdomains} {lsearch;/etc/userdomains} fail} hostlist auth_relay_hosts=* hostlist backupmx_hosts=lsearch;/etc/backupmxhosts hostlist loopback=<; 127.0.0.0/8 ; 0.0.0.0 ; ::1 ; 0000:0000:0000:0000:0000:ffff:7f00:0000/8 hostlist relay_hosts=net-iplsearch;/etc/relayhosts hostlist senderverifybypass_hosts=net-iplsearch;/etc/senderverifybypasshosts hostlist skipsmtpcheck_hosts=net-iplsearch;/etc/skipsmtpcheckhosts hostlist spammeripblocks=net-iplsearch;/etc/spammeripblocks hostlist trustedmailhosts=lsearch;/etc/trustedmailhosts acl_smtp_connect=acl_smtp_connect acl_smtp_data=acl_smtp_data acl_smtp_mail=acl_smtp_mail acl_smtp_notquit=acl_smtp_notquit acl_smtp_rcpt=acl_smtp_rcpt allow_domain_literals=false allow_mx_to_ip=false auto_thaw=7d callout_domain_negative_expire=1h callout_negative_expire=1h daemon_smtp_ports=5454 : 25 : 809 : 122 : 26 : 465 : 434 : 125 : 232 deliver_queue_load_max=24 helo_accept_junk_hosts=* ignore_bounce_errors_after=3d local_from_check=false message_body_visible=5000 never_users=root perl_at_start=true perl_startup=do '/etc/exim.pl' queue_only_load=48 queue_run_max=5 remote_max_parallel=10 rfc1413_query_timeout=0s smtp_accept_max=100 smtp_accept_reserve=0 smtp_banner="${primary_hostname} ESMTP Exim ${version_number} \#${compile_number} ${tod_full} \n We do not authorize the use of this system to transport unsolicited, \n and/or bulk e-mail." smtp_connect_backlog=50 smtp_enforce_sync=false smtp_receive_timeout=165s spamd_address=127.0.0.1 783 split_spool_directory=yes system_filter=/etc/cpanel_exim_system_filter system_filter_group=cpaneleximfilter system_filter_user=cpaneleximfilter timeout_frozen_after=5d tls_advertise_hosts=* tls_certificate=/etc/exim.crt tls_on_connect_ports=465 tls_privatekey=/etc/exim.key tls_require_ciphers=ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP untrusted_set_sender=* begin acl begin authenticators begin rewrite begin routers begin transports begin retry * * F,2h,15m; G,16h,1h,1.5; F,4d,8h

The following variable is optional:

  • section — The section of the Exim configuration file to validate. For example, to test an ACL block, set this value to acl.

Output

  • validate_exim_configuration_syntax — The function's results container.
    • rawout (string) — The raw output of the Exim configuration test.
    • status (boolean) — A boolean value that indicates success or failure. A value of 1 indicates success.
    • error_msg (string) — The error message corresponding to any errors the configuration validation encountered. This value only appears if a problem with the configuration file was encountered.
    • error_line (string) — The line number in the exim configuration file on which the first error was encountered, if an error was encountered. This value only appears if a problem with the configuration file was encountered.
    • broken_cfg_html (string) — A representation of the broken configuration in HTML format, if an error was encountered. This value only appears if a problem with the configuration file was encountered.
    • broken_cfg_text (string) — A representation of the broken configuration in raw text, if an error was encountered. This value only appears if a problem with the configuration file was encountered.

Examples

XML API

Calling the URL https://example.com:2087/xml-api/validate_exim_configuration_syntax?cfg_text=domainlist%20local_domains=lsearch;/etc/localdomains%20domainlist%20relay_domains=lsearch;/etc/localdomains%20:%20lsearch;/etc/secondarymx%20domainlist%20user_domains=${if%20exists{/etc/userdomains}%20{lsearch;/etc/userdomains}%20fail}%20hostlist%20auth_relay_hosts=*%20hostlist%20backupmx_hosts=lsearch;/etc/backupmxhosts%20hostlist%20loopback=<;%20127.0.0.0/8%20;%200.0.0.0%20;%20::1%20;%200000:0000:0000:0000:0000:ffff:7f00:0000/8%20hostlist%20relay_hosts=net-iplsearch;/etc/relayhosts%20hostlist%20senderverifybypass_hosts=net-iplsearch;/etc/senderverifybypasshosts%20hostlist%20skipsmtpcheck_hosts=net-iplsearch;/etc/skipsmtpcheckhosts%20hostlist%20spammeripblocks=net-iplsearch;/etc/spammeripblocks%20hostlist%20trustedmailhosts=lsearch;/etc/trustedmailhosts%20acl_smtp_connect=acl_smtp_connect%20acl_smtp_data=acl_smtp_data%20acl_smtp_mail=acl_smtp_mail%20acl_smtp_notquit=acl_smtp_notquit%20acl_smtp_rcpt=acl_smtp_rcpt%20allow_domain_literals=false%20allow_mx_to_ip=false%20auto_thaw=7d%20callout_domain_negative_expire=1h%20callout_negative_expire=1h%20daemon_smtp_ports=5454%20:%2025%20:%20809%20:%20122%20:%2026%20:%20465%20:%20434%20:%20125%20:%20232%20deliver_queue_load_max=24%20helo_accept_junk_hosts=*%20ignore_bounce_errors_after=3d%20local_from_check=false%20message_body_visible=5000%20never_users=root%20perl_at_start=true%20perl_startup=do%20'/etc/exim.pl'%20queue_only_load=48%20queue_run_max=5%20remote_max_parallel=10%20rfc1413_query_timeout=0s%20smtp_accept_max=100%20smtp_accept_reserve=0%20smtp_banner="${primary_hostname}%20ESMTP%20Exim%20${version_number}%20\#${compile_number} ${tod_full} \n We do not authorize the use of this system to transport unsolicited, \n and/or bulk e-mail." smtp_connect_backlog=50 smtp_enforce_sync=false smtp_receive_timeout=165s spamd_address=127.0.0.1 783 split_spool_directory=yes system_filter=/etc/cpanel_exim_system_filter system_filter_group=cpaneleximfilter system_filter_user=cpaneleximfilter timeout_frozen_after=5d tls_advertise_hosts=* tls_certificate=/etc/exim.crt tls_on_connect_ports=465 tls_privatekey=/etc/exim.key tls_require_ciphers=ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP untrusted_set_sender=* begin acl begin authenticators begin rewrite begin routers begin transports begin retry * * F,2h,15m; G,16h,1h,1.5; F,4d,8h in WebHost Manager will produce output similar to:

<validate_exim_configuration_syntax>
	<rawout>
		Exim version 4.76 #1 built 16-Aug-2011 11:41:07 Copyright (c) University of Cambridge, 1995 - 2007 Berkeley DB: Sleepycat Software: Berkeley DB 4.3.29: (July 12, 2010) Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning DKIM Old_Demime Experimental_SPF Experimental_SRS Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz passwd Authenticators: cram_md5 dovecot plaintext spa Routers: accept dnslookup ipliteral manualroute queryprogram redirect Transports: appendfile/maildir autoreply pipe smtp Size of off_t: 8
		</rawout>
		<status>1</status>
</validate_exim_configuration_syntax>

JSON API

Calling the URL https://example.com:2087/json-api/validate_exim_configuration_syntax?cfg_text=domainlist%20local_domains=lsearch;/etc/localdomains%20domainlist%20relay_domains=lsearch;/etc/localdomains%20:%20lsearch;/etc/secondarymx%20domainlist%20user_domains=${if%20exists{/etc/userdomains}%20{lsearch;/etc/userdomains}%20fail}%20hostlist%20auth_relay_hosts=*%20hostlist%20backupmx_hosts=lsearch;/etc/backupmxhosts%20hostlist%20loopback=<;%20127.0.0.0/8%20;%200.0.0.0%20;%20::1%20;%200000:0000:0000:0000:0000:ffff:7f00:0000/8%20hostlist%20relay_hosts=net-iplsearch;/etc/relayhosts%20hostlist%20senderverifybypass_hosts=net-iplsearch;/etc/senderverifybypasshosts%20hostlist%20skipsmtpcheck_hosts=net-iplsearch;/etc/skipsmtpcheckhosts%20hostlist%20spammeripblocks=net-iplsearch;/etc/spammeripblocks%20hostlist%20trustedmailhosts=lsearch;/etc/trustedmailhosts%20acl_smtp_connect=acl_smtp_connect%20acl_smtp_data=acl_smtp_data%20acl_smtp_mail=acl_smtp_mail%20acl_smtp_notquit=acl_smtp_notquit%20acl_smtp_rcpt=acl_smtp_rcpt%20allow_domain_literals=false%20allow_mx_to_ip=false%20auto_thaw=7d%20callout_domain_negative_expire=1h%20callout_negative_expire=1h%20daemon_smtp_ports=5454%20:%2025%20:%20809%20:%20122%20:%2026%20:%20465%20:%20434%20:%20125%20:%20232%20deliver_queue_load_max=24%20helo_accept_junk_hosts=*%20ignore_bounce_errors_after=3d%20local_from_check=false%20message_body_visible=5000%20never_users=root%20perl_at_start=true%20perl_startup=do%20'/etc/exim.pl'%20queue_only_load=48%20queue_run_max=5%20remote_max_parallel=10%20rfc1413_query_timeout=0s%20smtp_accept_max=100%20smtp_accept_reserve=0%20smtp_banner="${primary_hostname}%20ESMTP%20Exim%20${version_number}%20\#${compile_number} ${tod_full} \n We do not authorize the use of this system to transport unsolicited, \n and/or bulk e-mail." smtp_connect_backlog=50 smtp_enforce_sync=false smtp_receive_timeout=165s spamd_address=127.0.0.1 783 split_spool_directory=yes system_filter=/etc/cpanel_exim_system_filter system_filter_group=cpaneleximfilter system_filter_user=cpaneleximfilter timeout_frozen_after=5d tls_advertise_hosts=* tls_certificate=/etc/exim.crt tls_on_connect_ports=465 tls_privatekey=/etc/exim.key tls_require_ciphers=ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP untrusted_set_sender=* begin acl begin authenticators begin rewrite begin routers begin transports begin retry * * F,2h,15m; G,16h,1h,1.5; F,4d,8h in WebHost Manager will produce output similar to:

{
   "status":1,
   "rawout":"Exim version 4.76 #1 built 16-Aug-2011 11:41:07\nCopyright (c) University of Cambridge, 1995 - 2007\nBerkeley DB: Sleepycat Software: Berkeley DB 4.3.29: (July 12, 2010)\nSupport for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning DKIM Old_Demime Experimental_SPF Experimental_SRS\nLookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz passwd\nAuthenticators: cram_md5 dovecot plaintext spa\nRouters: accept dnslookup ipliteral manualroute queryprogram redirect\nTransports: appendfile/maildir autoreply pipe smtp\nSize of off_t: 8\n\n"
}

Topic revision: r1 - 14 Feb 2012 - 18:14:45 - Main.JustinSchaefer