-
Notifications
You must be signed in to change notification settings - Fork 0
Slot access code management #165
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd3d7eb
Slot access code draft
JMarkstrom 9ce73bd
Change to accept 12 char access code and convert to 6 byte array.
JMarkstrom f76bcf4
Added catch on exception where a code is already set.
JMarkstrom 41e2ac5
Added logic to clear slot when protected by slot access code.
JMarkstrom 676999c
Added detection and errors for current access code.
JMarkstrom 6a82e98
Added logic to set and use current access code.
JMarkstrom 135f534
FIxes to slot access code such that it does not overwrite configuration.
JMarkstrom 8bdb285
fix formating
virot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| --- | ||
| external help file: powershellYK.dll-Help.xml | ||
| Module Name: powershellYK | ||
| online version: | ||
| schema: 2.0.0 | ||
| --- | ||
|
|
||
| # Set-YubiKeyOTPSlotAccessCode | ||
|
|
||
| ## SYNOPSIS | ||
| Sets, changes or removes the OTP slot access code for a YubiKey. | ||
| he access code protects OTP slot configurations from unauthorized modifications. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ### SetNewAccessCode | ||
| ``` | ||
| Set-YubiKeyOTPSlotAccessCode -Slot <Slot> [-AccessCode <String>] [-WhatIf] [-Confirm] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### ChangeAccessCode | ||
| ``` | ||
| Set-YubiKeyOTPSlotAccessCode -Slot <Slot> -AccessCode <String> -CurrentAccessCode <String> [-WhatIf] [-Confirm] | ||
| [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ### RemoveAccessCode | ||
| ``` | ||
| Set-YubiKeyOTPSlotAccessCode -Slot <Slot> -CurrentAccessCode <String> [-RemoveAccessCode] [-WhatIf] [-Confirm] | ||
| [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
| Sets, changes or removes the OTP slot access code for a YubiKey. | ||
| The access code protects OTP slot configurations from unauthorized modifications. | ||
| Access codes are 6 bytes in length, provided as 12-character hex strings. | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1 | ||
| ```powershell | ||
| PS C:\> Set-YubiKeySlotAccessCode -Slot LongPress -AccessCode "010203040506" | ||
| ``` | ||
|
|
||
| Set a new access code for a slot (when no access code exists) | ||
|
|
||
| ### Example 2 | ||
| ```powershell | ||
| PS C:\> Set-YubiKeyOTPSlotAccessCode -Slot ShortPress -CurrentAccessCode "010203040506" -AccessCode "060504030201" | ||
| ``` | ||
|
|
||
| Change an existing slot access code | ||
|
|
||
| ### Example 3 | ||
| ```powershell | ||
| PS C:\> Set-YubiKeyOTPSlotAccessCode -Slot LongPress -CurrentAccessCode "010203040506" -RemoveAccessCode | ||
| ``` | ||
|
|
||
| Remove slot access code protection (set to all zeros) | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| ### -AccessCode | ||
| New access code (12-character hex string) | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: SetNewAccessCode | ||
| Aliases: | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: ChangeAccessCode | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -CurrentAccessCode | ||
| Current access code (12-character hex string) | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: ChangeAccessCode, RemoveAccessCode | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -RemoveAccessCode | ||
| Remove access code protection | ||
|
|
||
| ```yaml | ||
| Type: SwitchParameter | ||
| Parameter Sets: RemoveAccessCode | ||
| Aliases: | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Slot | ||
| Yubikey OTP Slot | ||
|
|
||
| ```yaml | ||
| Type: Slot | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
| Accepted values: None, ShortPress, LongPress | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Confirm | ||
| Prompts you for confirmation before running the cmdlet. | ||
|
|
||
| ```yaml | ||
| Type: SwitchParameter | ||
| Parameter Sets: (All) | ||
| Aliases: cf | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -WhatIf | ||
| Shows what would happen if the cmdlet runs. | ||
| The cmdlet is not run. | ||
|
|
||
| ```yaml | ||
| Type: SwitchParameter | ||
| Parameter Sets: (All) | ||
| Aliases: wi | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### CommonParameters | ||
| This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
|
||
| ## INPUTS | ||
|
|
||
| ### None | ||
|
|
||
| ## OUTPUTS | ||
|
|
||
| ### System.Object | ||
| ## NOTES | ||
|
|
||
| ## RELATED LINKS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was commented out because the error is indistinguishable from the error on successful operation (issue #182). I have asked Yubico to prioritize that defect.