You guys writing tools and modules for your teams...

How are you managing permissions, for lack of a better word? I've moved quickly from writing myself functions and keeping them in my own profile, to writing cmdlets with better features and handling, more documentation, etc, and putting them in modules. Right now those modules are in use by other members of the 'server' team, but we'll be adding features for desktop support and giving it out to them as well.

Right now I have a module manifest which links in several nested modules as well as runs a 'ScriptsToProcess' ps1. I'd like to preserve the structure, if possible, if only for appearance and continuity reasons. However, its been a little annoying already since my team members have varying permissions in things like Exchange or SQL, so some cmdlets work and others dont (due to dependencies). I'm willing to reorganize these cmdlets into modules based on permission level if i can build a way to load certain modules based on username. Should i go with semi-static values kept in like SQL, CSV or XML, and then run tests for which module to load? I've also considered using the ACLs on the psm1 files themselves as a test, to determine if the file should be loaded or not.

Do you guys have a working system for this?

Posted Sep 22, 2016, 9:33 PM UTC

711
_Unas_•

I would recommend that you setup an internal repository and set permissions there. In addition, if you have AD then you can grant permissions to certain directories or files based on Security Groups. I'm sure each role has their own security groups, use what you already have. If you don't, then well you have other problems. ;)

3
chrish012OP•

Yea, we've been tossing around an idea like this. Obviously we have a lot more going on than just the tools module, so it's a really good idea. We're looking at something called (I think) bonobo. Know anything about that? Or do you have another suggestion?

1
pertymoose•
  • Create a PowerShell Constrained Endpoint
  • Install PowerShell module(s) of choice on server
  • Create a configuration on server
  • Assign the permissions you'd like to grant access to on server
  • Connect to remote endpoint on client
  • Import commands from remote endpoint on client

This is an introduction: http://blog.netwrix.com/2015/02/11/secure-powershell-remoting-using-constrained-endpoints/

This endpoint can also be encrypted and made public, so your people can always access the latest module version.

To my knowledged there's no other way to effectively control who's allowed to run what functions in a module.

3
foobartn•

I've used Jenkins running with a service account for that. Create a task that runs your PowerShell script with parameter options. Then you can give people permission to run certain tasks within Jenkins. Give the service account permission to do the work. The log of who ran what will be kept in Jenkins.

Check out:

https://hodgkins.io/automating-with-jenkins-and-powershell-on-windows-part-1

2
chrish012OP•

Thanks! I took a quick look and I'm not sure if this is what I'm looking for, but I plan to read more.

1
i_me_me•

Honestly, I don't worry about it too much. All I do is make sure all of my functions support -credential properly. If they don't have the rights they can use their firecall if it has the rights.

It sounds like you may be looking for something like setting up constrained endpoints though. Although I'm not well versed in those.

2
chrish012OP•

I guess there are some cmdlets I just don't even want shared. Maybe that's the wrong way to approach it but I'd almost prefer two sets of tools, just hoped to find a slick way to keep them together (but separate).

Thanks for mentioning 'constrained endpoints' btw, led me here, which looks interesting.

2
AnachronisticAdmin•

Git. Bitbucket, Github, something like those. I personally use Bitucket, my company has cloud and on premises instances.

From there, set up separate repositories, forks, and you get complete granular control - i.e., the desktop team can read and pull from certain repos, or even certain parts of certain repos, and it gives you version control when anyone else wants to contribute.

2
hayfever76•

What we do is put the release versions of the scripts in github then have a task scheduler on each server check every 15 minutes for updates.

You do your gut commit to Master and all your buddies can do a pull or wait 15 minutes.

2
[deleted]•

[removed]

1
AutoModeratorMOD•

Sorry, your submission has been automatically removed.

Accounts must be at least 1 day old, which prevents the sub from filling up with bot spam.

Try posting again tomorrow or message the mods to approve your post.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1