Skip to content

This Powershell Module is a wrapper for the API of Dracoon. Dracoon is a solution for a secure file exchange and can be used as a cloud service or OnPremise for internal uses. Further information about Dracoon can be found at https://www.dracoon.com/.

License

Notifications You must be signed in to change notification settings

Callidus2000/Dracoon

Repository files navigation

Contributors Forks Stargazers Issues GPLv3 License


Dracoon Powershell Module

This Powershell Module is a wrapper for the API of Dracoon
Explore the docs »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

This Powershell Module is a wrapper for the API of Dracoon. Dracoon is a solution for a secure file exchange and can be used as a cloud service or OnPremise for internal uses. Further information about Dracoon can be found at https://www.dracoon.com/.

The API is very well documented with swagger, documentation can either be found at https://dracoon.team/api/ or (for your custom installation) at https://yourdomain.com/api/.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

All prerequisites will be installed automatically.

Installation

The releases are published in the Powershell Gallery, therefor it is quite simple:

Install-Module Dracoon -Force -AllowClobber

The AllowClobber option is currently neccessary because of an issue in the current PowerShellGet module. Hopefully it will not be needed in the future any more.

Usage

The module is a wrapper for the Dracoon API. As you have to authenticate with OAuth2.0 it is necessary to create a client application within the admin web-page. For this

  • Go to System Settings / Apps in the navigation bar
  • Click on the Add app button
  • Enter an application name (e.g. "Powershell Scripting")
  • enable all 4 checkboxes (authorization code:implicit:password:refresh token)
  • Copy the Client ID and the Client Secret. Both will be referenced as $ClientID and $ClientSecret.

If the Application "DRACOON Legacy Scripting Support" is activated you can use dracoon_legacy_scripting as ClientID and omit the ClientSecret.

Now it's time to open the powershell. Prepare the basic variables:

$cred=Get-Credential -Message "Dracoon"
$clientId="YOU JUST CREATED IT ;-)"
$clientSecret="THIS ALSO"
$url="dracoon.mydomain.com"

From here you have multiple possibilities to connect to your server and store the connection for further usage:

Direct auth with /auth/login (Deprecated)

If you are running an older version it maybe possible to login directly. But this option is deprecated and will be removed in every installation in the future

$connection=Connect-Dracoon -Url $url -Credential $cred

Via OAuth access token

# Generate accesstoken
$accessToken=Request-DracoonOAuthToken -ClientID $clientId -ClientSecret $clientSecret -Url $url -Credential $cred -TokenType access
# Login with created access token
$connection=Connect-Dracoon -Url $url -AccessToken $accessToken

Via OAuth refresh token

# Create a refresh token
$refreshToken=Request-DracoonOAuthToken -ClientID $clientId -ClientSecret $clientSecret -Credential $cred -url $url -TokenType refresh

# Connect directly with the refresh token
$connection=Connect-Dracoon -ClientID $clientId -ClientSecret $clientSecret -url $url -RefreshToken $refreshToken

# Second option: Create an access token from the refreh token and login with the access token.
$accessToken=Request-DracoonOAuthToken -ClientID $clientId -ClientSecret $clientSecret -Url $url -RefreshToken $refreshToken
$connection=Connect-Dracoon -Url $url -AccessToken $accessToken

Now we are connected to your server: What can we do?

# Query all Users and display the data in a table
Get-DracoonUser -Connection $connection |ft

# Query a specific user (you have to know the login)
Get-DracoonUser -Connection $connection -Filter 'login:cn:DonaldDuck'

#Find all locked accounts and remove the users (Luckily it supports WhatIf)
Get-DracoonUser -Connection $connection -Filter 'isLocked:eq:true' |Remove-DracoonUser -connection $connection -WhatIf

If you need an overview of the existing commands use

# List available commands
Get-Command -Module Dracoon
#Get-Help for a specific command
Get-Help -Detailed Get-DracoonUser

everything else is documented in the module itself.

Tab completion

Are you tired of typing the URL of your Server? Do you have multiple instances? Add the possible URLs to the Tab Completer:

Add-DracoonURL "myserver.com"

Now give it a try and hit TAB after any -Url Parameter. You can now choose between all previously saved server addresses.

The same mechanism kicks in for the '-Filter' parameters:

Get-DracoonUser -Connection $connection -Filter [TAB]
effectiveRoles:eq:[true or false]  firstName:cn:[search String]
isLocked:eq:[true or false]        lastName:cn:[search String]
login:cn:[search String]

New Feature: Usage of Auto-Generated functions

Since version 1.5.0 the module contains functions for ALL API endpoints. This was made possible with the help of Fred's AutoRest-Module. All the AutoRest functions

  • are provided as-is
    • no support from my side
    • not tested or monitored by the pester tests
  • are stored in an internal module Folder
  • have the modulePrefix DracoonAR
  • have to be manually activated before module usage (use Enable-DracoonAutoRest).

Enable Auto-Generated functions before module import

If you want to enable the functions before module import you can use the following code:

#For the current session
Set-PSFConfig -Module 'Dracoon' -Name 'enableAutoRest' -Value $true -PassThru

#Enabled as default
Set-PSFConfig -Module 'Dracoon' -Name 'enableAutoRest' -Value $true -PassThru | Register-PSFConfig -Scope UserDefault

Roadmap

New features will be added if any of my scripts need it ;-)

See the open issues for a list of proposed features (and known issues).

If you need a special function feel free to contribute to the project.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. For more details please take a look at the CONTRIBUTE document

Short stop:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Limitations

  • The module only works for unencrypted Datarooms. Simple reason: Our instances do not use the 'Client-side Encryption' feature. If your instance does provide it feel free to add the feature to the module.

License

Distributed under the GNU GENERAL PUBLIC LICENSE version 3. See LICENSE.md for more information.

Contact

Project Link: https://github.com/Callidus2000/Dracoon

Acknowledgements

About

This Powershell Module is a wrapper for the API of Dracoon. Dracoon is a solution for a secure file exchange and can be used as a cloud service or OnPremise for internal uses. Further information about Dracoon can be found at https://www.dracoon.com/.

Resources

License

Stars

Watchers

Forks

Packages

No packages published