Git Product home page Git Product logo

Comments (26)

johlju avatar johlju commented on September 13, 2024 1

An example of an example where this is done is here;

https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlServerDatabaseMail/1-EnableDatabaseMail.ps1

            <#
                NOTE! THIS IS NOT RECOMMENDED IN PRODUCTION.
                This is added so that AppVeyor automatic tests can pass, otherwise
                the tests will fail on passwords being in plain text and not being
                encrypted. Because it is not possible to have a certificate in
                AppVeyor to encrypt the passwords we need to add the parameter
                'PSDscAllowPlainTextPassword'.
                NOTE! THIS IS NOT RECOMMENDED IN PRODUCTION.
            #>
            PSDscAllowPlainTextPassword = $true

The test framework could create a self signed certificate to be able to compile examples and integration tests with a certificate. It would simplify the documentation, and my previous comment would then become obsolete. Instead a work item would be to create a new issue in DscResource.Tests. I personally would rather prefer having closer to real world examples, which would align with the first suggestion in the issue description.

from dscresources.

tysonjhayes avatar tysonjhayes commented on September 13, 2024

👍 Documentation on how to be secure I think is sorely needed with some better ideas put forward on how to manage the infra of SSL keys that are needed.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

I'm all for this 😄

And while we're at it, it would be great to get/include some guidance on the certificate EKU requirements for certificates to be used for DSC credential encryption. It seemed to change in 10586 WMF 5.0 build - the certificate now needs an EKU of Document Encryption (1.3.6.1.4.1.311.80.1). But I couldn't find this documented anywhere. Prior to 10586 the certificate did not require this EKU. Just adding my "nice to haves"!

from dscresources.

Justin-DynamicD avatar Justin-DynamicD commented on September 13, 2024

I'm torn on this one.

While on one hand I completely understand where one is coming from, on the other hand we are introducing a barrier to adoption for someone learning DSC as you are basically requiring them to have PKI certificates "on the ready" or somehow know ahead of time that the examples wont actually run unless they put extra effort in.

I see no problem with leaving examples as "lab worthy only" as that's what they basically are anyway.

As for managing SSL keys .... that's a totally different conversation that is not really specific to modules ... more like "should a pull server be more than an IIS site/SMB share and have some kind of ID management even with just self-signed cert assignment and GUID generation like puppet"? I ended up writing my own modules to handle SSL keys and track GUID <-> Thumbprint mappings in a csv file (shrug).

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@Justin-DynamicD, @tysonjhayes, @PlagueHO
I think option number 2 would handle justin's concern about not requiring people to have PKI on the ready, but also produce the documentation. We could add warnings to the examples that this example is not secure and point to the documentation on how to secure it. This might be easier to maintain as the secure example would be in one place.

from dscresources.

Justin-DynamicD avatar Justin-DynamicD commented on September 13, 2024

@TravisEz13 I think that's a great way to do it. Simply standardize the example folder a bit to include the documentation references.

from dscresources.

tysonjhayes avatar tysonjhayes commented on September 13, 2024

If we move forward with Option 2 (which I am OK with) I would like to see us generate documentaiton on best practices for securing the environment as well as this is something I've struggedled with in maintaining my environment.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

There is also this blog post on DSC credential encryption. Although I think @TravisEz13's one is better as it doesn't muddy the water with discussion of Pull Servers.

