From 9532334e6d3b7b006b7a467209caa50617ca9849 Mon Sep 17 00:00:00 2001 From: Sean Kavanagh Date: Sat, 8 Jan 2022 13:37:52 -0500 Subject: [PATCH] =?UTF-8?q?Renamed=20column=20from=20user=20->=20username?= =?UTF-8?q?=20=E2=80=A6=20Renamed=20column=20from=20user=20->=20username?= =?UTF-8?q?=20since=20it's=20a=20keyword=20in=20H2=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 79 ++++++++++++------- pom.xml | 2 +- .../bastillion/common/db/DBInitServlet.java | 4 +- .../bastillion/manage/db/SessionAuditDB.java | 6 +- .../io/bastillion/manage/db/SystemDB.java | 6 +- 5 files changed, 60 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index db4d437e..c11ffe97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,9 +24,9 @@ } }, "node_modules/@popperjs/core": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.0.tgz", - "integrity": "sha512-zrsUxjLOKAzdewIDRWy9nsV1GQsKBCWaGwsZQlCgr6/q+vjyZhFgqedLfFBuI9anTPEUT4APq9Mu0SZBTzIcGQ==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", + "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==", "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" @@ -756,9 +756,9 @@ } }, "node_modules/is-core-module": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", - "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -1139,9 +1139,9 @@ } }, "node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -1163,13 +1163,17 @@ } }, "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", "dev": true, "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1236,6 +1240,18 @@ "node": ">=0.8.0" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1325,9 +1341,9 @@ }, "dependencies": { "@popperjs/core": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.0.tgz", - "integrity": "sha512-zrsUxjLOKAzdewIDRWy9nsV1GQsKBCWaGwsZQlCgr6/q+vjyZhFgqedLfFBuI9anTPEUT4APq9Mu0SZBTzIcGQ==" + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", + "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==" }, "abbrev": { "version": "1.1.1", @@ -1897,9 +1913,9 @@ } }, "is-core-module": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", - "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "requires": { "has": "^1.0.3" @@ -2192,9 +2208,9 @@ "dev": true }, "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "rechoir": { @@ -2207,13 +2223,14 @@ } }, "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-dir": { @@ -2262,6 +2279,12 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/pom.xml b/pom.xml index a8c2bfa4..c6f7a620 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.bastillion bastillion-ec2 - 1.75.03-SNAPSHOT + 1.76.00 war Bastillion for EC2 diff --git a/src/main/java/io/bastillion/common/db/DBInitServlet.java b/src/main/java/io/bastillion/common/db/DBInitServlet.java index 3614d2f1..e1d916fc 100755 --- a/src/main/java/io/bastillion/common/db/DBInitServlet.java +++ b/src/main/java/io/bastillion/common/db/DBInitServlet.java @@ -96,7 +96,7 @@ public void init(ServletConfig config) throws ServletException { statement.executeUpdate("create table if not exists user_theme (user_id INTEGER PRIMARY KEY, bg varchar(7), fg varchar(7), d1 varchar(7), d2 varchar(7), d3 varchar(7), d4 varchar(7), d5 varchar(7), d6 varchar(7), d7 varchar(7), d8 varchar(7), b1 varchar(7), b2 varchar(7), b3 varchar(7), b4 varchar(7), b5 varchar(7), b6 varchar(7), b7 varchar(7), b8 varchar(7), foreign key (user_id) references users(id) on delete cascade) "); statement.executeUpdate("create table if not exists default_region (id INTEGER PRIMARY KEY AUTO_INCREMENT, region varchar not null)"); statement.executeUpdate("create table if not exists iam_role (id INTEGER PRIMARY KEY AUTO_INCREMENT, arn varchar not null)"); - statement.executeUpdate("create table if not exists system (id INTEGER PRIMARY KEY AUTO_INCREMENT, display_nm varchar, instance_id varchar not null, \"user\" varchar not null, host varchar, port INTEGER not null, region varchar not null, state varchar, instance_status varchar, system_status varchar, m_alarm INTEGER default 0, m_insufficient_data INTEGER default 0, m_ok INTEGER default 0)"); + statement.executeUpdate("create table if not exists system (id INTEGER PRIMARY KEY AUTO_INCREMENT, display_nm varchar, instance_id varchar not null, username varchar not null, host varchar, port INTEGER not null, region varchar not null, state varchar, instance_status varchar, system_status varchar, m_alarm INTEGER default 0, m_insufficient_data INTEGER default 0, m_ok INTEGER default 0)"); statement.executeUpdate("create table if not exists profiles (id INTEGER PRIMARY KEY AUTO_INCREMENT, nm varchar not null, tag varchar not null)"); statement.executeUpdate("create table if not exists user_map (user_id INTEGER, profile_id INTEGER, foreign key (user_id) references users(id) on delete cascade, foreign key (profile_id) references profiles(id) on delete cascade, primary key (user_id, profile_id))"); statement.executeUpdate("create table if not exists application_key (id INTEGER PRIMARY KEY AUTO_INCREMENT, public_key varchar not null, private_key varchar not null, passphrase varchar)"); @@ -105,7 +105,7 @@ public void init(ServletConfig config) throws ServletException { statement.executeUpdate("create table if not exists scripts (id INTEGER PRIMARY KEY AUTO_INCREMENT, user_id INTEGER, display_nm varchar not null, script varchar not null, foreign key (user_id) references users(id) on delete cascade)"); statement.executeUpdate("create table if not exists session_log (id BIGINT PRIMARY KEY AUTO_INCREMENT, session_tm timestamp default CURRENT_TIMESTAMP, first_nm varchar, last_nm varchar, username varchar not null, ip_address varchar)"); - statement.executeUpdate("create table if not exists terminal_log (session_id BIGINT, instance_id INTEGER, output varchar not null, log_tm timestamp default CURRENT_TIMESTAMP, display_nm varchar not null, \"user\" varchar not null, host varchar not null, port INTEGER not null, foreign key (session_id) references session_log(id) on delete cascade)"); + statement.executeUpdate("create table if not exists terminal_log (session_id BIGINT, instance_id INTEGER, output varchar not null, log_tm timestamp default CURRENT_TIMESTAMP, display_nm varchar not null, username varchar not null, host varchar not null, port INTEGER not null, foreign key (session_id) references session_log(id) on delete cascade)"); //if exists readfile to set default password String salt = EncryptionUtil.generateSalt(); diff --git a/src/main/java/io/bastillion/manage/db/SessionAuditDB.java b/src/main/java/io/bastillion/manage/db/SessionAuditDB.java index 1792c67f..85023c98 100755 --- a/src/main/java/io/bastillion/manage/db/SessionAuditDB.java +++ b/src/main/java/io/bastillion/manage/db/SessionAuditDB.java @@ -228,7 +228,7 @@ public static void insertTerminalLog(Connection con, SessionOutput sessionOutput if (sessionOutput != null && sessionOutput.getSessionId() != null && sessionOutput.getInstanceId() != null && sessionOutput.getOutput() != null && !sessionOutput.getOutput().toString().equals("")) { //insert - PreparedStatement stmt = con.prepareStatement("insert into terminal_log (session_id, instance_id, display_nm, \"user\", host, port, output) values(?,?,?,?,?,?,?)"); + PreparedStatement stmt = con.prepareStatement("insert into terminal_log (session_id, instance_id, display_nm, username, host, port, output) values(?,?,?,?,?,?,?)"); stmt.setLong(1, sessionOutput.getSessionId()); stmt.setLong(2, sessionOutput.getInstanceId()); stmt.setString(3, sessionOutput.getDisplayNm()); @@ -331,13 +331,13 @@ public static List getHostSystemsForSession(Connection con, Long ses List hostSystemList = new ArrayList<>(); try { - PreparedStatement stmt = con.prepareStatement("select distinct instance_id, display_nm, \"user\", host, port from terminal_log where session_id=?"); + PreparedStatement stmt = con.prepareStatement("select distinct instance_id, display_nm, username, host, port from terminal_log where session_id=?"); stmt.setLong(1, sessionId); ResultSet rs = stmt.executeQuery(); while (rs.next()) { HostSystem hostSystem = new HostSystem(); hostSystem.setDisplayNm(rs.getString("display_nm")); - hostSystem.setUser(rs.getString("user")); + hostSystem.setUser(rs.getString("username")); hostSystem.setHost(rs.getString("host")); hostSystem.setPort(rs.getInt("port")); hostSystem.setInstanceId(rs.getInt("instance_id")); diff --git a/src/main/java/io/bastillion/manage/db/SystemDB.java b/src/main/java/io/bastillion/manage/db/SystemDB.java index b365cd8d..662983bb 100755 --- a/src/main/java/io/bastillion/manage/db/SystemDB.java +++ b/src/main/java/io/bastillion/manage/db/SystemDB.java @@ -28,7 +28,7 @@ public class SystemDB { private static Logger log = LoggerFactory.getLogger(SystemDB.class); public static final String DISPLAY_NM = "display_nm"; - public static final String USER = "user"; + public static final String USER = "username"; public static final String HOST = "host"; public static final String PORT = "port"; public static final String INSTANCE_ID = "instance_id"; @@ -331,7 +331,7 @@ public static void insertSystem(Connection con, HostSystem hostSystem) { try { - PreparedStatement stmt = con.prepareStatement("insert into system (display_nm, \"user\", host, port, instance_id, region, state, instance_status, system_status, m_alarm, m_insufficient_data, m_ok) values (?,?,?,?,?,?,?,?,?,?,?,?)"); + PreparedStatement stmt = con.prepareStatement("insert into system (display_nm, username, host, port, instance_id, region, state, instance_status, system_status, m_alarm, m_insufficient_data, m_ok) values (?,?,?,?,?,?,?,?,?,?,?,?)"); stmt.setString(1, hostSystem.getDisplayNm()); stmt.setString(2, hostSystem.getUser()); stmt.setString(3, hostSystem.getHost()); @@ -389,7 +389,7 @@ public static void updateSystem(Connection con, HostSystem hostSystem) { try { - PreparedStatement stmt = con.prepareStatement("update system set display_nm=?, \"user\"=?, host=?, port=?, instance_id=?, region=?, state=?, instance_status=?, system_status=?, m_alarm=?, m_insufficient_data=?, m_ok=? where id=?"); + PreparedStatement stmt = con.prepareStatement("update system set display_nm=?, username=?, host=?, port=?, instance_id=?, region=?, state=?, instance_status=?, system_status=?, m_alarm=?, m_insufficient_data=?, m_ok=? where id=?"); stmt.setString(1, hostSystem.getDisplayNm()); stmt.setString(2, hostSystem.getUser()); stmt.setString(3, hostSystem.getHost());