diff --git a/pgadmin/Makefile.am b/pgadmin/Makefile.am
index e8ecd2a..d17bca9 100644
--- a/pgadmin/Makefile.am
+++ b/pgadmin/Makefile.am
@@ -71,7 +71,7 @@ endif
 if !APPBUNDLE
 
 nobase_dist_pkgdata_DATA = \
-	$(top_srcdir)/pgadmin/settings.ini
+	$(srcdir)/settings.ini
 
 
 if BUILD_DEBUG
@@ -88,7 +88,7 @@ install-exec-hook:
 else
 
 nobase_dist_data_DATA = \
-	$(top_srcdir)/pgadmin/settings.ini
+	$(srcdir)/settings.ini
 
 if BUILD_DEBUG
 nobase_dist_data_DATA += \
diff --git a/pgadmin/frm/plugins.cpp b/pgadmin/frm/plugins.cpp
index 8bb2279..6338d26 100644
--- a/pgadmin/frm/plugins.cpp
+++ b/pgadmin/frm/plugins.cpp
@@ -275,8 +275,22 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)
 		if (set_password && !obj->GetConnection()->GetPassword().IsEmpty())
 			wxSetEnv(wxT("PGPASSWORD"), obj->GetConnection()->GetPassword());
 
-		// Pass the SSL mode via the environment
+		// Pass the SSL settings via the environment
+		switch (obj->GetConnection()->GetSslMode())
+		{
+			case 1:
+				wxSetEnv(wxT("PGREQUIRESSL"), wxT("1"));
+				break;
+			case 2:
+				wxSetEnv(wxT("PGREQUIRESSL"), wxT("0"));
+				break;
+		}
+
 		wxSetEnv(wxT("PGSSLMODE"), obj->GetConnection()->GetSslModeName());
+		wxSetEnv(wxT("PGSSLCERT"), obj->GetConnection()->GetSSLCert());
+		wxSetEnv(wxT("PGSSLKEY"), obj->GetConnection()->GetSSLKey());
+		wxSetEnv(wxT("PGSSLROOTCERT"), obj->GetConnection()->GetSSLRootCert());
+		wxSetEnv(wxT("PGSSLCRL"), obj->GetConnection()->GetSSLCrl());
 	}
 	else
 	{
@@ -346,6 +360,15 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)
 		wxLogError(_("Failed to execute plugin %s (%s)"), title.c_str(), command.c_str());
 	}
 
+	// Reset the environment variables set by us
+	wxSetEnv(wxT("PGPASSWORD"), wxEmptyString);
+	wxSetEnv(wxT("PGSSLMODE"), wxEmptyString);
+	wxSetEnv(wxT("PGREQUIRESSL"), wxEmptyString);
+	wxSetEnv(wxT("PGSSLCERT"), wxEmptyString);
+	wxSetEnv(wxT("PGSSLKEY"), wxEmptyString);
+	wxSetEnv(wxT("PGSSLROOTCERT"), wxEmptyString);
+	wxSetEnv(wxT("PGSSLCRL"), wxEmptyString);
+
 	return 0;
 }
 
