Added logging for security audits.

This commit is contained in:
AlgorithmX2 2014-09-04 22:08:07 -05:00
parent b86e728f04
commit b8d0db995b
3 changed files with 17 additions and 1 deletions

View file

@ -56,7 +56,7 @@ public enum AEFeature
enableDisassemblyCrafting("Crafting"), MolecularAssembler("CraftingFeatures"), MeteoriteCompass("Tools"), Patterns("CraftingFeatures"),
ChunkLoggerTrace("Commands", false);
ChunkLoggerTrace("Commands", false), LogSecurityAudits("Misc", false);
String Category;
boolean visible = true;

View file

@ -11,6 +11,9 @@ import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.IReadOnlyCollection;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.me.pathfinding.IPathItem;
import appeng.util.Platform;
import appeng.util.ReadOnlyCollection;
@ -34,7 +37,15 @@ public class GridConnection implements IGridConnection, IPathItem
GridNode b = (GridNode) bNode;
if ( Platform.securityCheck( a, b ) )
{
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{
AELog.info( "Audit Failed 1: " + a.getGridBlock().getLocation() );
AELog.info( "Audit Failed 2: " + b.getGridBlock().getLocation() );
}
throw new FailedConnection();
}
if ( a == null || b == null )
throw new GridException( "Connection Forged Between null enties." );

View file

@ -1504,6 +1504,11 @@ public class Platform
boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1;
boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1;
if ( AEConfig.instance.isFeatureEnabled( AEFeature.LogSecurityAudits ) )
{
AELog.info( "Audit: " + a_isSecure + " : " + b_isSecure + " @ " + a.lastSecurityKey + " vs " + b.lastSecurityKey );
}
// can't do that son...
if ( a_isSecure && b_isSecure )
return true;