From 47c1b852d426df36502c9603444fea89493b7682 Mon Sep 17 00:00:00 2001
From: Greg DiCristofaro <gregd@basistech.com>
Date: Wed, 18 May 2022 14:06:15 -0400
Subject: [PATCH] shared configuration fixes

---
 Core/nbproject/project.xml                    |  1 +
 .../settings/CentralRepoSettings.java         | 10 ++-
 .../interestingitems/FileSetsDefinitions.java | 21 +++--
 .../interestingitems/FilesSetsManager.java    | 38 ++++++---
 .../InterestingItemsFilesSetSettings.java     | 26 ++++---
 .../configuration/SharedConfiguration.java    | 78 +++++++++++++++----
 6 files changed, 127 insertions(+), 47 deletions(-)

diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml
index abf2b45f75..67e71c9b03 100644
--- a/Core/nbproject/project.xml
+++ b/Core/nbproject/project.xml
@@ -339,6 +339,7 @@
                 <package>org.sleuthkit.autopsy.modules.encryptiondetection</package>
                 <package>org.sleuthkit.autopsy.modules.filetypeid</package>
                 <package>org.sleuthkit.autopsy.modules.hashdatabase</package>
+                <package>org.sleuthkit.autopsy.modules.interestingitems</package>
                 <package>org.sleuthkit.autopsy.modules.vmextractor</package>
                 <package>org.sleuthkit.autopsy.modules.yara.rules</package>
                 <package>org.sleuthkit.autopsy.progress</package>
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java
index 4af78f6ae1..365d4620e2 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/settings/CentralRepoSettings.java
@@ -43,7 +43,8 @@ public static CentralRepoSettings getInstance() {
     private static final String DEFAULT_DB_PARENT_PATH = Paths.get(CENTRAL_REPO_BASE_PATH, "LocalDatabase").toString();
     private static final String DEFAULT_DB_NAME = "central_repository.db";
     private static final String MODULE_SETTINGS_KEY = Paths.get(CENTRAL_REPOSITORY_FOLDER, CENTRAL_REPOSITORY_SETTINGS_NAME).toString();
-
+    private static final String MODULE_SETTINGS_PROPERTIES = Paths.get(CENTRAL_REPO_BASE_PATH, CENTRAL_REPOSITORY_SETTINGS_NAME + ".properties").toString();
+    
     /**
      * @return The base path for central repository settings.
      */
@@ -58,6 +59,13 @@ public String getSettingsBaseFolder() {
     public String getModuleSettingsKey() {
         return MODULE_SETTINGS_KEY;
     }
+    
+    /**
+     * @return The path to the central repo settings.
+     */
+    public String getModuleSettingsFile() {
+        return MODULE_SETTINGS_PROPERTIES;
+    }
 
     /**
      * @return The default database parent path for sqlite cr.
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java
index 8272f2e3ab..716e95a0d9 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java
@@ -29,14 +29,13 @@
 import java.util.Map;
 import org.openide.util.io.NbObjectInputStream;
 import org.openide.util.io.NbObjectOutputStream;
-import org.sleuthkit.autopsy.coreutils.PlatformUtil;
+import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager.FilesSetsManagerException;
 
 /**
  * Class for wrapping a map which stores FilesSets as values with a String key.
  */
 class FileSetsDefinitions implements Serializable {
 
-    
     private static final long serialVersionUID = 1L;
     //By wrapping the map in this class we avoid warnings for unchecked casting when serializing
     private final Map<String, FilesSet> filesSets;
@@ -51,33 +50,39 @@ class FileSetsDefinitions implements Serializable {
     Map<String, FilesSet> getFilesSets() {
         return filesSets;
     }
-    
+
     /**
      * Writes FilesSet definitions to disk as an XML file, logging any errors.
      *
+     * @param basePath The base output directory.
      * @param fileName Name of the set definitions file as a string.
      *
      * @returns True if the definitions are written to disk, false otherwise.
      */
-    static boolean writeDefinitionsFile(String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException {
-        try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) {
+    static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException {
+        File outputPath = Paths.get(basePath, fileName).toFile();
+        outputPath.getParentFile().mkdirs();
+        try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputPath))) {
             out.writeObject(new FileSetsDefinitions(interestingFilesSets));
         } catch (IOException ex) {
             throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex);
         }
         return true;
     }
-    
+
     /**
      * Reads the definitions from the serialization file
      *
+     * @param basePath       The base output directory.
+     * @param serialFileName Name of the set definitions file as a string.
+     *
      * @return the map representing settings saved to serialization file, empty
      *         set if the file does not exist.
      *
      * @throws FilesSetsManagerException if file could not be read
      */
-    static Map<String, FilesSet> readSerializedDefinitions(String serialFileName) throws FilesSetsManager.FilesSetsManagerException {
-        Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), serialFileName);
+    static Map<String, FilesSet> readSerializedDefinitions(String basePath, String serialFileName) throws FilesSetsManager.FilesSetsManagerException {
+        Path filePath = Paths.get(basePath, serialFileName);
         File fileSetFile = filePath.toFile();
         String filePathStr = filePath.toString();
         if (fileSetFile.exists()) {
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
index afceada437..0d78bdffb6 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java
@@ -18,6 +18,8 @@
  */
 package org.sleuthkit.autopsy.modules.interestingitems;
 
+import com.google.common.annotations.Beta;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -26,6 +28,7 @@
 import java.util.Map;
 import java.util.Observable;
 import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.coreutils.PlatformUtil;
 import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule;
 import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition;
 
@@ -44,6 +47,8 @@ public final class FilesSetsManager extends Observable {
     private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
     private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings";
     private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings";
+    private static final String FILE_FILTER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString();
+    private static final String INTERESTING_ITEM_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString();
     private static final Object FILE_INGEST_FILTER_LOCK = new Object();
     private static final Object INTERESTING_FILES_SET_LOCK = new Object();
     private static FilesSetsManager instance;
@@ -65,6 +70,7 @@ public final class FilesSetsManager extends Observable {
         }
     });
 
+
     /**
      * Gets the FilesSet definitions manager singleton.
      */
@@ -75,6 +81,22 @@ public synchronized static FilesSetsManager getInstance() {
         return instance;
     }
 
+    /**
+     * @return The path to file filter settings.
+     */
+    @Beta
+    public static String getFileFilterPath() {
+        return FILE_FILTER_PATH;
+    }
+    
+    /**
+     * @return The path to interesting item settings.
+     */
+    @Beta
+    public static String getInterestingItemPath() {
+        return INTERESTING_ITEM_PATH;
+    }
+    
     /**
      * Gets the set of chars deemed to be illegal in file names (Windows).
      *
@@ -102,7 +124,7 @@ static List<String> getIllegalFilePathChars() {
     public static List<FilesSet> getStandardFileIngestFilters() {
         return Arrays.asList(FILES_DIRS_UNALLOC_INGEST_FILTER, FILES_DIRS_INGEST_FILTER);
     }
-    
+
     /**
      * Gets a copy of the current ingest file set definitions.
      *
@@ -113,7 +135,7 @@ public static List<FilesSet> getStandardFileIngestFilters() {
      */
     public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManagerException {
         synchronized (FILE_INGEST_FILTER_LOCK) {
-            return FileSetsDefinitions.readSerializedDefinitions(FILE_INGEST_FILTER_DEFS_NAME);
+            return FileSetsDefinitions.readSerializedDefinitions(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME);
         }
     }
 
@@ -126,7 +148,7 @@ public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManage
     public static FilesSet getDefaultFilter() {
         return FILES_DIRS_UNALLOC_INGEST_FILTER;
     }
-    
+
     /**
      * Sets the current interesting file sets definitions, replacing any
      * previous definitions.
@@ -136,11 +158,10 @@ public static FilesSet getDefaultFilter() {
      */
     void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
         synchronized (FILE_INGEST_FILTER_LOCK) {
-            FileSetsDefinitions.writeDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, filesSets);
+            FileSetsDefinitions.writeDefinitionsFile(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME, filesSets);
         }
     }
 
