Skip to content

Instantly share code, notes, and snippets.

@briangreenery
Last active December 29, 2015 03:09
Show Gist options
  • Save briangreenery/7605842 to your computer and use it in GitHub Desktop.
Save briangreenery/7605842 to your computer and use it in GitHub Desktop.
Set the console user password policy on a linux server
#!/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