Compare commits
No commits in common. "62d86254bad4287ab8b3cf743faa124f3be23c6e" and "c63a48af6ef16a656fe28fa02f066bea1fc06dc6" have entirely different histories.
62d86254ba
...
c63a48af6e
|
@ -1,7 +1,7 @@
|
|||
<Project>
|
||||
<Import Project="dependencies.props" />
|
||||
<PropertyGroup>
|
||||
<Version>1.1.2</Version>
|
||||
<Version>1.1.0</Version>
|
||||
<Authors>Tudor Stanciu</Authors>
|
||||
<Company>STA</Company>
|
||||
<PackageTags>NetworkResurrector</PackageTags>
|
||||
|
|
|
@ -59,6 +59,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
|
|||
ReleaseNotes.xml = ReleaseNotes.xml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notes", "notes", "{A28CE618-9D99-491A-8DCF-23D4A19E7750}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
solution items\notes\generic.txt = solution items\notes\generic.txt
|
||||
solution items\notes\nugets.txt = solution items\notes\nugets.txt
|
||||
solution items\notes\proxmox-shutdown-notes.txt = solution items\notes\proxmox-shutdown-notes.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -163,6 +170,7 @@ Global
|
|||
{388D632D-8104-45E2-8017-D04848941F29} = {6889D39C-D8DA-4B99-AFC1-F0B6355E73C0}
|
||||
{1EA9EAD7-8896-4756-A2C2-7969E9073FA6} = {43C78941-52E6-4AB8-9170-CC7C006E4784}
|
||||
{3624DFF4-C692-42F8-BDC2-1C2107E6EDC8} = {C04663A1-E0CD-41D6-A8D7-FADDF9DA8302}
|
||||
{A28CE618-9D99-491A-8DCF-23D4A19E7750} = {C683E36F-A75F-4620-9D4F-2D73EE933AE1}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {351D76E9-FE02-4C30-A464-7B29AFC64BC7}
|
||||
|
|
|
@ -27,8 +27,8 @@ Network Resurrector is a system that comprises of five essential services which
|
|||
* In most cases, the Server component handles the machine startup action while the Agent component manages the machine shutdown action.
|
||||
* As is probably already obvious, the agent can be installed on as many machines as desired.
|
||||
|
||||
### Tuitio
|
||||
* Tuitio is my personal identity server. It manages user authentication within the application and authorizes requests made by it. Further information about Gundo can be found on its dedicated page.
|
||||
### Gundo
|
||||
* Gundo is my personal identity server. It manages user authentication within the application and authorizes requests made by it. Further information about Gundo can be found on its dedicated page.
|
||||
|
||||
All communication between the five main components is done exclusively through HTTP.
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<Version>1.0.2</Version>
|
||||
<Content>
|
||||
Replaced Swagger and MediatR implementations with inhouse nuget packages.
|
||||
Integration with Tuitio.
|
||||
Integration with local Identity Server.
|
||||
</Content>
|
||||
</Note>
|
||||
<Note>
|
||||
|
@ -50,20 +50,4 @@
|
|||
• Added README.md file
|
||||
</Content>
|
||||
</Note>
|
||||
<Note>
|
||||
<Version>1.1.1</Version>
|
||||
<Content>
|
||||
Retouches after the last upgrade
|
||||
• Nuget packages upgrade
|
||||
• Small fixes
|
||||
</Content>
|
||||
</Note>
|
||||
<Note>
|
||||
<Version>1.1.2</Version>
|
||||
<Content>
|
||||
Tuitio latest updates
|
||||
• Tuitio nuget packages upgrade
|
||||
• Tuitio configuration changes
|
||||
</Content>
|
||||
</Note>
|
||||
</ReleaseNotes>
|
|
@ -2,16 +2,17 @@
|
|||
<PropertyGroup Label="Package Versions">
|
||||
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
|
||||
<MicrosoftExtensionsHostingPackageVersion>6.0.1</MicrosoftExtensionsHostingPackageVersion>
|
||||
<SerilogPackageVersion>6.1.0</SerilogPackageVersion>
|
||||
<SerilogPackageVersion>4.1.0</SerilogPackageVersion>
|
||||
<SerilogExtensionsPackageVersion>3.1.0</SerilogExtensionsPackageVersion>
|
||||
<SerilogSinksSeqPackageVersion>5.2.2</SerilogSinksSeqPackageVersion>
|
||||
<SerilogSinksMSSqlServerPackageVersion>5.6.1</SerilogSinksMSSqlServerPackageVersion>
|
||||
<AutoMapperPackageVersion>12.0.1</AutoMapperPackageVersion>
|
||||
<AutoMapperExtensionsPackageVersion>12.0.0</AutoMapperExtensionsPackageVersion>
|
||||
<AutoMapperPackageVersion>10.1.1</AutoMapperPackageVersion>
|
||||
<AutoMapperExtensionsPackageVersion>8.1.1</AutoMapperExtensionsPackageVersion>
|
||||
<MediatRPackageVersion>9.0.0</MediatRPackageVersion>
|
||||
<NBBPackageVersion>6.0.30</NBBPackageVersion>
|
||||
<EntityFrameworkCorePackageVersion>6.0.1</EntityFrameworkCorePackageVersion>
|
||||
<NetmashExtensionsSwaggerPackageVersion>1.0.7</NetmashExtensionsSwaggerPackageVersion>
|
||||
<NetmashTuitioAuthenticationPackageVersion>2.0.0</NetmashTuitioAuthenticationPackageVersion>
|
||||
<NetmashExtensionsSwaggerPackageVersion>1.0.6</NetmashExtensionsSwaggerPackageVersion>
|
||||
<NetmashSecurityAuthenticationPackageVersion>1.0.8</NetmashSecurityAuthenticationPackageVersion>
|
||||
<NetmashDatabaseMigrationPackageVersion>1.2.0</NetmashDatabaseMigrationPackageVersion>
|
||||
<CorreoPublishedLanguage>1.0.1</CorreoPublishedLanguage>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#######################################################################################################################################################
|
||||
Publish:
|
||||
dotnet publish --configuration Release --runtime win7-x64
|
||||
|
||||
Create windows service:
|
||||
sc create NetworkResurrector.Server binPath="<path_to_the_service_executable>"
|
||||
sc create NetworkResurrector.Agent binPath="<path_to_the_service_executable>"
|
||||
#######################################################################################################################################################
|
||||
Resources: https://github.com/nikeee/wake-on-lan
|
||||
|
||||
Multiple Directory.Build.props:
|
||||
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019
|
||||
#######################################################################################################################################################
|
||||
- masinile sunt afisate in ordinea numarului de porniri
|
||||
|
||||
Agent:
|
||||
Win:
|
||||
https://www.programmerall.com/article/5237127008/
|
||||
https://www.programmerall.com/article/6418715755/
|
||||
|
||||
Linux:
|
||||
https://www.programmerall.com/article/3856917681/
|
|
@ -0,0 +1,13 @@
|
|||
#######################################################################################################################################################
|
||||
Push nuget packages:
|
||||
# Create package
|
||||
dotnet pack /*--include-symbols*/
|
||||
|
||||
# Server:
|
||||
dotnet nuget push NetworkResurrector.Server.PublishedLanguage.1.1.0.nupkg -k ****KEY**** -s https://lab.code-rove.com/public-nuget-server/nuget
|
||||
dotnet nuget push NetworkResurrector.Server.Wrapper.1.1.0.nupkg -k ****KEY**** -s https://lab.code-rove.com/public-nuget-server/nuget
|
||||
|
||||
# Agent
|
||||
dotnet nuget push NetworkResurrector.Agent.PublishedLanguage.1.1.0.nupkg -k ****KEY**** -s https://lab.code-rove.com/public-nuget-server/nuget
|
||||
dotnet nuget push NetworkResurrector.Agent.Wrapper.1.1.0.nupkg -k ****KEY**** -s https://lab.code-rove.com/public-nuget-server/nuget
|
||||
#######################################################################################################################################################
|
|
@ -0,0 +1,18 @@
|
|||
Hi Guys
|
||||
So long story short I want to shut down my physical server that is running Proxmox VE using the API. I am fairly new to using API but what I have found thus far is this:
|
||||
curl https://yourip:8006/api2/json//nodes/proxmox/stop -k -d 'username=root@pam&password=yourpassword'
|
||||
Above does not seem to work, Anyone able to assist and just provide the correct curl to use
|
||||
|
||||
Thanx
|
||||
|
||||
!!!!!!!
|
||||
Please don't use the root user for that. It is possible to create a new user, name it "shutdown" or something like that, create a new role like "shutdown", add the "shutdown" role to the "shutdown" user. If you then only give that role the rights to use "Sys.PowerMgmt" that user is only allowed to start/shutdown/reboot the node.
|
||||
Never a good idea to use the root user and its password in clear text. The password could end up in logs if the command fails to execute and so on.
|
||||
|
||||
|
||||
|
||||
URLS:
|
||||
https://pve.proxmox.com/wiki/Proxmox_VE_API
|
||||
https://forum.proxmox.com/threads/shutdown-the-server-via-api.98125/
|
||||
|
||||
https://github.com/Corsinvest/cv4pve-api-dotnet
|
|
@ -5,8 +5,9 @@ using Microsoft.Extensions.Configuration;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Netmash.Extensions.Swagger;
|
||||
using Netmash.Extensions.Swagger.Constants;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
using Netmash.Security.Authentication.Identity;
|
||||
using NetworkResurrector.Agent.Application;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace NetworkResurrector.Agent.Extensions
|
||||
|
@ -15,10 +16,11 @@ namespace NetworkResurrector.Agent.Extensions
|
|||
{
|
||||
public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddControllers();
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||
|
||||
// Add basic authentication
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["BaseAddress"]);
|
||||
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
|
||||
// MediatR
|
||||
services.AddMediatR(GetMediatRAssemblies());
|
||||
|
@ -30,7 +32,7 @@ namespace NetworkResurrector.Agent.Extensions
|
|||
|
||||
// Swagger
|
||||
var agentCode = configuration.GetValue<string>("Agent:Code");
|
||||
services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.Tuitio);
|
||||
services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.InhouseIdentity);
|
||||
|
||||
// Data access
|
||||
// services.AddDataAccess();
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="$(SerilogSinksMSSqlServerPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="$(SerilogSinksSeqPackageVersion)" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapperExtensionsPackageVersion)" />
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"Agent": {
|
||||
"Code": "DEV_AGENT"
|
||||
},
|
||||
"Tuitio": {
|
||||
"IdentityServer": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"Restrictions": {
|
||||
|
|
|
@ -5,7 +5,7 @@ using NetworkResurrector.Api.Application.Queries;
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NetworkResurrector.Api.Controllers
|
||||
namespace IdentityServer.Api.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
|
|
|
@ -7,7 +7,7 @@ using Netmash.Extensions.Swagger;
|
|||
using Netmash.Extensions.Swagger.Constants;
|
||||
using Netmash.Infrastructure.DatabaseMigration;
|
||||
using Netmash.Infrastructure.DatabaseMigration.Constants;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
using Netmash.Security.Authentication.Identity;
|
||||
using NetworkResurrector.Agent.Wrapper;
|
||||
using NetworkResurrector.Api.Application;
|
||||
using NetworkResurrector.Api.Domain.Abstractions;
|
||||
|
@ -26,7 +26,7 @@ namespace NetworkResurrector.Api.Extensions
|
|||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||
|
||||
// Add basic authentication
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["BaseAddress"]);
|
||||
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
|
@ -40,7 +40,7 @@ namespace NetworkResurrector.Api.Extensions
|
|||
services.AddAutoMapper(typeof(Application.Mappings.MappingProfile).Assembly);
|
||||
|
||||
// Swagger
|
||||
services.AddSwagger("NetworkResurrector API", AuthorizationType.Tuitio);
|
||||
services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity);
|
||||
|
||||
// Add network resurrector server services
|
||||
services.UseResurrectorServices(configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]);
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
<PackageReference Include="NBB.Messaging.Nats" Version="$(NBBPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Infrastructure.DatabaseMigration" Version="$(NetmashDatabaseMigrationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="$(SerilogSinksMSSqlServerPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="$(SerilogSinksSeqPackageVersion)" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapperExtensionsPackageVersion)" />
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace NetworkResurrector.Api.Services
|
|||
|
||||
public bool UserIsGuest()
|
||||
{
|
||||
var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == Netmash.Security.Authentication.Tuitio.Constants.ClaimTypes.IsGuestUser)?.Value;
|
||||
var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == Netmash.Security.Authentication.Identity.Constants.ClaimTypes.IsGuestUser)?.Value;
|
||||
return !string.IsNullOrEmpty(userIsGuest) && bool.TrueString == userIsGuest;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"Service": {
|
||||
"Code": "NETWORK_RESURRECTOR_API"
|
||||
},
|
||||
"Tuitio": {
|
||||
"IdentityServer": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"NetworkResurrectorServer": {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
using MediatR;
|
||||
using MediatR.Pipeline;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Netmash.Extensions.Swagger;
|
||||
using Netmash.Extensions.Swagger.Constants;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
using Netmash.Security.Authentication.Identity;
|
||||
using NetworkResurrector.Server.Application;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
@ -20,7 +22,7 @@ namespace NetworkResurrector.Server.Extensions
|
|||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||
|
||||
// Add basic authentication
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["BaseAddress"]);
|
||||
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
|
@ -34,7 +36,7 @@ namespace NetworkResurrector.Server.Extensions
|
|||
typeof(Application.Mappings.MappingProfile).Assembly);
|
||||
|
||||
// Swagger
|
||||
services.AddSwagger("NetworkResurrector Server API", AuthorizationType.Tuitio);
|
||||
services.AddSwagger("NetworkResurrector Server API", AuthorizationType.InhouseIdentity);
|
||||
|
||||
// Application
|
||||
services.AddApplicationServices();
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Extensions.Swagger" Version="$(NetmashExtensionsSwaggerPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="$(SerilogSinksMSSqlServerPackageVersion)" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="$(SerilogSinksSeqPackageVersion)" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapperExtensionsPackageVersion)" />
|
||||
|
|
|
@ -59,7 +59,6 @@ namespace NetworkResurrector.Server
|
|||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "Network resurrector server host terminated unexpectedly");
|
||||
exitCode = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Tuitio": {
|
||||
"IdentityServer": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"WakeOnLan": {
|
||||
|
|
Loading…
Reference in New Issue