Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.4 #36

Merged
merged 4 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Bundle/Discovery.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -30,7 +39,7 @@ public override JobResult ProcessJob(DiscoveryJobConfiguration config, SubmitDis
LogHandlerCommon.Debug(logger, certificateStore, "Getting partitions");
SetPAMSecrets(config.ServerUsername, config.ServerPassword, logger);

F5Client f5 = new F5Client(certificateStore, ServerUserName, ServerPassword, config.UseSSL, string.Empty, new List<PreviousInventoryItem>()) { IgnoreSSLWarning = true };
F5Client f5 = new F5Client(certificateStore, ServerUserName, ServerPassword, config.UseSSL, string.Empty, true, new List<PreviousInventoryItem>());
List<string> partitions = f5.GetPartitions().Select(p => p.name).ToList();

LogHandlerCommon.Trace(logger, certificateStore, $"Found {partitions?.Count} partitions");
Expand Down
11 changes: 10 additions & 1 deletion Bundle/Inventory.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -31,7 +40,7 @@ public override JobResult ProcessJob(InventoryJobConfiguration config, SubmitInv
{
base.ParseJobProperties();
SetPAMSecrets(config.ServerUsername, config.ServerPassword, logger);
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, null, config.LastInventory) { F5Version = base.F5Version, IgnoreSSLWarning = base.IgnoreSSLWarning };
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, null, IgnoreSSLWarning, config.LastInventory) { F5Version = base.F5Version };

LogHandlerCommon.Debug(logger, JobConfig.CertificateStoreDetails, $"Getting inventory for CA Bundle '{config.CertificateStoreDetails.StorePath}'");
inventory = f5.GetCABundleInventory();
Expand Down
14 changes: 11 additions & 3 deletions Bundle/Management.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -39,11 +48,10 @@ public override JobResult ProcessJob(ManagementJobConfiguration config)
base.ParseJobProperties();
base.PrimaryNodeActive();

F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, config.JobCertificate.PrivateKeyPassword, config.LastInventory)
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, config.JobCertificate.PrivateKeyPassword, IgnoreSSLWarning, config.LastInventory)
{
PrimaryNode = base.PrimaryNode,
F5Version = base.F5Version,
IgnoreSSLWarning = base.IgnoreSSLWarning
F5Version = base.F5Version
};

switch (config.OperationType)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.4.1
- Bug Fix: IgnoreSSLWarning was not recognized when set to true
- Modified login API call for token auth to fix issue some users were experiencing

v1.4
- Modified authentication for API calls from Basic to Token Auth. Initial login uses id/password to retrieve temporary access token, so the same id/password credentials are still required for the certificate store, but all subsequent API calls will use the token retrieved on initial login.
- Added PAM Support
Expand Down
9 changes: 9 additions & 0 deletions DiscoveryBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Orchestrators.Extensions;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
Expand Down
14 changes: 12 additions & 2 deletions F5Client.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
using Keyfactor.PKI.X509;
Expand Down Expand Up @@ -43,13 +52,14 @@ internal class F5Client

#region Constructors

