示例#1
0
 private void UpdateWhenChanged(TenantInboundConnector connector)
 {
     if (this.WhenChangedUTC == null || (connector.WhenChangedUTC != null && this.WhenChangedUTC < connector.WhenChangedUTC))
     {
         this.WhenChangedUTC = connector.WhenChangedUTC;
     }
 }
示例#2
0
 public static IEnumerable <string> BucketizeConnector(TenantInboundConnector connector)
 {
     if (connector == null)
     {
         throw new ArgumentNullException("connector");
     }
     if (connector.SenderIPAddresses != null)
     {
         foreach (string ipKey in TenantInboundConnectorBucket.FindAllVariationsOfKeysBasedOnSenderIPAddresses(connector.SenderIPAddresses))
         {
             yield return(ipKey);
         }
     }
     if (connector.TlsSenderCertificateName != null)
     {
         SmtpDomainWithSubdomains domain = connector.TlsSenderCertificateName.TlsCertificateName as SmtpDomainWithSubdomains;
         if (domain != null)
         {
             yield return(domain.Address);
         }
         else
         {
             yield return(connector.TlsSenderCertificateName.ToString());
         }
     }
     yield break;
 }
        protected TenantInboundConnector GetHybridMailflowInboundConnector()
        {
            Collection <PSObject>  collection = this.InvokeConnectorCmdletWithOrganization("Get-InboundConnector", "Hybrid Mail Flow Inbound Connector", true);
            TenantInboundConnector result     = null;

            if (collection != null && collection.Count > 0)
            {
                foreach (PSObject psobject in collection)
                {
                    if (psobject.BaseObject is TenantInboundConnector)
                    {
                        TenantInboundConnector tenantInboundConnector = psobject.BaseObject as TenantInboundConnector;
                        if (tenantInboundConnector.ConnectorType == TenantConnectorType.OnPremises)
                        {
                            result = tenantInboundConnector;
                            break;
                        }
                        this.WriteWarning(Strings.HybridMailflowConnectorNameAndTypeWarning("Hybrid Mail Flow Inbound Connector"));
                    }
                    else
                    {
                        base.WriteError(new ApplicationException(Strings.HybridMailflowUnexpectedType("Get-InboundConnector")), ErrorCategory.InvalidData, null);
                    }
                }
            }
            return(result);
        }
示例#4
0
        public IInboundConnector NewInboundConnector(IInboundConnector configuration)
        {
            SessionParameters      parameters             = this.BuildParameters(configuration);
            TenantInboundConnector tenantInboundConnector = base.RemotePowershellSession.RunOneCommandSingleResult <TenantInboundConnector>("New-InboundConnector", parameters, false);

            if (tenantInboundConnector != null)
            {
                return(new InboundConnector(tenantInboundConnector));
            }
            return(null);
        }
示例#5
0
 public InboundConnector(TenantInboundConnector ic)
 {
     this.Identity = (ADObjectId)ic.Identity;
     this.Name     = ic.Name;
     this.TLSSenderCertificateName = TaskCommon.ToStringOrNull(ic.TlsSenderCertificateName);
     this.ConnectorType            = ic.ConnectorType;
     this.ConnectorSource          = ic.ConnectorSource;
     this.SenderDomains            = ic.SenderDomains;
     this.RequireTls = ic.RequireTls;
     this.CloudServicesMailEnabled = ic.CloudServicesMailEnabled;
 }
