{"record":{"id":"28b7b5243f5153c3","repo":"NationalSecurityAgency/ghidra","slug":"original-connection-file-not-present","errorCode":null,"errorMessage":"Original connection file not present: {}","messagePattern":"Original connection file not present: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":1298,"sourceCode":"\t\tif (isServerRunning()) {\n\t\t\tthrow new IOException(\"Cannot modify settings on running server\");\n\t\t}\n\t\tif ((!authConfigPresent || (requestedHostAuth == hostAuthentication &&\n\t\t\trequestedLocalAuth == localAuthentication)) &&\n\t\t\t(requestedPort == -1 || requestedPort == port)) {\n\t\t\tSystem.out.println(\"No changes to make\");\n\t\t\treturn;\n\t\t}\n\n\t\tFile serverConfigFile = Application.getModuleDataFile(\"serverconfig.xml\").getFile(false);\n\t\tFile configCopy = new File(dataDirectory, POSTGRES_CONFIGFILE + \".orig\");\n\t\tif (!configCopy.exists()) {\n\t\t\tthrow new IOException(\n\t\t\t\t\"Original configuration file not present: \" + configCopy.getAbsolutePath());\n\t\t}\n\t\tFile hbaCopy = new File(dataDirectory, POSTGRES_CONNECTFILE + \".orig\");\n\t\tif (!hbaCopy.exists()) {\n\t\t\tthrow new IOException(\n\t\t\t\t\"Original connection file not present: \" + hbaCopy.getAbsolutePath());\n\t\t}\n\t\tif (requestedPort != -1 && requestedPort != port) {\n\t\t\tport = requestedPort;\n\t\t\tSystem.out.println(\"Server will now listen on port \" + Integer.toString(port));\n\t\t}\n\t\tboolean newRemotePki = false;\t\t// Are we newly enabling remote pki\n\t\tboolean newLocalPki = false;\t\t// Are we newly enabling local pki\n\n\t\tif (authConfigPresent && requestedLocalAuth != localAuthentication) {\n\t\t\tlocalAuthentication = requestedLocalAuth;\n\t\t\tSystem.out.print(\"New local authentication: \");\n\t\t\tif (localAuthentication == AUTHENTICATION_PASSWORD) {\n\t\t\t\tSystem.out.println(\"password\");\n\t\t\t}\n\t\t\telse if (localAuthentication == AUTHENTICATION_PKI) {\n\t\t\t\tSystem.out.println(\"pki\");\n\t\t\t\tnewLocalPki = true;","sourceCodeStart":1280,"sourceCodeEnd":1316,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L1280-L1316","documentation":"Thrown by changeAuthCommand() when '<datadir>/pg_hba.conf.orig' does not exist. This is the backup of the PostgreSQL host-based authentication file, created during 'bsim_ctl start'. Without it changeauth cannot safely restore or rebuild the connection-authentication rules.","triggerScenarios":"Running changeauth when the pg_hba.conf.orig backup file is absent (deleted, or directory was not initialized via 'bsim_ctl start').","commonSituations":"Same as 702: manual file cleanup, alternate initialization method, or partial restore that dropped .orig files.","solutions":["Confirm the directory was initialized by 'bsim_ctl start', which creates the .orig backups.","Restore the backup manually if the live pg_hba.conf is still pristine: cp <datadir>/pg_hba.conf <datadir>/pg_hba.conf.orig.","Reinitialize the data directory from scratch with 'bsim_ctl start' if the original cannot be recovered."],"exampleFix":"# before (backup missing)\nbsim_ctl changeauth /opt/bsim/data --auth password\n# after (restore the backup)\ncp /opt/bsim/data/pg_hba.conf /opt/bsim/data/pg_hba.conf.orig\nbsim_ctl changeauth /opt/bsim/data --auth password","handlingStrategy":"try-catch","validationCode":"File orig = new File(dataDirectory, \"pg_hba.conf.orig\");\nif (!orig.exists()) {\n    throw new IllegalStateException(\"Missing pg_hba backup; reinitialize via 'bsim_ctl start'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    bsimControl.run(new String[]{\"changeauth\", dataDir, \"--auth\", \"password\"});\n} catch (IOException e) {\n    if (e.getMessage().contains(\"connection file not present\")) {\n        // restore pg_hba.conf.orig or reinitialize\n    } else {\n        throw e;\n    }\n}","preventionTips":["Initialize data directories with 'bsim_ctl start' to generate pg_hba.conf.orig.","Preserve .orig backups during maintenance and backups.","Avoid manual pg_hba.conf edits that bypass BSim's tracked originals."],"tags":["bsim","postgres","cli","configuration"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}