Ruby class to model a Symbiosis domain.
| NAME_REGEXP | = | /^[a-z0-9-]+\.([a-z0-9-]+\.?)+$/i | This is a regular expression that matches valid domain names. |
| directory | [R] | |
| gid | [R] | |
| group | [R] | |
| name | [R] | |
| prefix | [R] | |
| symlink | [R] | |
| uid | [R] | |
| user | [R] |
Creates a new domain object. If no name is set a random domain name is generated, based on 10 characters in the imaginary .test TLD.
This returns a Symbiosis::ConfigFiles::Apache object for this domain.
Checks a given password against the real one, which may be hashed using crypt_password. An argument error is raised if either password is empty.
First the two passwords are compared using crypt(), and if that fails, then a plain text comparison is made.
If the real password starts with {CRYPT} or a recognisable salt, i.e. something like $1$salt$ then only the crypted comparison is done.
If the real password contains characters other than those allowed in crypt()’d hashes, just the plain text comparison is made.
Returns true or false.
Encrypt a password, using the cyrpt() function, with MD5 hashing and an 8 character salt. The function returns the crypt() output, prepended with {CRYPT}.
Fetches the default mailbox quota for the domain. Returns an integer, or nil if no quota was set or the set quota could not be parsed.
Set the default mailbox quota for the domain. Uses Symbiosis::Utils#parse_quota to check the argment. Returns an interpreted quota, i.e. an integer or nil.
This returns the dkim selector, stored in config/dkim. If that file is empty, then either /etc/mailname, /etc/hostname, or the hostname returned by the hostname(1) command is used. If none of those produce FQDNs, then gethostbyname() is used.
Return all this domain‘s IPs (IPv4 and 6) as an array. If none have been set, then the host‘s primary IPv4 and IPv6 addresses are returned.
This will use config/ip, or config/ips if config/ip is missing. The documentation should only ever refer to config/ip.
Return all the mailboxes for this domain. This method is not thread-safe, I don‘t think.
Sets the domain to have statistics generated, or not. Expects true if statistics are wanted, or false if not.
Checks to see if a domain should have statistics generated for it. Returns true if statistics should be generated, false if not.
Return the available certificate/key files for a domain. It will check files with the following extensions for both keys and certificates.
* combined * key * crt * pem
It will return an array of certificate and key filenames that could be read and parsed successfully by OpenSSL. The array has to sub-arrays, the first being certificate filenames, the second key filenames, i.e. [[certificates] , [keys]]. If a file contains both a certificate and key, it will appear in both arrays.
Returns the certificate chain filename, if one exists, or one has been set, or nil if nothing could be found.
Sets up and returns a new OpenSSL::X509::Store.
If any CA paths have been set using ssl_add_ca_path, then these are added to the store.
If ssl_certificate_chain_file has been set, then this is added to the store.
This is regenerated on every call.
Returns true if SSL has been enabled. SSL is enabled if there is a matching key and certificate found using ssl_find_matching_certificate_and_key.
Tests each of the available key and certificate files, until a matching pair is found. Returns an array of [certificate filename, key_filename], or nil if no match is found.
The order in which keys and certficates are matched is determined by ssl_available_files.
Searches for the domain‘s SSL key using ssl_find_matching_certificate_and_key, and returns the key‘s filename, or nil if nothing could be found.
This method performs a variety of checks on an SSL certificate and key:
If any of these checks fail, a warning is raised.
If either of these last two checks fail, a OpenSSL::X509::CertificateError is raised.
Searches for the domain‘s SSL certificate using ssl_find_matching_certificate_and_key, and returns the certificate‘s filename, or nil if nothing could be found.
Returns the directory where stats files should be kept. Defaults to stats inside the htdocs_dir
Fetches the Bytemark anti-spam flag. Returns true or false. This causes the DNS template to be changed to point the MX records at the Bytemark anti-spam service, as per www.bytemark.co.uk/nospam . Also the Exim4 config checks for this flag, and will defer mail that doesn‘t come via the anti-spam servers.