示例#6
0
        public IInboundConnector GetInboundConnector(string identity)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Identity", identity);
            TenantInboundConnector tenantInboundConnector = base.RemotePowershellSession.RunOneCommandSingleResult <TenantInboundConnector>("Get-InboundConnector", sessionParameters, true);

            if (tenantInboundConnector != null)
            {
                return(new InboundConnector(tenantInboundConnector));
            }
            return(null);
        }
        private static IEnumerable <TenantInboundConnector> GetInboundConnectors(IConfigDataProvider dataProvider, ADPropertyDefinition propertyDefinition, IEnumerable <string> propertyValues, bool enabledOnly)
        {
            IEnumerable <ComparisonFilter> propertyNameFilters = from propertyValue in propertyValues
                                                                 select new ComparisonFilter(ComparisonOperator.Equal, propertyDefinition, propertyValue);
            QueryFilter filter = QueryFilter.AndTogether(new QueryFilter[]
            {
                QueryFilter.OrTogether(propertyNameFilters.ToArray <QueryFilter>()),
                new ComparisonFilter(ComparisonOperator.Equal, DalHelper.CacheFailoverModeProp, CacheFailoverMode.BloomFilter)
            });
            IEnumerable <IConfigurable> inboundConnectors = dataProvider.Find <TenantInboundConnector>(filter, null, false, null);

            foreach (IConfigurable configurable in inboundConnectors)
            {
                TenantInboundConnector inboundConnector = (TenantInboundConnector)configurable;
                if (!enabledOnly || inboundConnector.Enabled)
                {
                    FfoDirectorySession.FixDistinguishedName(inboundConnector, DalHelper.GetTenantDistinguishedName(inboundConnector.OrganizationalUnitRoot.ObjectGuid.ToString()), inboundConnector.OrganizationalUnitRoot.ObjectGuid, inboundConnector.Id.ObjectGuid, null);
                    yield return(inboundConnector);
                }
            }
            yield break;
        }
示例#8
0
 internal static string GetPrimaryKeyForTenantInboundConnector(TenantInboundConnector connector)
 {
     return(string.Format("{0}:{1}", connector.OrganizationalUnitRoot.ObjectGuid, connector.Name.ToLower()));
 }
        protected static HybridMailflowConfiguration ConvertToHybridMailflowConfiguration(TenantInboundConnector inbound, TenantOutboundConnector outbound)
        {
            ArgumentValidator.ThrowIfNull("inbound", inbound);
            ArgumentValidator.ThrowIfNull("outbound", outbound);
            HybridMailflowConfiguration hybridMailflowConfiguration = new HybridMailflowConfiguration();

            hybridMailflowConfiguration.OutboundDomains = new List <SmtpDomainWithSubdomains>();
            foreach (SmtpDomainWithSubdomains smtpDomainWithSubdomains in outbound.RecipientDomains)
            {
                if (!HybridMailflowTaskBase.IsWildcardDomain(smtpDomainWithSubdomains))
                {
                    hybridMailflowConfiguration.OutboundDomains.Add(new SmtpDomainWithSubdomains(smtpDomainWithSubdomains.Address));
                }
            }
            if (inbound.SenderIPAddresses != null)
            {
                hybridMailflowConfiguration.InboundIPs = new List <IPRange>();
                foreach (IPRange item in inbound.SenderIPAddresses)
                {
                    hybridMailflowConfiguration.InboundIPs.Add(item);
                }
            }
            if (!MultiValuedPropertyBase.IsNullOrEmpty(outbound.SmartHosts))
            {
                SmartHost smartHost = outbound.SmartHosts[0];
                if (smartHost.IsIPAddress)
                {
                    hybridMailflowConfiguration.OnPremisesFQDN = new Fqdn(smartHost.Address.ToString());
                }
                else
                {
                    hybridMailflowConfiguration.OnPremisesFQDN = new Fqdn(smartHost.ToString());
                }
            }
            if (inbound.TlsSenderCertificateName != null)
            {
                hybridMailflowConfiguration.CertificateSubject = inbound.TlsSenderCertificateName.ToString();
            }
            hybridMailflowConfiguration.SecureMailEnabled           = new bool?(inbound.RequireTls && outbound.TlsSettings != null && outbound.TlsSettings == TlsAuthLevel.DomainValidation);
            hybridMailflowConfiguration.CentralizedTransportEnabled = new bool?((inbound.RestrictDomainsToIPAddresses && HybridMailflowTaskBase.IsRecipientDomainsWildcard(outbound.RecipientDomains)) || outbound.RouteAllMessagesViaOnPremises);
            return(hybridMailflowConfiguration);
        }