// Token: 0x06000A44 RID: 2628 RVA: 0x000238E8 File Offset: 0x00021AE8
        private static bool HasPrivateKey(X509Certificate2 cert)
        {
            bool result = true;

            if (!cert.HasPrivateKey)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate does not have a private key.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNoPrivateKey, string.Empty, new object[0]);
                OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), "IM Certificate does not have a private key.", ResultSeverityLevel.Error);
                result = false;
            }
            return(result);
        }
        // Token: 0x06000A41 RID: 2625 RVA: 0x00023644 File Offset: 0x00021844
        private static X509Certificate2 FindCertByThumbprint(string thumbprint)
        {
            X509Certificate2 x509Certificate = null;
            X509Store        x509Store       = new X509Store(StoreName.My, StoreLocation.LocalMachine);

            try
            {
                x509Store.Open(OpenFlags.ReadOnly);
                X509Certificate2Collection x509Certificate2Collection = x509Store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
                x509Certificate = ((x509Certificate2Collection.Count > 0) ? x509Certificate2Collection[0] : null);
                if (x509Certificate == null)
                {
                    ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate with thumbprint {0} could not be found.", new object[]
                    {
                        thumbprint
                    });
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNotFound, string.Empty, new object[]
                    {
                        thumbprint
                    });
                    OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("IM Certificate with thumbprint {0} could not be found.", thumbprint), ResultSeverityLevel.Error);
                }
            }
            catch (CryptographicException ex)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Cryptographic exception is thrown: {0}", new object[]
                {
                    ex
                });
            }
            catch (SecurityException ex2)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Security exception is thrown: {0}", new object[]
                {
                    ex2
                });
            }
            catch (ArgumentException ex3)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError(0L, "Argument exception is thrown: {0}", new object[]
                {
                    ex3
                });
            }
            finally
            {
                x509Store.Close();
            }
            return(x509Certificate);
        }
Пример #3
0
        public bool CheckConfiguration()
        {
            bool   result = true;
            string arg    = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.UseVdirConfigForInstantMessaging.Enabled ? "OWA Virtual Directory object" : "web.config";

            if (string.IsNullOrWhiteSpace(this.ServerName))
            {
                result = false;
                OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("Instant Messaging Server name is null or empty on {0}.", arg), ResultSeverityLevel.Error);
            }
            if (string.IsNullOrWhiteSpace(this.CertificateThumbprint))
            {
                result = false;
                OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), string.Format("Instant Messaging Certificate Thumbprint is null or empty on {0}.", arg), ResultSeverityLevel.Error);
            }
            return(result);
        }
        // Token: 0x06000A42 RID: 2626 RVA: 0x000237D0 File Offset: 0x000219D0
        private static bool IsExpired(X509Certificate2 cert)
        {
            bool       result     = false;
            ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotAfter);

            if (ExDateTime.Compare(exDateTime, ExDateTime.Now) <= 0)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate has expired.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateExpired, string.Empty, new object[]
                {
                    exDateTime
                });
                OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, Feature.InstantMessage.ToString(), "IM Certificate has expired.", ResultSeverityLevel.Error);
                result = true;
            }
            return(result);
        }
        // Token: 0x06000806 RID: 2054 RVA: 0x0001A83C File Offset: 0x00018A3C
        private static WacConfigData GetWacConfigData(UserContext userContext)
        {
            WacConfigData wacConfigData = new WacConfigData();

            if (userContext == null)
            {
                throw new NullReferenceException("Retail assert: UserContext is null.");
            }
            if (userContext.FeaturesManager == null)
            {
                throw new NullReferenceException("Retail assert: UserContext.FeaturesManager is null.");
            }
            if (WacConfiguration.Instance == null)
            {
                throw new NullReferenceException("Retail assert: WacConfiguration.Instance is null.");
            }
            if (WacDiscoveryManager.Instance == null)
            {
                throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance is null.");
            }
            if (WacDiscoveryManager.Instance.WacDiscoveryResult == null)
            {
                throw new NullReferenceException("Retail assert: WacDiscoveryManager.Instance.WacDiscoveryResult is null.");
            }
            if (!WacConfiguration.Instance.BlockWacViewingThroughUI)
            {
                if (userContext.FeaturesManager.ClientServerSettings.DocCollab.Enabled || userContext.FeaturesManager.ClientServerSettings.ModernAttachments.Enabled)
                {
                    wacConfigData.IsWacEditingEnabled = WacConfiguration.Instance.EditingEnabled;
                }
                else
                {
                    wacConfigData.IsWacEditingEnabled = false;
                }
                try
                {
                    wacConfigData.WacViewableFileTypes  = WacDiscoveryManager.Instance.WacDiscoveryResult.WacViewableFileTypes;
                    wacConfigData.WacEditableFileTypes  = WacDiscoveryManager.Instance.WacDiscoveryResult.WacEditableFileTypes;
                    wacConfigData.WacDiscoverySucceeded = true;
                }
                catch (WacDiscoveryFailureException ex)
                {
                    OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.OwaDependency.Name, "DocCollab", ex.Message, ResultSeverityLevel.Error);
                    wacConfigData.WacViewableFileTypes  = new string[0];
                    wacConfigData.WacEditableFileTypes  = new string[0];
                    wacConfigData.WacDiscoverySucceeded = false;
                    wacConfigData.IsWacEditingEnabled   = false;
                }
            }
            if (userContext.IsBposUser)
            {
                string text;
                string text2;
                wacConfigData.OneDriveDiscoverySucceeded   = OneDriveProAttachmentDataProvider.TryGetBposDocumentsInfoFromBox(userContext, CallContext.Current, out text, out text2);
                wacConfigData.OneDriveDocumentsUrl         = (text ?? string.Empty);
                wacConfigData.OneDriveDocumentsDisplayName = (text2 ?? string.Empty);
            }
            else
            {
                wacConfigData.OneDriveDiscoverySucceeded   = true;
                wacConfigData.OneDriveDocumentsUrl         = string.Empty;
                wacConfigData.OneDriveDocumentsDisplayName = string.Empty;
            }
            return(wacConfigData);
        }
