{"action":"created","issue":{"url":"https://api.github.com/repos/condep/condep-node/issues/1","repository_url":"https://api.github.com/repos/condep/condep-node","labels_url":"https://api.github.com/repos/condep/condep-node/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/condep/condep-node/issues/1/comments","events_url":"https://api.github.com/repos/condep/condep-node/issues/1/events","html_url":"https://github.com/condep/condep-node/issues/1","id":141872531,"number":1,"title":"Old Certificate not being removed resulting in errors during deployment","user":{"login":"rubenmamo","id":7700562,"avatar_url":"https://avatars.githubusercontent.com/u/7700562?v=3","gravatar_id":"","url":"https://api.github.com/users/rubenmamo","html_url":"https://github.com/rubenmamo","followers_url":"https://api.github.com/users/rubenmamo/followers","following_url":"https://api.github.com/users/rubenmamo/following{/other_user}","gists_url":"https://api.github.com/users/rubenmamo/gists{/gist_id}","starred_url":"https://api.github.com/users/rubenmamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubenmamo/subscriptions","organizations_url":"https://api.github.com/users/rubenmamo/orgs","repos_url":"https://api.github.com/users/rubenmamo/repos","events_url":"https://api.github.com/users/rubenmamo/events{/privacy}","received_events_url":"https://api.github.com/users/rubenmamo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-03-18T13:52:07Z","updated_at":"2016-10-20T14:49:17Z","closed_at":null,"body":"It's been a year since we started to use ConDep on our production environment and now we're getting errors when trying to deploy applications related to the certificate that Condep Node uses to secure the api.\r\n\r\nThe error we're getting is\r\n```\r\nStep 1/1: Deploy (Command Line) (25s)\r\n[14:43:54][Step 1/1] Executing pre-operations (6s)\r\n[14:43:54][Executing pre-operations] *******(6s)\r\n[14:43:54][*******] Pre-Operations (6s)\r\n[14:43:55][Pre-Operations] Validating ConDepNode (6s)\r\n[14:44:01]\r\n[Validating ConDepNode] Failed to connect to ConDep Node!\r\nMessage: One or more errors occurred.\r\n\r\nStack Trace:\r\n   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n   at System.Threading.Tasks.Task`1.get_Result()\r\n   at ConDep.Dsl.Remote.Node.Api.Validate()\r\n[14:44:01]\r\n[Validating ConDepNode] Failed to connect to ConDep Node!\r\nMessage: One or more errors occurred.\r\n\r\nStack Trace:\r\n   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n   at System.Threading.Tasks.Task`1.get_Result()\r\n   at ConDep.Dsl.Remote.Node.Api.Validate()\r\n[14:44:01]\r\n[Step 1/1] ConDep execution failed.\r\nMessage: Unable to make contact with ConDep Node or return content from API.\r\n\r\nStack Trace:\r\n   at ConDep.Dsl.PreRemoteOps.<>c__DisplayClass18.<PublishConDepNode>b__17()\r\n   at ConDep.Dsl.Logging.Logger.WithLogSection(String sectionName, Action action)\r\n   at ConDep.Dsl.PreRemoteOps.PublishConDepNode(ServerConfig server, ConDepSettings settings)\r\n   at ConDep.Dsl.PreRemoteOps.<>c__DisplayClass3.<Execute>b__0()\r\n   at ConDep.Dsl.Logging.Logger.WithLogSection(String sectionName, Action action)\r\n   at ConDep.Dsl.PreRemoteOps.Execute(ServerConfig server, IReportStatus status, ConDepSettings settings, CancellationToken token)\r\n   at ConDep.Dsl.Execution.ConDepConfigurationExecutor.<>c__DisplayClass10.<>c__DisplayClass13.<ExecutePreOps>b__f()\r\n   at ConDep.Dsl.Logging.Logger.WithLogSection(String sectionName, Action action)\r\n   at ConDep.Dsl.Execution.ConDepConfigurationExecutor.<>c__DisplayClass10.<ExecutePreOps>b__e()\r\n   at ConDep.Dsl.Logging.Logger.WithLogSection(String sectionName, Action action)\r\n   at ConDep.Dsl.Execution.ConDepConfigurationExecutor.ExecutePreOps(ConDepSettings conDepSettings, IReportStatus status, CancellationToken token)\r\n   at ConDep.Dsl.Execution.ConDepConfigurationExecutor.Execute(ConDepSettings settings, IValidateClient clientValidator, IValidateServer serverValidator, ExecutionSequenceManager execManager, CancellationToken token)\r\n[14:44:01][Step 1/1] Step Deploy (Command Line) failed\r\n```\r\n\r\nWhen I try to access https://******:4444/ConDepNode/api and check the certificate I find that the certificate validity dates have elapsed. For some reason the code that deletes the old certificates is not managing to execute correctly.\r\n\r\nSo far in order to resolve this issue I have created a small console application with the code from HttpApiSslCert.cs, X509CertBuilder.cs, CertificateHandler.cs. \r\nI then changed the code for ConfigureSslCert as follows:\r\n```csharp\r\n        public static void ConfigureSslCert(string url)\r\n        {\r\n            var certStore = new X509Store(StoreLocation.LocalMachine);\r\n\r\n            try\r\n            {\r\n                certStore.Open(OpenFlags.ReadWrite);\r\n\r\n                CleanOldCerts(certStore);\r\n                /*\r\n                X509Certificate2 cert;\r\n\r\n                if (!CertificateExist(certStore, out cert))\r\n                {\r\n                    cert = AddCertificate(certStore);\r\n                }\r\n\r\n                if (!CertificateBoundToIpAndPort(url, cert.GetCertHash()))\r\n                {\r\n                    BindCertificateToIpAndPort(cert, url);\r\n                }*/\r\n            }\r\n            finally\r\n            {\r\n                certStore.Close();\r\n            }\r\n        }\r\n```\r\n\r\nand run it on the server using an administrator user. Once I do this and try to deploy again the app gets deployed correctly.\r\n\r\nI'm not sure why the node is not removing the old certificates, I suspect it might be a rights issue, however I'm not sure how to confirm this. Have you seen this anywhere else?\r\n\r\nWould it make sense that instead of deleting the old certificates, the node selects one which is valid for the current date?\r\n"},"comment":{"url":"https://api.github.com/repos/condep/condep-node/issues/comments/255128171","html_url":"https://github.com/condep/condep-node/issues/1#issuecomment-255128171","issue_url":"https://api.github.com/repos/condep/condep-node/issues/1","id":255128171,"user":{"login":"rubenmamo","id":7700562,"avatar_url":"https://avatars.githubusercontent.com/u/7700562?v=3","gravatar_id":"","url":"https://api.github.com/users/rubenmamo","html_url":"https://github.com/rubenmamo","followers_url":"https://api.github.com/users/rubenmamo/followers","following_url":"https://api.github.com/users/rubenmamo/following{/other_user}","gists_url":"https://api.github.com/users/rubenmamo/gists{/gist_id}","starred_url":"https://api.github.com/users/rubenmamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubenmamo/subscriptions","organizations_url":"https://api.github.com/users/rubenmamo/orgs","repos_url":"https://api.github.com/users/rubenmamo/repos","events_url":"https://api.github.com/users/rubenmamo/events{/privacy}","received_events_url":"https://api.github.com/users/rubenmamo/received_events","type":"User","site_admin":false},"created_at":"2016-10-20T14:49:17Z","updated_at":"2016-10-20T14:49:17Z","body":"Hi, I just encountered this issue again. Was this fixed?"}}
{"actor":{"display_login":"rubenmamo"}}