Dependency Configuration File - Regex

Root > Secret Server
With version 7.8.00010 (and later), Secret Server allows a Secret to have file dependencies. File dependencies allow text files with embedded credentials to be changed via Regex.

A Regular Expression (Regex) is a phrase in a language for matching text. For details on the .NET Regex language, see this site: http://msdn.microsoft.com/en-us/library/hs600312%28v=VS.85%29.aspx

The forum at http://regexadvice.com/forums/68/ShowForum.aspx has many members who are happy to provide Regex assistance. Also, Thycotic Support can assist with particularly difficult Regex.

Secret Server will replace the contents of the first group within the Regex.

Some examples of using Regex within File dependencies are below.

XML Config files
<Configuration>
    <User>
        <UserName>Bob</UserName>
        <Password>Password1</Password>
    </User>
    <User>
        <UserName>Sam</UserName>
        <Password>DontChangeThisOne</Password>
    </User>
</Configuration>

Regex: <UserName>Bob</UserName>\s*<Password>([^<]+)</Password>
<Configuration>
    <User name="Bob" password="Password1" />
    <User name="John" password="Password1" />
</Configuration>

Regex: <User name="Bob" password="([^"]+)" />
INI Files
[owner]
name=John Doe
password=Password1
organization=Acme Widgets Inc.

Regex: name=John\sDoe\s*password=([^\r\n]+)
SQL Server Connection Strings
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;

Regex: Password=([^;]+)
Oracle Connection String
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;

Regex: Password=([^;]+)
Oracle Connection String
Data Source=username/password@//myserver:1521/my.service.com;

Regex: username/([^@/]+)
YAML
receipt:     Oz-Ware Purchase Invoice
date:        2007-08-06
user:
name:   Dorothy
password:  Password1
    
    
Regex: name:\s*Dorothy\s*password:\s*([^\r\n]+)

Add Feedback