Пример #6
0
        // Token: 0x06000356 RID: 854 RVA: 0x0000D224 File Offset: 0x0000B424
        internal void ExecuteApplicationStart(object sender, EventArgs e)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "Global.Application_Start");
            try
            {
                int num = Privileges.RemoveAllExcept(new string[]
                {
                    "SeAuditPrivilege",
                    "SeChangeNotifyPrivilege",
                    "SeCreateGlobalPrivilege",
                    "SeImpersonatePrivilege",
                    "SeIncreaseQuotaPrivilege",
                    "SeAssignPrimaryTokenPrivilege"
                }, "MSExchangeOWAAppPool");
                if (num != 0)
                {
                    throw new OwaWin32Exception(num, "Failed to remove unnecessary privileges");
                }
                if (BaseApplication.IsRunningDfpowa)
                {
                    string          localPath   = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
                    DirectoryInfo[] directories = Directory.GetParent(Directory.GetParent(localPath).FullName).GetDirectories("Config");
                    if (directories.Length > 0)
                    {
                        VariantConfiguration.Initialize(directories[0].FullName);
                    }
                }
                string applicationName = this.IsPreCheckinApp ? "PCDFOWA" : "OWA";
                Globals.InitializeMultiPerfCounterInstance(applicationName);
                Globals.Initialize();
                Kerberos.FlushTicketCache();
                ExRpcModule.Bind();
                this.ExecuteApplicationSpecificStart();
            }
            catch (OwaWin32Exception ex)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <int>(0L, "Application initialization failed with a win32 error: {0}", ex.LastError);
                Globals.InitializationError = ex;
                return;
            }
            catch (Exception initializationError)
            {
                ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed");
                Globals.InitializationError = initializationError;
                throw;
            }
            Globals.IsInitialized = true;
            ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization succeeded");
            int id = Process.GetCurrentProcess().Id;

            if (Globals.IsPreCheckinApp)
            {
                OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_DfpOwaStartedSuccessfully, string.Empty, new object[]
                {
                    id
                });
                return;
            }
            OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaStartedSuccessfully, string.Empty, new object[]
            {
                id
            });
            OwaDiagnostics.PublishMonitoringEventNotification(ExchangeComponent.Owa.Name, "OwaWebAppStarted", "Outlook Web App started successfully", ResultSeverityLevel.Error);
        }