-
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.
- Loading branch information
0 parents
commit 8669b57
Showing
17 changed files
with
2,017 additions
and
0 deletions.
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,17 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
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,45 @@ | ||
/target/ | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
|
||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
nbactions.xml | ||
nb-configuration.xml | ||
.nb-gradle/ | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
|
||
Beskrivning.txt |
Large diffs are not rendered by default.
Oops, something went wrong.
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,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>LDIFCompare</title> | ||
</head> | ||
|
||
<body> | ||
<!-- ### --><h1>LDIFCompare</h1> | ||
<blockquote><p>A tool based on the UnboundID LDAP SDK library that can be used to compare two LDIF files and output the differences.</p> | ||
</blockquote><h1>Requirements</h1> | ||
<ul> | ||
<li>Java 8u40 or newer</li> | ||
<li>UnboundID LDAP SDK</li> | ||
<li>SLF4J</li> | ||
</ul><h1>Instructions</h1><p>For help run: <code>java -jar LDIFCompare-1.0-SNAPSHOT.jar --help</code></p><h1>Example scenario</h1><p>Let's say you are about to perform some kind of operation on a couple of thousand accounts in an LDAP directory using an automated provision tool and you want to make sure that you have not caused any unintended consequences by accidently modifying attributes or objects that are not in the scope of your operation.</p> | ||
<ul> | ||
<li>The basic idea is to take a snapshot of the directory before your operation by doing an LDIF export.</li> | ||
<li>Then you take another snapshot after the operation has taken place by doing another LDIF export.</li> | ||
<li>Use your favorite diff tool to compare the two LDIF files and figure out why they diff and if the diff is important or not.</li> | ||
</ul><p>LDIFCompare allows you to compare LDIF files and specify which attributes you want to ignore when comparing, for example you might not be interested if the <code>logonTime</code> attribute has changed.</p><h1>Concepts</h1><p>I have chosen to call the file that contains the original pre-operation snapshot for the "left" file and the post-operation snapshot for the "right" file.</p><p>Imagine the two LDIF files side by side on your screen. - The pre-operation file is called the left file. - The post-operation file is called the right file.</p><p>Using a properties file with the property "ignore-attributes" you can specify which attributes to ignore while comparing. During processing all attributes specified in "ignore-attributes" will be removed from both entries before being compared and before the results are written to files. For examples see the <code>doc\ldifcompare.properties</code> file.</p><h1>Output</h1><p>After processing you will get a number of result files.</p><p>It will output five files: Each file is prefixed with the date and time of the operation in the following format: yyyy-MM-dd HHmmss</p> | ||
<ul> | ||
<li>-diff.ldif, contains the entire LDIF record of the entries from the "right" file that don't match the corresponding entry from the "left" file.</li> | ||
<li>-change_records.txt, contains the modifications that must be performed on an entry from the "left" file to match the entry from the "right" file.</li> | ||
<li>-reverse-change_records.txt, contains the the modifications that must be performed on an entry from the "right" file to match the entry from the "left" file.</li> | ||
<li>-unique-<left file name>.ldif, contains the entries that only exist in the "left" file.</li> | ||
<li>-unique-<right file name>.ldif, contains the entries that only exist in the "right" file.</li> | ||
</ul><h1>Example usage</h1><p>Let's say you have two files you want to compare, the original "left" file and the post-operation "right" file.</p><p>You would execute the following command to compare them:</p><p><code>java -jar LDIFCompare-1.0.jar --ldifLeft ./left.ldif --ldifRight ./right.ldif --output /path/to/outputdirectory --properties ./ldifcompare.properties</code></p><p>The <code>ldifcompare.properties</code> file must contains one property called <code>ignore-attributes=attr1,attr2</code>. The values of the property are the names of the attributes to ignore when comparing, separated with a comma. For an example see the <code>doc/ldifcompare.properties</code> file. In the example above you would replace attr1,attr2 with the actual attribute names.</p><p>During a compare the DN is used to match entries between two LDIF-files, if an entry is moved, deleted or renamed then you won't get a match.</p><p>If you want to use an attribute instead of the DN to match two entries then you can do that by specifying the following property in the properties file: <em>match-attribute=nameOfAttribute</em></p><h1>Limitations</h1><p>Handles only LDIF files containing content records or add records. Modify records and other changetypes are not supported.</p> | ||
</body> | ||
|
||
</html> |
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,81 @@ | ||
# LDIFCompare | ||
|
||
> A tool based on the UnboundID LDAP SDK library that can be used to compare two LDIF files and output the differences. | ||
# Requirements | ||
|
||
- Java 8u40 or newer | ||
- UnboundID LDAP SDK | ||
- SLF4J | ||
|
||
# Instructions | ||
|
||
For help run: | ||
`java -jar LDIFCompare-1.0-SNAPSHOT.jar --help` | ||
|
||
# Example scenario | ||
|
||
Let's say you are about to perform some kind of operation on a couple of thousand | ||
accounts in an LDAP directory using an automated provision tool and you want to make | ||
sure that you have not caused any unintended consequences by accidently modifying | ||
attributes or objects that are not in the scope of your operation. | ||
|
||
- The basic idea is to take a snapshot of the directory before your operation by doing an LDIF export. | ||
- Then you take another snapshot after the operation has taken place by doing another LDIF export. | ||
- Use your favorite diff tool to compare the two LDIF files and figure out why they diff and if the diff is important or not. | ||
|
||
LDIFCompare allows you to compare LDIF files and specify which attributes you | ||
want to ignore when comparing, for example you might not be interested if the | ||
`logonTime` attribute has changed. | ||
|
||
# Concepts | ||
|
||
I have chosen to call the file that contains the original pre-operation snapshot for the "left" file and the post-operation snapshot for the "right" file. | ||
|
||
Imagine the two LDIF files side by side on your screen. | ||
- The pre-operation file is called the left file. | ||
- The post-operation file is called the right file. | ||
|
||
Using a properties file with the property "ignore-attributes" you can specify which attributes to ignore while comparing. | ||
During processing all attributes specified in "ignore-attributes" will be removed from both entries before being compared and before the results are written to files. | ||
For examples see the `doc\ldifcompare.properties` file. | ||
|
||
# Output | ||
|
||
After processing you will get a number of result files. | ||
|
||
It will output five files: | ||
Each file is prefixed with the date and time of the operation in the following format: | ||
yyyy-MM-dd HHmmss | ||
|
||
- -diff.ldif, contains the entire LDIF record of the entries from the "right" file that don't match the corresponding entry from the "left" file. | ||
- -change_records.txt, contains the modifications that must be performed on an entry from the "left" file to match the entry from the "right" file. | ||
- -reverse-change_records.txt, contains the the modifications that must be performed on an entry from the "right" file to match the entry from the "left" file. | ||
- -unique-\<left file name>.ldif, contains the entries that only exist in the "left" file. | ||
- -unique-\<right file name>.ldif, contains the entries that only exist in the "right" file. | ||
|
||
# Example usage | ||
|
||
Let's say you have two files you want to compare, the original "left" file and the post-operation "right" file. | ||
|
||
You would execute the following command to compare them: | ||
|
||
`java -jar LDIFCompare-1.0.jar --ldifLeft ./left.ldif --ldifRight ./right.ldif --output /path/to/outputdirectory --properties ./ldifcompare.properties` | ||
|
||
The `ldifcompare.properties` file must contains one property called `ignore-attributes=attr1,attr2`. | ||
The values of the property are the names of the attributes to ignore when comparing, separated with a comma. | ||
For an example see the `doc/ldifcompare.properties` file. | ||
In the example above you would replace attr1,attr2 with the actual attribute names. | ||
|
||
During a compare the DN is used to match entries between two LDIF-files, if an entry is moved, deleted or renamed then you won't get a match. | ||
|
||
If you want to use an attribute instead of the DN to match two entries then you can do that by specifying the following property in the properties file: | ||
*match-attribute=nameOfAttribute* | ||
|
||
# Limitations | ||
|
||
Handles only LDIF files containing content records or add records. Modify records and other changetypes are not supported. | ||
|
||
# License | ||
|
||
[GPL v3.0](http://www.gnu.org/licenses/gpl-3.0.txt) |
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,2 @@ | ||
ignore-attributes=objectClass,lastLogoff,lastLogon,lastLogonTimestamp,logonCount,msDS-AuthenticatedAtDC,msDS-FailedInteractiveLogonCount,msDS-FailedInteractiveLogonCountAtLastSuccessfulLogon,msDS-FailedInteractiveLogonTime,msDS-LastSuccessfulInteractiveLogonTime,whenChanged,DirXML-Associations,ACL | ||
#match-attribute=cn |
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,38 @@ | ||
version: 1 | ||
|
||
dn: cn=Rolf Nilsson,ou=Users,o=Meta | ||
objectClass: inetOrgPerson | ||
givenName: Rolf | ||
sn: Nilsson | ||
cn: Rolf Nilsson | ||
uid: ronil | ||
title: Midsommarfirare | ||
lastLogon: 20150606123100Z | ||
|
||
dn: cn=Jan Fredriksson,ou=Users,o=Meta | ||
objectClass: inetOrgPerson | ||
givenName: Jan | ||
sn: Fredriksson | ||
cn: Jan Fredriksson | ||
uid: jafre | ||
title: Inskaffare av diverse drick | ||
lastLogon: 20140602123100Z | ||
|
||
dn: cn=Rick Per,ou=Users,o=Meta | ||
objectClass: user | ||
givenName: Peter | ||
sn: Per | ||
cn: Rick Per | ||
uid: peper | ||
title: En glad deltagare | ||
lastLogon: 20130203143100Z | ||
|
||
dn: cn=Andreas Svensson,ou=Users,o=Meta | ||
objectClass: user | ||
givenName: Andreas | ||
sn: Sven | ||
uid: ansvensson | ||
cn: Andreas Svensson | ||
title: Festgeneral | ||
lastLogon: 20150618090000Z | ||
|
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,37 @@ | ||
version: 1 | ||
|
||
dn: cn=Rolf Nilsson,ou=Users,o=Meta | ||
objectClass: inetOrgPerson | ||
givenName: Roffe | ||
sn: Nilsson | ||
cn: Rolf Nilsson | ||
uid: ronil | ||
title: Ex. Midsommarfirare | ||
lastLogon: 20150618123100Z | ||
|
||
dn: cn=Jan Fredriksson,ou=Users,o=Meta | ||
objectClass: inetOrgPerson | ||
givenName: Jan | ||
sn: Fredriksson | ||
cn: Jan Fredriksson | ||
uid: jafre | ||
title: Inskaffare av diverse drick | ||
lastLogon: 20150613123100Z | ||
|
||
dn: cn=Andreas Svensson,ou=Users,o=Meta | ||
objectClass: user | ||
givenName: Andreas | ||
sn: Sven | ||
uid: ansvensson | ||
cn: Andreas Svensson | ||
title: Festgeneral | ||
lastLogon: 20150618090000Z | ||
|
||
dn: cn=Nils Svensson,ou=Users,o=Meta | ||
objectClass: inetOrgPerson | ||
givenName: Nils | ||
sn: Sven | ||
uid: nisve | ||
cn: Nils Svensson | ||
title: Festgeneral | ||
userPassword: myPassword |
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,4 @@ | ||
|
||
</body> | ||
|
||
</html> |
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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="ISO-8859-15"> | ||
<title>LDIFCompare</title> | ||
</head> | ||
|
||
<body> | ||
<!-- ### --> |
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,90 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>se.idsecurity.LdifCompare</groupId> | ||
<artifactId>se.idsecurity.LdifCompare</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.unboundid</groupId> | ||
<artifactId>unboundid-ldapsdk</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>1.7.12</version> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
<name>LdifCompare</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.5.4</version> | ||
<configuration> | ||
<descriptors> | ||
<descriptor>src/assembly/assembly.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.5</version> | ||
<configuration> | ||
<!-- Configures the created archive --> | ||
<archive> | ||
<!-- Configures the content of the created manifest --> | ||
<manifest> | ||
<!-- Adds the classpath to the created manifest --> | ||
<addClasspath>true</addClasspath> | ||
<!-- | ||
Specifies that all dependencies of our application are found | ||
from the lib directory. | ||
--> | ||
<classpathPrefix>lib/</classpathPrefix> | ||
<!-- Configures the main class of the application --> | ||
<mainClass>se.idsecurity.ldifcompare.LdifUtilities</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.ruleoftech</groupId> | ||
<artifactId>markdown-page-generator-plugin</artifactId> | ||
<version>0.4</version> | ||
<executions> | ||
<execution> | ||
<phase>process-sources</phase> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<headerHtmlFile>${basedir}/header.html</headerHtmlFile> | ||
<footerHtmlFile>${basedir}/footer.html</footerHtmlFile> | ||
<inputDirectory>${basedir}</inputDirectory> | ||
<outputDirectory>${basedir}</outputDirectory> | ||
<inputEncoding>ISO-8859-15</inputEncoding> | ||
<outputEncoding>ISO-8859-15</outputEncoding> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
<finalName>LDIFCompare-${project.version}</finalName> | ||
</build> | ||
</project> |
Oops, something went wrong.