forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds random password generation capability to demo config install scr…
…ipts Signed-off-by: Darshit Chanpura <[email protected]>
- Loading branch information
1 parent
bfba97a
commit 0d6999a
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,9 @@ | ||
param ( | ||
[int]$Length = 12 | ||
) | ||
|
||
# Define the character set for the password | ||
$Characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" | ||
|
||
$Password = Get-Random -InputObject $Characters -Count $Length | ||
return $Password |
This file contains 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,12 @@ | ||
#!/bin/bash | ||
|
||
length="$1" | ||
if [ -z "$length" ]; then | ||
length=12 # Default password length | ||
fi | ||
|
||
# Define the character set for the password | ||
characters="A-Za-z0-9" | ||
|
||
# Use /dev/urandom to generate random bytes and tr to shuffle them | ||
LC_ALL=C tr -dc "$characters" < /dev/urandom | head -c "$length" |
This file contains 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 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