public F5Client(CertificateStore certificateStore, string serverUserName, string serverPassword, bool useSSL, string pfxPassword, IEnumerable<PreviousInventoryItem> inventory)
public F5Client(CertificateStore certificateStore, string serverUserName, string serverPassword, bool useSSL, string pfxPassword, bool ignoreSSLWarning, IEnumerable<PreviousInventoryItem> inventory)
{
CertificateStore = certificateStore;
ServerUserName = serverUserName;
ServerPassword = serverPassword;
UseSSL = useSSL;
PFXPassword = pfxPassword;
IgnoreSSLWarning = ignoreSSLWarning;
Inventory = inventory;

if (logger == null)
Expand Down Expand Up @@ -692,7 +702,7 @@ public List<CurrentInventoryItem> GetSSLProfiles(int pageSize)
private string GetToken(string userName, string userPassword)
{
LogHandlerCommon.MethodEntry(logger, CertificateStore, "GetToken");
F5LoginRequest request = new F5LoginRequest() { username = userName, password = userPassword };
F5LoginRequest request = new F5LoginRequest() { username = userName, password = userPassword, loginProviderName = "tmos" };
F5LoginResponse loginResponse = REST.Post<F5LoginResponse>($"/mgmt/shared/authn/login", JsonConvert.SerializeObject(request));
LogHandlerCommon.MethodExit(logger, CertificateStore, "GetToken");

Expand Down
9 changes: 9 additions & 0 deletions F5DataModels.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
9 changes: 9 additions & 0 deletions F5JobBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Orchestrators.Extensions.Interfaces;
using Microsoft.Extensions.Logging;
using System;
Expand Down
6 changes: 3 additions & 3 deletions F5Orchestrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<TargetFramework>netcoreapp3.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Version>12.0</Version>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
<FileVersion>12.0.0.0</FileVersion>
<Version>13.3</Version>
<AssemblyVersion>13.3.0.0</AssemblyVersion>
<FileVersion>13.3.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions InventoryBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Microsoft.Extensions.Logging;
Expand Down
11 changes: 10 additions & 1 deletion ManagementBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Orchestrators.Extensions;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
Expand Down Expand Up @@ -82,7 +91,7 @@ protected void PrimaryNodeActive()

if (PrimaryNodeOnlineRequired)
{
F5Client f5 = new F5Client(JobConfig.CertificateStoreDetails, ServerUserName, ServerPassword, JobConfig.UseSSL, JobConfig.JobCertificate.PrivateKeyPassword, JobConfig.LastInventory)
F5Client f5 = new F5Client(JobConfig.CertificateStoreDetails, ServerUserName, ServerPassword, JobConfig.UseSSL, JobConfig.JobCertificate.PrivateKeyPassword, IgnoreSSLWarning, JobConfig.LastInventory)
{ PrimaryNode = this.PrimaryNode };
if (!f5.PrimaryNodeActive())
{
Expand Down
11 changes: 10 additions & 1 deletion RESTHandler.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -300,7 +309,7 @@ private HttpClientHandler GetHttpClientHandler()
{
HttpClientHandler handler = new HttpClientHandler();
if (IgnoreSSLWarning) { handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; }; }

return handler;
}
}
Expand Down
11 changes: 10 additions & 1 deletion SSLProfile/Discovery.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -31,7 +40,7 @@ public override JobResult ProcessJob(DiscoveryJobConfiguration config, SubmitDis

SetPAMSecrets(config.ServerUsername, config.ServerPassword, logger);

F5Client f5 = new F5Client(certificateStore, ServerUserName, ServerPassword, config.UseSSL, string.Empty, new List<PreviousInventoryItem>()) { IgnoreSSLWarning = true };
F5Client f5 = new F5Client(certificateStore, ServerUserName, ServerPassword, config.UseSSL, string.Empty, true, new List<PreviousInventoryItem>());
List<string> locations = f5.GetPartitions().Select(p => p.name).ToList();

LogHandlerCommon.Debug(logger, certificateStore, $"Submitting {locations?.Count} partitions");
Expand Down
11 changes: 10 additions & 1 deletion SSLProfile/Inventory.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -31,7 +40,7 @@ public override JobResult ProcessJob(InventoryJobConfiguration config, SubmitInv
{
base.ParseJobProperties();
SetPAMSecrets(config.ServerUsername, config.ServerPassword, logger);
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, null, config.LastInventory) { F5Version = base.F5Version, IgnoreSSLWarning = base.IgnoreSSLWarning };
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, null, IgnoreSSLWarning, config.LastInventory) { F5Version = base.F5Version };

LogHandlerCommon.Debug(logger, JobConfig.CertificateStoreDetails, $"Getting inventory from '{config.CertificateStoreDetails.StorePath}'");
inventory = f5.GetSSLProfiles(20);
Expand Down
14 changes: 11 additions & 3 deletions SSLProfile/Management.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Keyfactor.Orchestrators.Common.Enums;
Expand Down Expand Up @@ -38,11 +47,10 @@ public override JobResult ProcessJob(ManagementJobConfiguration config)
base.ParseJobProperties();
base.PrimaryNodeActive();

F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, config.JobCertificate.PrivateKeyPassword, config.LastInventory)
F5Client f5 = new F5Client(config.CertificateStoreDetails, ServerUserName, ServerPassword, config.UseSSL, config.JobCertificate.PrivateKeyPassword, IgnoreSSLWarning, config.LastInventory)
{
PrimaryNode = base.PrimaryNode,
F5Version = base.F5Version,
IgnoreSSLWarning = base.IgnoreSSLWarning
F5Version = base.F5Version
};

switch (config.OperationType)
Expand Down
9 changes: 9 additions & 0 deletions Utilities.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright 2023 Keyfactor
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain a
// copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
// required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either express or implied. See the License for
// thespecific language governing permissions and limitations under the
// License.
using Keyfactor.Logging;
using Keyfactor.Orchestrators.Extensions;
using Microsoft.Extensions.Logging;
Expand Down
Loading
Loading