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

Problems on an Ubuntu 20.04 System #35

Closed
Master-Silver opened this issue Sep 11, 2020 · 12 comments · Fixed by #36 or #37
Closed

Problems on an Ubuntu 20.04 System #35

Master-Silver opened this issue Sep 11, 2020 · 12 comments · Fixed by #36 or #37
Assignees
Labels
bug Something isn't working

Comments

@Master-Silver
Copy link

Master-Silver commented Sep 11, 2020

Hi @Xelit3 ,

I tryed to run my app on an Ubuntu 20.04 system with NetCore 3.1. For some reason SecureConfig wants to access appsettings.Development.json over a really weird path and it fails. I´m not sure why it tries to access it all?

Sep 11 10:00:55 gastwlanhost dotnet-example[104045]: Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/var/www/guest-wlan-portal/var/www/guest-wlan-portal/appsettings.Development.json'.
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.File.InternalReadAllText(String path, Encoding encoding)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at System.IO.File.ReadAllText(String path)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at ChustaSoft.Tools.SecureConfig.WritableSettings`1.GetJsonSettingsObject(String physicalPath)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at ChustaSoft.Tools.SecureConfig.WritableSettings`1.IsAlreadyEncrypted()
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at ChustaSoft.Tools.SecureConfig.WebHostExtensions.PerformSettingsEncryption[TSettings](IServiceProvider services, String settingsParamName)
Sep 11 10:00:55 gastwlanhost dotnet-example[104045]:    at ChustaSoft.Tools.SecureConfig.WebHostExtensions.EncryptSettings[TSettings](IHost host, Boolean encrypt, String settingsParamName)
@Master-Silver Master-Silver changed the title Problems on an Ubuntu 20.4 System Problems on an Ubuntu 20.04 System Sep 11, 2020
@xaberue
Copy link
Member

xaberue commented Sep 11, 2020

Hi @Master-Silver !

Let me try to reproduce it and I will revert to you.

Thank you

@xaberue xaberue self-assigned this Sep 11, 2020
@xaberue xaberue added the bug Something isn't working label Sep 11, 2020
@xaberue xaberue added this to To Do in SecureConfig via automation Sep 11, 2020
@xaberue xaberue linked a pull request Sep 11, 2020 that will close this issue
This was referenced Sep 11, 2020
SecureConfig automation moved this from To Do to Resolved Sep 11, 2020
@xaberue xaberue reopened this Sep 11, 2020
@xaberue
Copy link
Member

xaberue commented Sep 11, 2020

Hi @Master-Silver !

Could you please update the package to the latest version [1.2.3] and see if now it works for you?

One unneccssary check regarding Development appSettings was kept from previous versions. This should be the cause of the error, I leave the issue open until your confirmation.

Regards,

@Master-Silver
Copy link
Author

Hi @Xelit3 ,

sorry to report this, but the bug is still there.

Package

Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]: Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/var/www/guest-wlan-portal/var/www/guest-wlan-portal/appsettings.Development.json'.
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.File.InternalReadAllText(String path, Encoding encoding)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at System.IO.File.ReadAllText(String path)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at ChustaSoft.Tools.SecureConfig.WritableSettings`1.GetJsonSettingsObject(String physicalPath)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at ChustaSoft.Tools.SecureConfig.WritableSettings`1.IsAlreadyEncrypted()
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at ChustaSoft.Tools.SecureConfig.WebHostExtensions.PerformSettingsEncryption[TSettings](IServiceProvider services, String settingsParamName)
Sep 14 08:40:03 gastwlanhost guest-wlan-portal[215036]:    at ChustaSoft.Tools.SecureConfig.WebHostExtensions.EncryptSettings[TSettings](IHost host, Boolean encrypt, String settingsParamName)

@xaberue
Copy link
Member

xaberue commented Sep 14, 2020

Hi @Master-Silver , no problem, if it is not working fine should be checked:

Could you please provide me the real path where the appSettings files are?

Sorry for the incoveniences

@Master-Silver
Copy link
Author

@Xelit3 sure, it is /var/www/guest-wlan-portal/appsettings.json

@xaberue
Copy link
Member

xaberue commented Sep 14, 2020

Last question @Master-Silver, is appsettings.Development.json also in the same path? Could you check it please?

I have a hotfix for that, but not reproducible in my own system. I will try to prepare a beta version for you, and If it works well, deploy a release version of that.

Thanks in advance

@Master-Silver
Copy link
Author

Master-Silver commented Sep 14, 2020

@Xelit3 yes it is the same path /var/www/guest-wlan-portal/appsettings.Development.json

@xaberue
Copy link
Member

xaberue commented Sep 14, 2020

Hi @Master-Silver !

Version 1.2.4-beta.1 has been published, could you please try again?

I was able to reproduce it and this package solves the problem, after a hotfix and a better analysis. However, I will wait until your feedback before release the final 1.2.4 version and close the issue

I would like to thank you for your patient, and for reporting it and contribute to improve this tool.

Thanks in advance :)

@xaberue xaberue linked a pull request Sep 14, 2020 that will close this issue
@xaberue
Copy link
Member

xaberue commented Sep 15, 2020

Hi @Master-Silver !

Have it worked the fix? Have you had the opportunity to update it?

Thanks in advance :)

@Master-Silver
Copy link
Author

Master-Silver commented Sep 15, 2020

Looks good. I'm in the middle of rewrites, so I just tested your .NET Core 3.1 example under the same settings I used for my app.

● kestrel-SecureConfigTest.service - Secure Config Test
     Loaded: loaded (/etc/systemd/system/kestrel-SecureConfigTest.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-09-15 10:21:43 UTC; 32min ago
   Main PID: 255563 (dotnet)
      Tasks: 16 (limit: 2282)
     Memory: 23.6M
     CGroup: /system.slice/kestrel-SecureConfigTest.service
             └─255563 /usr/bin/dotnet /var/www/SecureConfigTest/ChustaSoft.Tools.SecureConfig.NetCore3.TestApi.dll

Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]: info: Microsoft.Hosting.Lifetime[0]
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]:       Now listening on: http://localhost:5000
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]: info: Microsoft.Hosting.Lifetime[0]
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]:       Application started. Press Ctrl+C to shut down.
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]: info: Microsoft.Hosting.Lifetime[0]
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]:       Hosting environment: Production
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]: info: Microsoft.Hosting.Lifetime[0]
Sep 15 10:21:44 gastwlanhost Secure-Config-Test[255563]:       Content root path: /var/www/SecureConfigTest
Sep 15 10:22:05 gastwlanhost Secure-Config-Test[255563]: warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Sep 15 10:22:05 gastwlanhost Secure-Config-Test[255563]:       Failed to determine the https port for redirect.

@xaberue
Copy link
Member

xaberue commented Sep 15, 2020

Perfect, I will wait until your last confirmation, then I will publish a release version [1.2.4] and close the issue

Again, thank you a lot for your contribution.

Best regards

@xaberue
Copy link
Member

xaberue commented Sep 19, 2020

Hi @Master-Silver I will proceed to publish the release version since the problem seems to be fixed.

Please do not hesitate to contact us just in case this or another problem appears.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
SecureConfig
  
Resolved
Development

Successfully merging a pull request may close this issue.

2 participants