-    
     /**
      * Gets a copy of the current interesting files set definitions.
      *
@@ -149,11 +170,10 @@ void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSet
      */
     public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerException {
         synchronized (INTERESTING_FILES_SET_LOCK) {
-            return InterestingItemsFilesSetSettings.readDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME);
+            return InterestingItemsFilesSetSettings.readDefinitionsFile(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME);
         }
     }
 
-
     /**
      * Sets the current interesting file sets definitions, replacing any
      * previous definitions.
@@ -163,14 +183,12 @@ public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerEx
      */
     void setInterestingFilesSets(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
         synchronized (INTERESTING_FILES_SET_LOCK) {
-            InterestingItemsFilesSetSettings.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, filesSets);
+            InterestingItemsFilesSetSettings.writeDefinitionsFile(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, filesSets);
             this.setChanged();
             this.notifyObservers();
         }
     }
 
-    
-
     public static class FilesSetsManagerException extends Exception {
 
         FilesSetsManagerException() {
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
index 84b1306f26..e165500132 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java
@@ -89,7 +89,8 @@ class InterestingItemsFilesSetSettings implements Serializable {
     private static final String EXTENSION_RULE_TAG = "EXTENSION"; //NON-NLS
     private static final String STANDARD_SET = "standardSet";
     private static final String VERSION_NUMBER = "versionNumber";
-
+   
+    
     private Map<String, FilesSet> filesSets;
 
     InterestingItemsFilesSetSettings(Map<String, FilesSet> filesSets) {
@@ -118,7 +119,8 @@ private static String readRuleName(Element elem) {
 
     /**
      * Reads the definitions from the serialization file
-     *
+     * @param basePath       The base output directory.
+     * @param serialFileName Name of the set definitions file as a string.
      * @return the map representing settings saved to serialization file, empty
      *         set if the file does not exist.
      *
@@ -128,8 +130,8 @@ private static String readRuleName(Element elem) {
         "# {0} - filePathStr",
         "InterestingItemsFilesSetSettings.readSerializedDefinitions.failedReadSettings=Failed to read settings from ''{0}''"
     })
-    private static Map<String, FilesSet> readSerializedDefinitions(String serialFileName) throws FilesSetsManager.FilesSetsManagerException {
-        Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), serialFileName);
+    private static Map<String, FilesSet> readSerializedDefinitions(String basePath, String serialFileName) throws FilesSetsManager.FilesSetsManagerException {
+        Path filePath = Paths.get(basePath, serialFileName);
         File fileSetFile = filePath.toFile();
         String filePathStr = filePath.toString();
         if (fileSetFile.exists()) {
@@ -509,7 +511,7 @@ private static void readFilesSet(Element setElem, Map<String, FilesSet> filesSet
 
     /**
      * Reads FilesSet definitions from Serialized file or XML file.
-     *
+     * @param basePath       The base output directory.
      * @param fileName       The name of the file which is expected to store the
      *                       serialized definitions
      * @param legacyFileName Name of the xml set definitions file as a string.
@@ -519,14 +521,14 @@ private static void readFilesSet(Element setElem, Map<String, FilesSet> filesSet
      * @throws
      * org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager.FilesSetsManagerException
      */
-    static Map<String, FilesSet> readDefinitionsFile(String fileName, String legacyFileName) throws FilesSetsManager.FilesSetsManagerException {
-        Map<String, FilesSet> filesSets = readSerializedDefinitions(fileName);
+    static Map<String, FilesSet> readDefinitionsFile(String basePath, String fileName, String legacyFileName) throws FilesSetsManager.FilesSetsManagerException {
+        Map<String, FilesSet> filesSets = readSerializedDefinitions(basePath, fileName);
         if (!filesSets.isEmpty()) {
             return filesSets;
         }
         // Check if the legacy xml file exists.
         if (!legacyFileName.isEmpty()) {
-            return readDefinitionsXML(Paths.get(PlatformUtil.getUserConfigDirectory(), legacyFileName).toFile());
+            return readDefinitionsXML(Paths.get(basePath, legacyFileName).toFile());
         }
         return filesSets;
     }
@@ -599,13 +601,15 @@ static Map<String, FilesSet> readDefinitionsXML(Document doc, String resourceNam
     // definitions that ship with Autopsy and one for user definitions.
     /**
      * Writes FilesSet definitions to disk as an XML file, logging any errors.
-     *
+     * @param basePath       The base output directory.
      * @param fileName Name of the set definitions file as a string.
      *
      * @returns True if the definitions are written to disk, false otherwise.
      */
-    static boolean writeDefinitionsFile(String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException {
-        try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) {
+    static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException {
+        File outputFile = Paths.get(basePath, fileName).toFile();
+        outputFile.getParentFile().mkdirs();
+        try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputFile))) {
             out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets));
         } catch (IOException ex) {
             throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex);
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
index f7c9c6d8ff..dfa9633fd1 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java
@@ -38,6 +38,7 @@
 import java.util.concurrent.TimeUnit;
 import java.util.prefs.BackingStoreException;
 import org.apache.commons.io.FileUtils;
+import org.sleuthkit.autopsy.centralrepository.settings.CentralRepoSettings;
 import org.sleuthkit.autopsy.core.UserPreferences;
 import org.sleuthkit.autopsy.coreutils.Logger;
 import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -52,6 +53,8 @@
 import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CategoryNode;
 import org.sleuthkit.autopsy.coordinationservice.CoordinationService.Lock;
 import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException;
+import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupSettings;
+import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager;
 
 /*
  * A utility class for loading and saving shared configuration data
@@ -62,8 +65,8 @@ public class SharedConfiguration {
     private static final String AUTO_MODE_CONTEXT_FILE = "AutoModeContext.properties"; //NON-NLS
     private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE = "UserFileTypeDefinitions.settings"; //NON-NLS
     private static final String USER_DEFINED_TYPE_DEFINITIONS_FILE_LEGACY = "UserFileTypeDefinitions.xml"; //NON-NLS
-    private static final String INTERESTING_FILES_SET_DEFS_FILE = "InterestingFileSets.settings"; //NON-NLS
     private static final String INTERESTING_FILES_SET_DEFS_FILE_LEGACY = "InterestingFilesSetDefs.xml"; //NON-NLS
+    
     private static final String KEYWORD_SEARCH_SETTINGS = "keywords.settings"; //NON-NLS
     private static final String KEYWORD_SEARCH_SETTINGS_LEGACY = "keywords.xml"; //NON-NLS
     private static final String KEYWORD_SEARCH_GENERAL_LEGACY = "KeywordSearch.properties"; //NON-NLS
@@ -73,20 +76,17 @@ public class SharedConfiguration {
     private static final String FILE_EXT_MISMATCH_SETTINGS = "mismatch_config.settings"; //NON-NLS
     private static final String FILE_EXT_MISMATCH_SETTINGS_LEGACY = "mismatch_config.xml"; //NON-NLS
     private static final String ANDROID_TRIAGE = "AndroidTriage_Options.properties"; //NON-NLS
-    private static final String GENERAL_PROPERTIES = "core.properties"; //NON-NLS
     private static final String AUTO_INGEST_PROPERTIES = "AutoIngest.properties"; //NON-NLS
-    private static final String HASHDB_CONFIG_FILE_NAME = "hashLookup.settings"; //NON-NLS
+    
+    private static final String REMOTE_HASH_FOLDER = "hashDb"; //NON-NLS
+    
     private static final String HASHDB_CONFIG_FILE_NAME_LEGACY = "hashsets.xml"; //NON-NLS
     public static final String FILE_EXPORTER_SETTINGS_FILE = "fileexporter.settings"; //NON-NLS
-    private static final String CENTRAL_REPOSITORY_PROPERTIES_FILE = "CentralRepository.properties"; //NON-NLS
     private static final String SHARED_CONFIG_VERSIONS = "SharedConfigVersions.txt"; //NON-NLS
 
     // Folders
     private static final String AUTO_MODE_FOLDER = "AutoModeContext"; //NON-NLS
-    private static final String REMOTE_HASH_FOLDER = "hashDb"; //NON-NLS
-    private static final String PREFERENCES_FOLDER = "Preferences"; //NON-NLS
     public static final String FILE_EXPORTER_FOLDER = "Automated File Exporter"; //NON-NLS
-
     private static final String UPLOAD_IN_PROGRESS_FILE = "uploadInProgress"; // NON-NLS
     private static final String moduleDirPath = PlatformUtil.getUserConfigDirectory();
     private static final Logger logger = Logger.getLogger(SharedConfiguration.class.getName());
@@ -442,6 +442,24 @@ private static boolean isConfigFolderPopulated(File folder, boolean isSharedFold
         File contextProperties = new File(folder, AUTO_MODE_CONTEXT_FILE);
         return contextProperties.exists();
     }
+    
+    /**
+     * Copy a local settings file to the remote folder.
+     *
+     * @param fullLocalPathStr Full local path.
+     * @param localFolder      Local settings folder
+     * @param remoteFolder     Shared settings folder
+     * @param missingFileOk    True if it's not an error if the source file is
+     *                         not found
+     *
+     * @throws SharedConfigurationException
+     */
+    private static void copyToRemoteFolder(String fullLocalPathStr, File remoteFolder, boolean missingFileOk) throws SharedConfigurationException {
+        Path fullLocalPath = Paths.get(fullLocalPathStr);
+        String fileName = fullLocalPath.toFile().getName();
+        String parentPath = fullLocalPath.getParent().toString();
+        copyToRemoteFolder(fileName, parentPath, remoteFolder, missingFileOk);
+    }
 
     /**
      * Copy a local settings file to the remote folder.
@@ -482,6 +500,23 @@ private static void copyToRemoteFolder(String fileName, String localFolder, File
             throw new SharedConfigurationException(String.format("Failed to copy %s to %s", localFile.getAbsolutePath(), remoteFolder.getAbsolutePath()), ex);
         }
     }
+    
+    /**
+     * Copy a shared settings file to the local settings folder.
+     *
+     * @param fullLocalPathStr Full local path.
+     * @param remoteFolder     Shared settings folder
+     * @param missingFileOk    True if it's not an error if the source file is
+     *                         not found
+     *
+     * @throws SharedConfigurationException
+     */
+    private static void copyToLocalFolder(String fullLocalPathStr, File remoteFolder, boolean missingFileOk) throws SharedConfigurationException {
+        Path fullLocalPath = Paths.get(fullLocalPathStr);
+        String fileName = fullLocalPath.toFile().getName();
+        String parentPath = fullLocalPath.getParent().toString();
+        copyToLocalFolder(fileName, parentPath, remoteFolder, missingFileOk);
+    }
 
     /**
      * Copy a shared settings file to the local settings folder.
@@ -730,7 +765,7 @@ private void downloadFileTypeSettings(File remoteFolder) throws SharedConfigurat
     private void uploadInterestingFilesSettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Uploading InterestingFiles module configuration");
         copyToRemoteFolder(INTERESTING_FILES_SET_DEFS_FILE_LEGACY, moduleDirPath, remoteFolder, true);
-        copyToRemoteFolder(INTERESTING_FILES_SET_DEFS_FILE, moduleDirPath, remoteFolder, true);
+        copyToRemoteFolder(FilesSetsManager.getInstance().getInterestingItemPath(), remoteFolder, true);
     }
 
     /**
@@ -743,7 +778,7 @@ private void uploadInterestingFilesSettings(File remoteFolder) throws SharedConf
     private void downloadInterestingFilesSettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Downloading InterestingFiles module configuration");
         copyToLocalFolder(INTERESTING_FILES_SET_DEFS_FILE_LEGACY, moduleDirPath, remoteFolder, true);
-        copyToLocalFolder(INTERESTING_FILES_SET_DEFS_FILE, moduleDirPath, remoteFolder, true);
+        copyToLocalFolder(FilesSetsManager.getInstance().getInterestingItemPath(), remoteFolder, true);
     }
 
     /**
@@ -866,7 +901,8 @@ private void downloadFileExporterSettings(File remoteFolder) throws SharedConfig
      */
     private void uploadCentralRepositorySettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Uploading central repository configuration");
-        copyToRemoteFolder(CENTRAL_REPOSITORY_PROPERTIES_FILE, moduleDirPath, remoteFolder, true);
+        
+        copyToRemoteFolder(CentralRepoSettings.getInstance().getModuleSettingsFile(), remoteFolder, true);
     }
 
     /**
@@ -878,7 +914,7 @@ private void uploadCentralRepositorySettings(File remoteFolder) throws SharedCon
      */
     private void downloadCentralRepositorySettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Downloading central repository configuration");
-        copyToLocalFolder(CENTRAL_REPOSITORY_PROPERTIES_FILE, moduleDirPath, remoteFolder, true);
+        copyToLocalFolder(CentralRepoSettings.getInstance().getModuleSettingsFile(), moduleDirPath, remoteFolder, true);
     }
 
     /**
@@ -890,8 +926,12 @@ private void downloadCentralRepositorySettings(File remoteFolder) throws SharedC
      */
     private void uploadMultiUserAndGeneralSettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Uploading multi user configuration");
-        File generalSettingsFolder = Paths.get(moduleDirPath, PREFERENCES_FOLDER, "org", "sleuthkit", "autopsy").toFile();
-        copyToRemoteFolder(GENERAL_PROPERTIES, generalSettingsFolder.getAbsolutePath(), remoteFolder, false);
+        
+        copyToRemoteFolder(UserPreferences.getViewPreferencePath(), remoteFolder, false);
+        copyToRemoteFolder(UserPreferences.getMachineSpecificPreferencePath(), remoteFolder, false);
+        copyToRemoteFolder(UserPreferences.getModePreferencePath(), remoteFolder, false);
+        copyToRemoteFolder(UserPreferences.getExternalServicePreferencePath(), remoteFolder, false);
+        
         copyToRemoteFolder(AUTO_INGEST_PROPERTIES, moduleDirPath, remoteFolder, false);
     }
 
@@ -904,8 +944,12 @@ private void uploadMultiUserAndGeneralSettings(File remoteFolder) throws SharedC
      */
     private void downloadMultiUserAndGeneralSettings(File remoteFolder) throws SharedConfigurationException {
         publishTask("Downloading multi user configuration");
-        File generalSettingsFolder = Paths.get(moduleDirPath, PREFERENCES_FOLDER, "org", "sleuthkit", "autopsy").toFile();
-        copyToLocalFolder(GENERAL_PROPERTIES, generalSettingsFolder.getAbsolutePath(), remoteFolder, false);
+        
+        copyToLocalFolder(UserPreferences.getViewPreferencePath(), remoteFolder, false);
+        copyToLocalFolder(UserPreferences.getMachineSpecificPreferencePath(), remoteFolder, false);
+        copyToLocalFolder(UserPreferences.getModePreferencePath(), remoteFolder, false);
+        copyToLocalFolder(UserPreferences.getExternalServicePreferencePath(), remoteFolder, false);
+        
         copyToLocalFolder(AUTO_INGEST_PROPERTIES, moduleDirPath, remoteFolder, false);
     }
 
@@ -983,7 +1027,7 @@ private void uploadHashDbSettings(File remoteFolder) throws SharedConfigurationE
         Map<String, String> sharedVersions = readVersionsFromFile(sharedVersionFile);
 
         // Copy the settings file
-        copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME, moduleDirPath, remoteFolder, true);
+        copyToRemoteFolder(HashLookupSettings.getSettingsPath(), moduleDirPath, remoteFolder, true);
         copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
 
         // Get the list of databases from the file
@@ -1232,7 +1276,7 @@ private void downloadHashDbSettings(File remoteFolder) throws SharedConfiguratio
         }
 
         // Copy the settings filey
-        copyToLocalFolder(HASHDB_CONFIG_FILE_NAME, moduleDirPath, remoteFolder, true);
+        copyToLocalFolder(HashLookupSettings.getSettingsPath(), moduleDirPath, remoteFolder, true);
         copyToLocalFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
         copyToLocalFolder(SHARED_CONFIG_VERSIONS, moduleDirPath, remoteFolder, true);
 
-- 
GitLab