mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUACAMOLE-1616: Write history records for external connections if configured to do so.
This commit is contained in:
@@ -110,7 +110,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
* the values that should be used in the absence of the correct properties.
|
||||
*/
|
||||
private final int DEFAULT_MAX_GROUP_CONNECTIONS = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The default value to use for SSL mode if none is explicitly configured.
|
||||
*/
|
||||
@@ -119,8 +119,8 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
/**
|
||||
* Constructs a new PostgreSQLEnvironment, providing access to PostgreSQL-specific
|
||||
* configuration options.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while setting up the underlying JDBCEnvironment
|
||||
* or while parsing legacy PostgreSQL configuration options.
|
||||
*/
|
||||
@@ -186,11 +186,11 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
/**
|
||||
* Returns the hostname of the PostgreSQL server hosting the Guacamole
|
||||
* authentication tables. If unspecified, this will be "localhost".
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The URL of the PostgreSQL server.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value.
|
||||
*/
|
||||
public String getPostgreSQLHostname() throws GuacamoleException {
|
||||
@@ -199,16 +199,16 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
DEFAULT_HOSTNAME
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the port number of the PostgreSQL server hosting the Guacamole
|
||||
* authentication tables. If unspecified, this will be the default
|
||||
* PostgreSQL port of 5432.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The port number of the PostgreSQL server.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value.
|
||||
*/
|
||||
public int getPostgreSQLPort() throws GuacamoleException {
|
||||
@@ -217,15 +217,15 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
DEFAULT_PORT
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of the PostgreSQL database containing the Guacamole
|
||||
* authentication tables.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The name of the PostgreSQL database.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value, or if the
|
||||
* value was not set, as this property is required.
|
||||
*/
|
||||
@@ -242,16 +242,16 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
public String getPassword() throws GuacamoleException {
|
||||
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_PASSWORD);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the defaultStatementTimeout set for PostgreSQL connections.
|
||||
* If unspecified, this will default to 0,
|
||||
* and should not be passed through to the backend.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The statement timeout (in seconds)
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value.
|
||||
*/
|
||||
public int getPostgreSQLDefaultStatementTimeout() throws GuacamoleException {
|
||||
@@ -260,15 +260,15 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
DEFAULT_STATEMENT_TIMEOUT
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the socketTimeout property to set on PostgreSQL connections.
|
||||
* If unspecified, this will default to 0 (no timeout)
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The socketTimeout to use when waiting on read operations (in seconds)
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value.
|
||||
*/
|
||||
public int getPostgreSQLSocketTimeout() throws GuacamoleException {
|
||||
@@ -282,85 +282,93 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
||||
public boolean isRecursiveQuerySupported(SqlSession session) {
|
||||
return true; // All versions of PostgreSQL support recursive queries through CTEs
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the SSL mode to use to make the JDBC connection to the PostgreSQL
|
||||
* server. If unspecified this will default to PREFER, attempting SSL
|
||||
* and falling back to plain-text if SSL fails.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The enum value of the SSL mode to use to make the JDBC connection
|
||||
* to the server.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the value from guacamole.properties.
|
||||
*/
|
||||
public PostgreSQLSSLMode getPostgreSQLSSLMode() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_SSL_MODE,
|
||||
DEFAULT_SSL_MODE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the SSL client certificate file to use to make the connection
|
||||
* to the PostgreSQL server.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The SSL client certificate file to use for the PostgreSQL connection.
|
||||
*
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the value from guacamole.properties.
|
||||
*/
|
||||
public File getPostgreSQLSSLClientCertFile() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_SSL_CERT_FILE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the SSL client private key file to use to make the connection to the
|
||||
* PostgreSQL server.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The SSL client private key file to use for the PostgreSQL connection.
|
||||
* @throws GuacamoleException
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the value from guacamole.properties.
|
||||
*/
|
||||
public File getPostgreSQLSSLClientKeyFile() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_SSL_KEY_FILE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the SSL client root certificate file to use to make the connection
|
||||
* to the PostgreSQL server.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The SSL client root certificate file to use to make the connection
|
||||
* to the PostgreSQL server.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the value from guacamole.properties.
|
||||
*/
|
||||
public File getPostgreSQLSSLClientRootCertFile() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_SSL_ROOT_CERT_FILE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the password to use to decrypt the private SSL key file when making
|
||||
* the connection to the PostgreSQL server.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* The password to use to decrypt the private SSL key file when making
|
||||
* the connection to the PostgreSQL server.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs retrieving the value from guacamole.properties.
|
||||
*/
|
||||
public String getPostgreSQLSSLClientKeyPassword() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_SSL_KEY_PASSWORD);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean autoCreateAbsentAccounts() throws GuacamoleException {
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_AUTO_CREATE_ACCOUNTS,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean trackExternalConnectionHistory() throws GuacamoleException {
|
||||
|
||||
// Track external connection history unless explicitly disabled
|
||||
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_TRACK_EXTERNAL_CONNECTION_HISTORY,
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ public class PostgreSQLGuacamoleProperties {
|
||||
* The number of seconds to wait for socket read operations.
|
||||
* If reading from the server takes longer than this value, the
|
||||
* connection will be closed. This can be used to handle network problems
|
||||
* such as a dropped connection to the database. Similar to
|
||||
* such as a dropped connection to the database. Similar to
|
||||
* postgresql-default-statement-timeout, it will have the effect of
|
||||
* aborting queries that take too long.
|
||||
* A value of 0 (the default) means the timeout is disabled.
|
||||
@@ -202,7 +202,7 @@ public class PostgreSQLGuacamoleProperties {
|
||||
public String getName() { return "postgresql-default-max-group-connections-per-user"; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The SSL mode that should be used by the JDBC driver when making
|
||||
* connections to the remote server. By default SSL will be attempted but
|
||||
@@ -210,60 +210,60 @@ public class PostgreSQLGuacamoleProperties {
|
||||
*/
|
||||
public static final EnumGuacamoleProperty<PostgreSQLSSLMode> POSTGRESQL_SSL_MODE =
|
||||
new EnumGuacamoleProperty<PostgreSQLSSLMode>(PostgreSQLSSLMode.class) {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-ssl-mode"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The client SSL certificate file used by the JDBC driver to make the
|
||||
* SSL connection.
|
||||
*/
|
||||
public static final FileGuacamoleProperty POSTGRESQL_SSL_CERT_FILE =
|
||||
new FileGuacamoleProperty() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-ssl-cert-file"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The client SSL private key file used by the JDBC driver to make the
|
||||
* SSL connection.
|
||||
*/
|
||||
public static final FileGuacamoleProperty POSTGRESQL_SSL_KEY_FILE =
|
||||
new FileGuacamoleProperty() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-ssl-key-file"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The client SSL root certificate file used by the JDBC driver to validate
|
||||
* certificates when making the SSL connection.
|
||||
*/
|
||||
public static final FileGuacamoleProperty POSTGRESQL_SSL_ROOT_CERT_FILE =
|
||||
new FileGuacamoleProperty() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-ssl-root-cert-file"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The password of the SSL private key used by the JDBC driver to make
|
||||
* the SSL connection to the PostgreSQL server.
|
||||
*/
|
||||
public static final StringGuacamoleProperty POSTGRESQL_SSL_KEY_PASSWORD =
|
||||
new StringGuacamoleProperty() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-ssl-key-password"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether or not to automatically create accounts in the PostgreSQL
|
||||
* database for users who successfully authenticate through another
|
||||
@@ -271,10 +271,23 @@ public class PostgreSQLGuacamoleProperties {
|
||||
*/
|
||||
public static final BooleanGuacamoleProperty POSTGRESQL_AUTO_CREATE_ACCOUNTS =
|
||||
new BooleanGuacamoleProperty() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-auto-create-accounts"; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Whether or not to track connection history for connections that do not originate
|
||||
* from within the Postgres database. By default, external connection history will be
|
||||
* tracked.
|
||||
*/
|
||||
public static final BooleanGuacamoleProperty POSTGRESQL_TRACK_EXTERNAL_CONNECTION_HISTORY =
|
||||
new BooleanGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-track-external-connection-history"; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user