Last active
December 29, 2015 03:09
-
-
Save briangreenery/7605842 to your computer and use it in GitHub Desktop.
Set the console user password policy on a linux server
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
#!/bin/sh | |
# The location of the iem tool | |
IEM=/opt/BESServer/bin/iem | |
# The password regex | |
REGEX="A+B+" | |
# The password description | |
DESCRIPTION="Your password needs some As then some Bs" | |
# Create the file that we're going to post to /api/admin/fields | |
cat > post_file << OHANA_MEANS_FAMILY | |
<?xml version="1.0" encoding="UTF-8"?> | |
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd"> | |
<AdminField Resource="http://localhost:52311/api/admin/field/passwordComplexityRegex"> | |
<Name>passwordComplexityRegex</Name> | |
<Value>$REGEX</Value> | |
</AdminField> | |
<AdminField Resource="http://localhost:52311/api/admin/field/passwordComplexityDescription"> | |
<Name>passwordComplexityDescription</Name> | |
<Value>$DESCRIPTION</Value> | |
</AdminField> | |
</BESAPI> | |
OHANA_MEANS_FAMILY | |
# Login to the server | |
$IEM login | |
# Post it to the server | |
$IEM POST post_file admin/fields | |
# Clean up | |
rm -f post_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment