Compare commits
8 Commits
c63a48af6e
...
62d86254ba
Author | SHA1 | Date |
---|---|---|
Tudor Stanciu | 62d86254ba | |
Tudor Stanciu | d8df470ae3 | |
Tudor Stanciu | 359dc5dad1 | |
Tudor Stanciu | e3ca8df153 | |
Tudor Stanciu | a2824fe490 | |
Tudor Stanciu | be8901f6ff | |
Tudor Stanciu | 8b9e064881 | |
Tudor Stanciu | 3b2c485298 |
|
@ -1,7 +1,7 @@
|
|||
<Project>
|
||||
<Import Project="dependencies.props" />
|
||||
<PropertyGroup>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.1.2</Version>
|
||||
<Authors>Tudor Stanciu</Authors>
|
||||
<Company>STA</Company>
|
||||
<PackageTags>NetworkResurrector</PackageTags>
|
||||
|
|
|
@ -59,13 +59,6 @@ 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
|
||||
|
@ -170,7 +163,6 @@ 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.
|
||||
|
||||
### 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.
|
||||
### 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.
|
||||
|
||||
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 local Identity Server.
|
||||
Integration with Tuitio.
|
||||
</Content>
|
||||
</Note>
|
||||
<Note>
|
||||
|
@ -50,4 +50,20 @@
|
|||
• 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,17 +2,16 @@
|
|||
<PropertyGroup Label="Package Versions">
|
||||
<MicrosoftExtensionsPackageVersion>6.0.0</MicrosoftExtensionsPackageVersion>
|
||||
<MicrosoftExtensionsHostingPackageVersion>6.0.1</MicrosoftExtensionsHostingPackageVersion>
|
||||
<SerilogPackageVersion>4.1.0</SerilogPackageVersion>
|
||||
<SerilogExtensionsPackageVersion>3.1.0</SerilogExtensionsPackageVersion>
|
||||
<SerilogPackageVersion>6.1.0</SerilogPackageVersion>
|
||||
<SerilogSinksSeqPackageVersion>5.2.2</SerilogSinksSeqPackageVersion>
|
||||
<SerilogSinksMSSqlServerPackageVersion>5.6.1</SerilogSinksMSSqlServerPackageVersion>
|
||||
<AutoMapperPackageVersion>10.1.1</AutoMapperPackageVersion>
|
||||
<AutoMapperExtensionsPackageVersion>8.1.1</AutoMapperExtensionsPackageVersion>
|
||||
<AutoMapperPackageVersion>12.0.1</AutoMapperPackageVersion>
|
||||
<AutoMapperExtensionsPackageVersion>12.0.0</AutoMapperExtensionsPackageVersion>
|
||||
<MediatRPackageVersion>9.0.0</MediatRPackageVersion>
|
||||
<NBBPackageVersion>6.0.30</NBBPackageVersion>
|
||||
<EntityFrameworkCorePackageVersion>6.0.1</EntityFrameworkCorePackageVersion>
|
||||
<NetmashExtensionsSwaggerPackageVersion>1.0.6</NetmashExtensionsSwaggerPackageVersion>
|
||||
<NetmashSecurityAuthenticationPackageVersion>1.0.8</NetmashSecurityAuthenticationPackageVersion>
|
||||
<NetmashExtensionsSwaggerPackageVersion>1.0.7</NetmashExtensionsSwaggerPackageVersion>
|
||||
<NetmashTuitioAuthenticationPackageVersion>2.0.0</NetmashTuitioAuthenticationPackageVersion>
|
||||
<NetmashDatabaseMigrationPackageVersion>1.2.0</NetmashDatabaseMigrationPackageVersion>
|
||||
<CorreoPublishedLanguage>1.0.1</CorreoPublishedLanguage>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#######################################################################################################################################################
|
||||
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/
|
|
@ -1,13 +0,0 @@
|
|||
#######################################################################################################################################################
|
||||
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
|
||||
#######################################################################################################################################################
|
|
@ -1,18 +0,0 @@
|
|||
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,9 +5,8 @@ using Microsoft.Extensions.Configuration;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Netmash.Extensions.Swagger;
|
||||
using Netmash.Extensions.Swagger.Constants;
|
||||
using Netmash.Security.Authentication.Identity;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
using NetworkResurrector.Agent.Application;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace NetworkResurrector.Agent.Extensions
|
||||
|
@ -16,11 +15,10 @@ namespace NetworkResurrector.Agent.Extensions
|
|||
{
|
||||
public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||
services.AddControllers();
|
||||
|
||||
// Add basic authentication
|
||||
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["BaseAddress"]);
|
||||
|
||||
// MediatR
|
||||
services.AddMediatR(GetMediatRAssemblies());
|
||||
|
@ -32,7 +30,7 @@ namespace NetworkResurrector.Agent.Extensions
|
|||
|
||||
// Swagger
|
||||
var agentCode = configuration.GetValue<string>("Agent:Code");
|
||||
services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.InhouseIdentity);
|
||||
services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.Tuitio);
|
||||
|
||||
// Data access
|
||||
// services.AddDataAccess();
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
<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.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<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"
|
||||
},
|
||||
"IdentityServer": {
|
||||
"Tuitio": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"Restrictions": {
|
||||
|
|
|
@ -5,7 +5,7 @@ using NetworkResurrector.Api.Application.Queries;
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IdentityServer.Api.Controllers
|
||||
namespace NetworkResurrector.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.Identity;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
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.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["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.InhouseIdentity);
|
||||
services.AddSwagger("NetworkResurrector API", AuthorizationType.Tuitio);
|
||||
|
||||
// Add network resurrector server services
|
||||
services.UseResurrectorServices(configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]);
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
<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.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<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.Identity.Constants.ClaimTypes.IsGuestUser)?.Value;
|
||||
var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == Netmash.Security.Authentication.Tuitio.Constants.ClaimTypes.IsGuestUser)?.Value;
|
||||
return !string.IsNullOrEmpty(userIsGuest) && bool.TrueString == userIsGuest;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"Service": {
|
||||
"Code": "NETWORK_RESURRECTOR_API"
|
||||
},
|
||||
"IdentityServer": {
|
||||
"Tuitio": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"NetworkResurrectorServer": {
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
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.Identity;
|
||||
using Netmash.Security.Authentication.Tuitio;
|
||||
using NetworkResurrector.Server.Application;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
@ -22,7 +20,7 @@ namespace NetworkResurrector.Server.Extensions
|
|||
.AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc);
|
||||
|
||||
// Add basic authentication
|
||||
services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]);
|
||||
services.AddTuitioAuthentication(configuration.GetSection("Tuitio")["BaseAddress"]);
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
|
@ -36,7 +34,7 @@ namespace NetworkResurrector.Server.Extensions
|
|||
typeof(Application.Mappings.MappingProfile).Assembly);
|
||||
|
||||
// Swagger
|
||||
services.AddSwagger("NetworkResurrector Server API", AuthorizationType.InhouseIdentity);
|
||||
services.AddSwagger("NetworkResurrector Server API", AuthorizationType.Tuitio);
|
||||
|
||||
// Application
|
||||
services.AddApplicationServices();
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
<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.Identity" Version="$(NetmashSecurityAuthenticationPackageVersion)" />
|
||||
<PackageReference Include="Netmash.Security.Authentication.Tuitio" Version="$(NetmashTuitioAuthenticationPackageVersion)" />
|
||||
<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,6 +59,7 @@ namespace NetworkResurrector.Server
|
|||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "Network resurrector server host terminated unexpectedly");
|
||||
exitCode = 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IdentityServer": {
|
||||
"Tuitio": {
|
||||
"BaseAddress": "http://<host>:<port>/api/"
|
||||
},
|
||||
"WakeOnLan": {
|
||||
|
|
Loading…
Reference in New Issue