# File common/lib/symbiosis/domain/dkim.rb, line 72
    def dkim_selector
      selector = get_param("dkim", self.config_dir)
      selector_regex = /\b(([a-z0-9-]+)(\.[a-z0-9-]+)*)\b/i

      @dkim_selector = if selector.is_a?(String) and selector =~ selector_regex
        $1.to_s
  
      elsif selector == false
        nil

      else
        #
        # Here we mirror what exim4 does when it works out primary_hostname.
        #
        # "This variable contains the value set by primary_hostname in the
        #  configuration file, or read by the uname() function. If uname()
        #  returns a single-component name, Exim calls gethostbyname() (or
        #  getipnodebyname() where available) in an attempt to acquire a fully
        #  qualified host name."
        #
        # Try /proc/sys/kernel/hostname (which mirrors what uname returns)
        #
        hostname = nil

        %w(/etc/mailname /etc/hostname /proc/sys/kernel/hostname).each do |path|
          hostname = get_param( *File.split(path).reverse )
          break if hostname.is_a?(String) and hostname.include?(".")
        end

        hostname = ""  unless hostname.is_a?(String) 

        if hostname.empty? and !hostname.include?(".")
          begin
            hostname = Socket.gethostbyname(hostname).first
          rescue SocketError
            hostname = ""
          end
        end

        #
        # Default to "default" if the hostname doesn't match the regex.  This
        # should never happen (I don't think!).
        #
        if hostname =~ selector_regex
          $2.to_s
        else
          "default" 
        end
      end
    end