It sounds like the best practices and securing the environment as @tysonjhayes says would be a really useful resource for any DSC users (not just users creating/consuming resources).
So, perhaps it would be worth putting this sort of info into the PowerShell-Docs/Dsc documentation (e.g. https://github.com/PowerShell/PowerShell-Docs/blob/master/dsc/configDataCredentials.md) and then specifically linking to it from the examples? As opposed to creating the document in the PowerShell/DSCResources repo.

The documentation could also show how to use self-signed certificates (although not new-selfsignedcertificate) so that someone could get started with credential encryption easily and without a full PKI.

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@PlagueHO @tysonjhayes @Justin-DynamicD
Here are the work items I see. Some of these were settled in other issues.

  • We should create a doc on best practices for securing the environment. The first version could be based on the blog and should be put in PowerShell-Docs/Dsc (this is the proper location because this is a general DSC best practice) documentation (e.g. https://github.com/PowerShell/PowerShell-Docs/blob/master/dsc/configDataCredentials.md)
  • Create a standardize credential example which warns that is not secure and references the documentation.
  • Update the Guidance to say that you should follow the pattern the standardized credential example
  • We need to create documentation on how to properly use self-signed certificates. So that someone could get started with credential encryption easily and without a full PKI. (again this sounds like a general DSC best practice, so it should go in the DSC docs area repo.)

Anyone willing to help with any of these. FYI, I have the GitHub markup for my blog I can share.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@TravisEz13 - thanks for formalizing the work items - that makes things really clear.

I'm not totally clear on what we'd do in regards item 2. So I'm happy to help out on items 1,3 & 4 (and 2 once I had a better idea of what was expected we'd do with it). I could start with item 1 based on your blog markdown - that should be fairly easy as it wouldn't really need to be changed too much from your blog post.

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

I can take item 2. I'll probably start by updating and existing example. Then, we can decide what elements are generic and which are specific. So maybe it has some sub-tasks.

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@PlagueHO, I posted the GitHub MarkDown here: https://gist.github.com/TravisEz13/74ec024ae4cdac0ad165

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

Awesome! Thanks @TravisEz13 - I'll get onto it this weekend.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

Doh! @TravisEz13 - the gist you posted contains the MarkDown for the DSC Single Instance blog post you created (I do need this for the other document I want to create though). But I need the md for this post.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@TravisEz13 - any chance of getting the md for this post off you? 😄

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@PlagueHO It should be here: https://gist.githubusercontent.com/TravisEz13/74ec024ae4cdac0ad165/raw/ccdc47f6a6235a9d60fff30cc9aac068c8a48248/Want%2520to%2520write%2520a%2520DSC%2520resource%2520where%2520only%2520a%2520single%2520instance%2520can%2520be%2520configured%253F.md

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

Thanks @TravisEz13, but that's the SingleInstance one 😄 I'm after the Secure Credentials post.

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@PlagueHO Sorry. I thought I wrote all my DSC blogs in markdown. Apparently not this one. I quickly converted it. The diagram isn't working, but I put the image url, and I'll leave that to you.
Here it is: https://gist.github.com/TravisEz13/dbaa0a915402360c5acc

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

Awesome! Thanks @TravisEz13

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@TravisEz13 - I've submitted a PR containing the conversion of your DSC credential encryption blog post to the PowerShell-Docs repo. Thanks

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@TravisEz13 - @megamorf and I have done some work on the SecureMOF.md to clarify the Self-Signed certificate generation process, so I think that partially covers task number 4.

@megamorf has suggested we work on a document covering Securing DSC within a PKI environment (as a separate document) - which would complete coverage of task number 4.

Work this work for you?

from dscresources.

TravisEz13 avatar TravisEz13 commented on September 13, 2024

@megamorf @PlagueHO you should coordinate with @eslesar as we have been discussing this offline.

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@eslesar - what's the best way to chat with you about what should be done on this? Via a GitHub issue? Gitter?

from dscresources.

PlagueHO avatar PlagueHO commented on September 13, 2024

@eslesar - @megamorf has set up a gitter chatroom for us to discus what we think is required for this document. Would it suit you to jump into it and some point and outline what your requirements/thoughts on this is?
https://gitter.im/megamorf/psdsc-pki-encryption

from dscresources.

johlju avatar johlju commented on September 13, 2024

In this comments work item list I think the text in Securing the MOF File covers 1 and 4. That leaves 2 and 3 in the list, which doesn't seem to been worked on. I can't find anything at least.

  1. Create a standardize credential example which warns that is not secure and references the documentation.
  1. Update the Guidance to say that you should follow the pattern the standardized credential example

from dscresources.

johlju avatar johlju commented on September 13, 2024

PR PowerShell/DscResource.Tests#241 will resolve this, making it possible to have examples and integration test secure by default.

from dscresources.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.