Class SanitizedBridgesWriter
- java.lang.Object
-
- org.torproject.metrics.collector.sync.SyncManager
-
- org.torproject.metrics.collector.cron.CollecTorMain
-
- org.torproject.metrics.collector.bridgedescs.SanitizedBridgesWriter
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.concurrent.Callable<java.lang.Object>
,java.util.Observer
public class SanitizedBridgesWriter extends CollecTorMain
Sanitizes bridge descriptors, i.e., removes all possibly sensitive information from them, and writes them to a local directory structure. During the sanitizing process, all information about the bridge identity or IP address are removed or replaced. The goal is to keep the sanitized bridge descriptors useful for statistical analysis while not making it easier for an adversary to enumerate bridges.
There are three types of bridge descriptors: bridge network statuses (lists of all bridges at a given time), server descriptors (published by the bridge to advertise their capabilities), and extra-info descriptors (published by the bridge, mainly for statistical analysis).
-
-
Field Summary
-
Fields inherited from class org.torproject.metrics.collector.cron.CollecTorMain
config, mapPathDescriptors, SOURCES
-
Fields inherited from class org.torproject.metrics.collector.sync.SyncManager
SYNCORIGINS
-
-
Constructor Summary
Constructors Constructor Description SanitizedBridgesWriter(Configuration config)
Initialize configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUpRsyncDirectory()
Delete all files from the rsync directory that have not been modified in the last three days, and remove the .tmp extension from newly written files.void
finishWriting()
Rewrite all network statuses that might contain references to server descriptors we added or updated in this execution.java.lang.String
module()
Returns the module name for logging purposes.void
sanitizeAndStoreExtraInfoDescriptor(byte[] data)
Sanitizes an extra-info descriptor and writes it to disk.void
sanitizeAndStoreNetworkStatus(byte[] data, java.lang.String publicationTime, java.lang.String authorityFingerprint)
Sanitizes a network status and writes it to disk.void
sanitizeAndStoreServerDescriptor(byte[] data)
Sanitizes a bridge server descriptor and writes it to disk.protected void
startProcessing()
Module specific code goes here.protected java.lang.String
syncMarker()
Returns property prefix/infix/postfix for Sync related properties.-
Methods inherited from class org.torproject.metrics.collector.cron.CollecTorMain
call, checkAvailableSpace, run, syncMapPathsDescriptors, update
-
Methods inherited from class org.torproject.metrics.collector.sync.SyncManager
merge
-
-
-
-
Constructor Detail
-
SanitizedBridgesWriter
public SanitizedBridgesWriter(Configuration config)
Initialize configuration.
-
-
Method Detail
-
module
public java.lang.String module()
Description copied from class:CollecTorMain
Returns the module name for logging purposes.- Specified by:
module
in classCollecTorMain
-
syncMarker
protected java.lang.String syncMarker()
Description copied from class:CollecTorMain
Returns property prefix/infix/postfix for Sync related properties.- Specified by:
syncMarker
in classCollecTorMain
-
startProcessing
protected void startProcessing() throws ConfigurationException
Description copied from class:CollecTorMain
Module specific code goes here.- Specified by:
startProcessing
in classCollecTorMain
- Throws:
ConfigurationException
-
sanitizeAndStoreNetworkStatus
public void sanitizeAndStoreNetworkStatus(byte[] data, java.lang.String publicationTime, java.lang.String authorityFingerprint)
Sanitizes a network status and writes it to disk.
-
sanitizeAndStoreServerDescriptor
public void sanitizeAndStoreServerDescriptor(byte[] data)
Sanitizes a bridge server descriptor and writes it to disk.
-
sanitizeAndStoreExtraInfoDescriptor
public void sanitizeAndStoreExtraInfoDescriptor(byte[] data)
Sanitizes an extra-info descriptor and writes it to disk.
-
finishWriting
public void finishWriting()
Rewrite all network statuses that might contain references to server descriptors we added or updated in this execution. This applies to all statuses that have been published up to 24 hours after any added or updated server descriptor.
-
cleanUpRsyncDirectory
public void cleanUpRsyncDirectory() throws ConfigurationException
Delete all files from the rsync directory that have not been modified in the last three days, and remove the .tmp extension from newly written files.- Throws:
ConfigurationException
-
-