diff --git a/README.md b/README.md index 72941097..06c445d1 100755 --- a/README.md +++ b/README.md @@ -1,38 +1,27 @@ -EC2Box +Bastillion for EC2 ====== A web-based ssh console to execute commands and manage multiple EC2 instances -simultaneously running on Amazon Web Services (AWS). EC2Box allows you to share +simultaneously running on Amazon Web Services (AWS). Bastillion-EC2 allows you to share terminal commands and upload files to all your EC2 instances. Once the sessions have been opened you can select a single EC2 instance or any combination to run your commands. Also, additional instance administrators can be added and their terminal sessions and history can be audited. -![Terminals](https://www.sshkeybox.com/images/500x300/ec2box.png) +![Terminals](https://www.bastillion.io/images/500x300/bastillion.png) -AMI in the AWS Marketplace ------- -The simplest way to get started is to run the AMI from the AWS Marketplace. - -http://aws.amazon.com/marketplace/pp/B076D7XMK6 - -Once the EC2Box instance is up and running, open your browser to https://\:443 - -Login with - username:admin - password: - -EC2Box Releases +Bastillion for EC2 Releases ------ -This software is free for non-commercial use under the AGPL licence! - -Commercial users can purchase a license through an annual subscription and access the binary releases. +Commercial users can purchase a license through an annual subscription and access the binary releases. -https://www.sshkeybox.com/subscription +https://www.bastillion.io/subscription Also, users can purchase through the AWS Marketplace. -Feel free to try out EC2Box using the build instructions below! +Feel free to try out Bastillion for a limited amount of users(6)! + +https://github.com/bastillion-io/Bastillion-EC2/releases + Prerequisites ------------- @@ -50,7 +39,7 @@ Prerequisites **Loophole MVC** *(Only needed if building from source)* -> https://github.com/skavanagh/lmvc +> https://github.com/bastillion-io/lmvc **Install [FreeOTP](https://freeotp.github.io/) or [Google Authenticator](https://github.com/google/google-authenticator)** to enable two-factor authentication with Android or iOS @@ -73,7 +62,7 @@ In the directory that contains the pom.xml run *Note: Doing a mvn clean will delete the H2 DB and wipe out all the data.* -Using EC2Box +Using Bastillion-EC2 ------ Open browser to https://\:8443 @@ -86,20 +75,20 @@ Login with Steps: -1. Set your AWS credentials for the following properties in the EC2Box.properties file. +1. Set your AWS credentials for the following properties in the Bastillion-EC2.properties file. ``` #AWS IAM access key accessKey= #AWS IAM secret key secretKey= ``` -2. Configure an IAM Role with Account ID for your user and set generated ARN in EC2Box -3. Import the EC2Box public SSH key to the EC2 AWS console. +2. Configure an IAM Role with Account ID for your user and set generated ARN in Bastillion-EC2 +3. Import the Bastillion-EC2 public SSH key to the EC2 AWS console. 4. Create EC2 instanaces with the imported key. 5. Start composite-ssh sessions or create and execute a script across multiple sessions 6. Add instance administrator accounts -More info at https://www.sshkeybox.com/docs/ec2box +More info at https://www.bastillion.io/docs/bastillion Restricting User Access ------ @@ -119,7 +108,7 @@ or multiple Supplying a Custom SSH Key Pair ------ -EC2Box generates its own public/private SSH key upon initial startup for use when registering systems. You can specify a custom SSH key pair in the EC2BoxConfig.properties file. +Bastillion-EC2 generates its own public/private SSH key upon initial startup for use when registering systems. You can specify a custom SSH key pair in the Bastillion-EC2Config.properties file. For example: @@ -142,7 +131,7 @@ After startup and once the key has been registered it can then be removed from t External Authentication ------ -External Authentication can be enabled through the EC2BoxConfig.properties. +External Authentication can be enabled through the Bastillion-EC2Config.properties. For example: @@ -153,7 +142,7 @@ Connection details need to be set in the jaas.conf file ldap-ol { com.sun.security.auth.module.LdapLoginModule SUFFICIENT - userProvider="ldap://hostname:389/ou=example,dc=ec2box,dc=com" + userProvider="ldap://hostname:389/ou=example,dc=bastillion,dc=com" userFilter="(&(uid={USERNAME})(objectClass=inetOrgPerson))" authzIdentity="{cn}" useSSL=false @@ -163,7 +152,7 @@ Connection details need to be set in the jaas.conf file Administrators will be added as they are authenticated and profiles of systems may be assigned by full-privileged users. -User LDAP roles can be mapped to profiles defined in EC2Box through the use of the org.eclipse.jetty.jaas.spi.LdapLoginModule. +User LDAP roles can be mapped to profiles defined in Bastillion-EC2 through the use of the org.eclipse.jetty.jaas.spi.LdapLoginModule. ldap-ol-with-roles { //openldap auth with roles that can map to profiles @@ -177,12 +166,12 @@ User LDAP roles can be mapped to profiles defined in EC2Box through the use of t bindPassword="" authenticationMethod="simple" forceBindingLogin="true" - userBaseDn="ou=users,dc=ec2box,dc=com" + userBaseDn="ou=users,dc=bastillion,dc=com" userRdnAttribute="uid" userIdAttribute="uid" userPasswordAttribute="userPassword" userObjectClass="inetOrgPerson" - roleBaseDn="ou=groups,dc=ec2box,dc=com" + roleBaseDn="ou=groups,dc=bastillion,dc=com" roleNameAttribute="cn" roleMemberAttribute="member" roleObjectClass="groupOfNames"; @@ -192,17 +181,17 @@ Users will be added/removed from defined profiles as they login and when the rol Screenshots ----------- -![Two-Factor](https://www.sshkeybox.com/images/screenshots/medium/ec2box/two-factor.png) +![Two-Factor](https://www.bastillion.io/images/screenshots/medium/bastillion/two-factor.png) -![Importing Keys](https://www.sshkeybox.com/images/screenshots/medium/ec2box/importing_keys.png) +![Importing Keys](https://www.bastillion.io/images/screenshots/medium/bastillion/importing_keys.png) -![Select Instances](https://www.sshkeybox.com/images/screenshots/medium/ec2box/select_instances.png) +![Select Instances](https://www.bastillion.io/images/screenshots/medium/bastillion/select_instances.png) -![More Terminals](https://www.sshkeybox.com/images/screenshots/medium/ec2box/more_terms.png) +![More Terminals](https://www.bastillion.io/images/screenshots/medium/bastillion/more_terms.png) -![Upload Files](https://www.sshkeybox.com/images/screenshots/medium/ec2box/upload_files.png) +![Upload Files](https://www.bastillion.io/images/screenshots/medium/bastillion/upload_files.png) -![Disconnect](https://www.sshkeybox.com/images/screenshots/medium/ec2box/disconnect.png) +![Disconnect](https://www.bastillion.io/images/screenshots/medium/bastillion/disconnect.png) Acknowledgments ------ @@ -215,11 +204,11 @@ Third-party dependencies are mentioned in the [_3rdPartyLicenses.md_](3rdPartyLi Dual License ----------- -EC2Box is available for non-commercial use under the Affero General Public License +Bastillion-EC2 is available for non-commercial use under the Affero General Public License A commercial license is also available through a subscription -https://www.sshkeybox.com/subscription +https://www.bastillion.io/subscription or when running an AMI from the AWS marketplace. diff --git a/pom.xml b/pom.xml index d5497c14..0170b91b 100755 --- a/pom.xml +++ b/pom.xml @@ -2,11 +2,11 @@ 4.0.0 - com.ec2box - ec2box - 1.51.00-SNAPSHOT + io.bastillion + bastillion-ec2 + 1.60.00 war - EC2Box + Bastillion for EC2 UTF-8 1.9 diff --git a/src/main/java/com/ec2box/common/db/DBInitServlet.java b/src/main/java/io/bastillion/common/db/DBInitServlet.java similarity index 94% rename from src/main/java/com/ec2box/common/db/DBInitServlet.java rename to src/main/java/io/bastillion/common/db/DBInitServlet.java index fb7c90ae..0970ae78 100755 --- a/src/main/java/com/ec2box/common/db/DBInitServlet.java +++ b/src/main/java/io/bastillion/common/db/DBInitServlet.java @@ -25,13 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.common.db; +package io.bastillion.common.db; -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.EncryptionUtil; -import com.ec2box.manage.util.SSHUtil; +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.EncryptionUtil; +import io.bastillion.manage.util.SSHUtil; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; @@ -129,11 +129,12 @@ public void init(ServletConfig config) throws ServletException { 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 license (id INTEGER PRIMARY KEY AUTO_INCREMENT, license_tx varchar not null)"); //if exists readfile to set default password String salt = EncryptionUtil.generateSalt(); String defaultPassword = EncryptionUtil.hash("changeme" + salt); - File file = new File("/opt/ec2box/instance_id"); + File file = new File("/opt/bastillion-ec2/instance_id"); if (file.exists()) { String str = FileUtils.readFileToString(file, "UTF-8"); if(StringUtils.isNotEmpty(str)) { @@ -157,7 +158,7 @@ public void init(ServletConfig config) throws ServletException { DBUtils.closeStmt(pStmt); //generate new key and insert passphrase - System.out.println("Setting EC2Box SSH public/private key pair"); + System.out.println("Setting Bastillion for EC2 SSH public/private key pair"); //generate application pub/pvt key and get values String passphrase = SSHUtil.keyGen(); @@ -172,7 +173,7 @@ public void init(ServletConfig config) throws ServletException { pStmt.execute(); DBUtils.closeStmt(pStmt); - System.out.println("EC2Box Generated Global Public Key:"); + System.out.println("Bastillion for EC2 Generated Global Public Key:"); System.out.println(publicKey); //set config to default diff --git a/src/main/java/com/ec2box/common/filter/AuthFilter.java b/src/main/java/io/bastillion/common/filter/AuthFilter.java similarity index 96% rename from src/main/java/com/ec2box/common/filter/AuthFilter.java rename to src/main/java/io/bastillion/common/filter/AuthFilter.java index 6b64fb02..8f021090 100755 --- a/src/main/java/com/ec2box/common/filter/AuthFilter.java +++ b/src/main/java/io/bastillion/common/filter/AuthFilter.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.common.filter; +package io.bastillion.common.filter; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.AuthDB; -import com.ec2box.manage.model.Auth; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.AuthDB; +import io.bastillion.manage.model.Auth; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; @@ -37,6 +37,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/common/util/AppConfig.java b/src/main/java/io/bastillion/common/util/AppConfig.java similarity index 93% rename from src/main/java/com/ec2box/common/util/AppConfig.java rename to src/main/java/io/bastillion/common/util/AppConfig.java index 4ba34c8f..2edaf42f 100755 --- a/src/main/java/com/ec2box/common/util/AppConfig.java +++ b/src/main/java/io/bastillion/common/util/AppConfig.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.common.util; +package io.bastillion.common.util; -import com.ec2box.manage.util.EncryptionUtil; +import io.bastillion.manage.util.EncryptionUtil; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -51,18 +51,18 @@ public class AppConfig { try { //move configuration to specified dir if (StringUtils.isNotEmpty(System.getProperty("CONFIG_DIR"))) { - File configFile = new File(CONFIG_DIR + "/EC2BoxConfig.properties"); + File configFile = new File(CONFIG_DIR + "BastillionConfig.properties"); if (!configFile.exists()) { - File oldConfig = new File(AppConfig.class.getClassLoader().getResource(".").getPath() + "/EC2BoxConfig.properties"); + File oldConfig = new File(AppConfig.class.getClassLoader().getResource(".").getPath() + "BastillionConfig.properties"); FileUtils.moveFile(oldConfig, configFile); } - configFile = new File(CONFIG_DIR + "/jaas.conf"); + configFile = new File(CONFIG_DIR + "jaas.conf"); if (!configFile.exists()) { - File oldConfig = new File(AppConfig.class.getClassLoader().getResource(".").getPath() + "/jaas.conf"); + File oldConfig = new File(AppConfig.class.getClassLoader().getResource(".").getPath() + "jaas.conf"); FileUtils.moveFile(oldConfig, configFile); } } - prop = new PropertiesConfiguration(CONFIG_DIR + "/EC2BoxConfig.properties"); + prop = new PropertiesConfiguration(CONFIG_DIR + "BastillionConfig.properties"); } catch (Exception ex) { log.error(ex.toString(), ex); } diff --git a/src/main/java/com/ec2box/common/util/AuthUtil.java b/src/main/java/io/bastillion/common/util/AuthUtil.java similarity index 99% rename from src/main/java/com/ec2box/common/util/AuthUtil.java rename to src/main/java/io/bastillion/common/util/AuthUtil.java index a510197e..995c5426 100755 --- a/src/main/java/com/ec2box/common/util/AuthUtil.java +++ b/src/main/java/io/bastillion/common/util/AuthUtil.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.common.util; +package io.bastillion.common.util; -import com.ec2box.manage.util.EncryptionUtil; +import io.bastillion.manage.util.EncryptionUtil; import org.apache.commons.lang3.StringUtils; import javax.servlet.http.HttpServletRequest; diff --git a/src/main/java/com/ec2box/manage/control/IAMRoleKtrl.java b/src/main/java/io/bastillion/manage/control/IAMRoleKtrl.java similarity index 92% rename from src/main/java/com/ec2box/manage/control/IAMRoleKtrl.java rename to src/main/java/io/bastillion/manage/control/IAMRoleKtrl.java index ba00a47e..ffdedbc3 100755 --- a/src/main/java/com/ec2box/manage/control/IAMRoleKtrl.java +++ b/src/main/java/io/bastillion/manage/control/IAMRoleKtrl.java @@ -25,18 +25,15 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.ec2.AmazonEC2; import com.amazonaws.services.ec2.AmazonEC2ClientBuilder; -import com.amazonaws.services.ec2.model.*; -import com.ec2box.manage.db.IAMRoleDB; -import com.ec2box.manage.db.PrivateKeyDB; -import com.ec2box.manage.util.AWSClientConfig; -import com.ec2box.manage.util.SSHUtil; +import io.bastillion.manage.db.IAMRoleDB; +import io.bastillion.manage.db.PrivateKeyDB; +import io.bastillion.manage.util.AWSClientConfig; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/LoginKtrl.java b/src/main/java/io/bastillion/manage/control/LoginKtrl.java similarity index 94% rename from src/main/java/com/ec2box/manage/control/LoginKtrl.java rename to src/main/java/io/bastillion/manage/control/LoginKtrl.java index d5c0265d..5b0a4ff4 100755 --- a/src/main/java/com/ec2box/manage/control/LoginKtrl.java +++ b/src/main/java/io/bastillion/manage/control/LoginKtrl.java @@ -25,14 +25,14 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; - -import com.ec2box.common.util.AppConfig; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.AuthDB; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.User; -import com.ec2box.manage.util.OTPUtil; +package io.bastillion.manage.control; + +import io.bastillion.common.util.AppConfig; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.AuthDB; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.User; +import io.bastillion.manage.util.OTPUtil; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; @@ -50,7 +50,7 @@ public class LoginKtrl extends BaseKontroller { //check if otp is enabled @Model(name = "otpEnabled") static final Boolean otpEnabled = ("required".equals(AppConfig.getProperty("oneTimePassword")) || "optional".equals(AppConfig.getProperty("oneTimePassword"))); - private static Logger loginAuditLogger = LoggerFactory.getLogger("com.ec2box.manage.control.LoginAudit"); + private static Logger loginAuditLogger = LoggerFactory.getLogger("io.bastillion.manage.control.LoginAudit"); private final String AUTH_ERROR = "Authentication Failed : Login credentials are invalid"; private final String AUTH_ERROR_NO_PROFILE = "Authentication Failed : There are no profiles assigned to this account"; @Model(name = "auth") diff --git a/src/main/java/com/ec2box/manage/control/OTPKtrl.java b/src/main/java/io/bastillion/manage/control/OTPKtrl.java similarity index 91% rename from src/main/java/com/ec2box/manage/control/OTPKtrl.java rename to src/main/java/io/bastillion/manage/control/OTPKtrl.java index 8d14efb6..92a0b587 100755 --- a/src/main/java/com/ec2box/manage/control/OTPKtrl.java +++ b/src/main/java/io/bastillion/manage/control/OTPKtrl.java @@ -25,17 +25,17 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; -import com.ec2box.common.util.AppConfig; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.AuthDB; -import com.ec2box.manage.db.UserDB; -import com.ec2box.manage.util.OTPUtil; +import io.bastillion.common.util.AppConfig; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.AuthDB; +import io.bastillion.manage.db.UserDB; +import io.bastillion.manage.util.OTPUtil; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; @@ -106,7 +106,7 @@ public String qrImage() { try { - String qrCodeText = "otpauth://totp/EC2Box%20%28" + URLEncoder.encode(getRequest().getHeader("host").replaceAll("\\:.*$", ""), "utf-8") + "%29:" + username + "?secret=" + secret; + String qrCodeText = "otpauth://totp/Bastillion-EC2%20%28" + URLEncoder.encode(getRequest().getHeader("host").replaceAll("\\:.*$", ""), "utf-8") + "%29:" + username + "?secret=" + secret; QRCodeWriter qrWriter = new QRCodeWriter(); diff --git a/src/main/java/com/ec2box/manage/control/ProfileKtrl.java b/src/main/java/io/bastillion/manage/control/ProfileKtrl.java similarity index 95% rename from src/main/java/com/ec2box/manage/control/ProfileKtrl.java rename to src/main/java/io/bastillion/manage/control/ProfileKtrl.java index ec5da11e..99a955b0 100755 --- a/src/main/java/com/ec2box/manage/control/ProfileKtrl.java +++ b/src/main/java/io/bastillion/manage/control/ProfileKtrl.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; -import com.ec2box.manage.db.ProfileDB; -import com.ec2box.manage.model.Profile; -import com.ec2box.manage.model.SortedSet; +import io.bastillion.manage.db.ProfileDB; +import io.bastillion.manage.model.Profile; +import io.bastillion.manage.model.SortedSet; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/ProfileUsersKtrl.java b/src/main/java/io/bastillion/manage/control/ProfileUsersKtrl.java similarity index 92% rename from src/main/java/com/ec2box/manage/control/ProfileUsersKtrl.java rename to src/main/java/io/bastillion/manage/control/ProfileUsersKtrl.java index cb42757a..1917595d 100755 --- a/src/main/java/com/ec2box/manage/control/ProfileUsersKtrl.java +++ b/src/main/java/io/bastillion/manage/control/ProfileUsersKtrl.java @@ -25,13 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; -import com.ec2box.manage.db.ProfileDB; -import com.ec2box.manage.db.UserDB; -import com.ec2box.manage.db.UserProfileDB; -import com.ec2box.manage.model.Profile; -import com.ec2box.manage.model.SortedSet; +import io.bastillion.manage.db.ProfileDB; +import io.bastillion.manage.db.UserDB; +import io.bastillion.manage.db.UserProfileDB; +import io.bastillion.manage.model.Profile; +import io.bastillion.manage.model.SortedSet; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/ScriptKtrl.java b/src/main/java/io/bastillion/manage/control/ScriptKtrl.java similarity index 95% rename from src/main/java/com/ec2box/manage/control/ScriptKtrl.java rename to src/main/java/io/bastillion/manage/control/ScriptKtrl.java index 9c9dfa3c..5d905ad7 100755 --- a/src/main/java/com/ec2box/manage/control/ScriptKtrl.java +++ b/src/main/java/io/bastillion/manage/control/ScriptKtrl.java @@ -25,12 +25,12 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.ScriptDB; -import com.ec2box.manage.model.Script; -import com.ec2box.manage.model.SortedSet; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.ScriptDB; +import io.bastillion.manage.model.Script; +import io.bastillion.manage.model.SortedSet; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/SecureShellKtrl.java b/src/main/java/io/bastillion/manage/control/SecureShellKtrl.java similarity index 97% rename from src/main/java/com/ec2box/manage/control/SecureShellKtrl.java rename to src/main/java/io/bastillion/manage/control/SecureShellKtrl.java index 56cdbc9f..beeb45c4 100755 --- a/src/main/java/com/ec2box/manage/control/SecureShellKtrl.java +++ b/src/main/java/io/bastillion/manage/control/SecureShellKtrl.java @@ -25,18 +25,19 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; import com.jcraft.jsch.ChannelShell; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.*; -import com.ec2box.manage.model.*; -import com.ec2box.manage.util.SSHUtil; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.*; +import io.bastillion.manage.model.*; +import io.bastillion.manage.model.*; +import io.bastillion.manage.util.SSHUtil; +import io.bastillion.manage.db.*; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; import loophole.mvc.base.BaseKontroller; -import loophole.mvc.filter.SecurityFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/control/SessionAuditKtrl.java b/src/main/java/io/bastillion/manage/control/SessionAuditKtrl.java similarity index 91% rename from src/main/java/com/ec2box/manage/control/SessionAuditKtrl.java rename to src/main/java/io/bastillion/manage/control/SessionAuditKtrl.java index 31909359..5ade8452 100755 --- a/src/main/java/com/ec2box/manage/control/SessionAuditKtrl.java +++ b/src/main/java/io/bastillion/manage/control/SessionAuditKtrl.java @@ -25,16 +25,16 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; import com.google.gson.Gson; -import com.ec2box.manage.db.SessionAuditDB; -import com.ec2box.manage.db.SystemDB; -import com.ec2box.manage.db.UserDB; -import com.ec2box.manage.model.HostSystem; -import com.ec2box.manage.model.SessionAudit; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.model.User; +import io.bastillion.manage.db.SessionAuditDB; +import io.bastillion.manage.db.SystemDB; +import io.bastillion.manage.db.UserDB; +import io.bastillion.manage.model.HostSystem; +import io.bastillion.manage.model.SessionAudit; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.model.User; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/SystemKtrl.java b/src/main/java/io/bastillion/manage/control/SystemKtrl.java similarity index 97% rename from src/main/java/com/ec2box/manage/control/SystemKtrl.java rename to src/main/java/io/bastillion/manage/control/SystemKtrl.java index 09eb5a82..eb2689fa 100755 --- a/src/main/java/com/ec2box/manage/control/SystemKtrl.java +++ b/src/main/java/io/bastillion/manage/control/SystemKtrl.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; +package io.bastillion.manage.control; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.regions.Regions; @@ -37,15 +37,16 @@ import com.amazonaws.services.ec2.AmazonEC2; import com.amazonaws.services.ec2.AmazonEC2ClientBuilder; import com.amazonaws.services.ec2.model.*; -import com.ec2box.common.util.AppConfig; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.DefaultRegionDB; -import com.ec2box.manage.db.ScriptDB; -import com.ec2box.manage.db.SystemDB; -import com.ec2box.manage.db.UserProfileDB; -import com.ec2box.manage.model.*; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.util.AWSClientConfig; +import io.bastillion.common.util.AppConfig; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.DefaultRegionDB; +import io.bastillion.manage.db.ScriptDB; +import io.bastillion.manage.db.SystemDB; +import io.bastillion.manage.db.UserProfileDB; +import io.bastillion.manage.model.*; +import io.bastillion.manage.model.*; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.util.AWSClientConfig; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; diff --git a/src/main/java/com/ec2box/manage/control/UploadAndPushKtrl.java b/src/main/java/io/bastillion/manage/control/UploadAndPushKtrl.java similarity index 96% rename from src/main/java/com/ec2box/manage/control/UploadAndPushKtrl.java rename to src/main/java/io/bastillion/manage/control/UploadAndPushKtrl.java index 0cf05de8..29fc38a4 100755 --- a/src/main/java/com/ec2box/manage/control/UploadAndPushKtrl.java +++ b/src/main/java/io/bastillion/manage/control/UploadAndPushKtrl.java @@ -25,18 +25,17 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; - -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.SystemStatusDB; -import com.ec2box.manage.model.HostSystem; -import com.ec2box.manage.model.SchSession; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.SSHUtil; +package io.bastillion.manage.control; + +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.SystemStatusDB; +import io.bastillion.manage.model.HostSystem; +import io.bastillion.manage.model.SchSession; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.SSHUtil; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; -import loophole.mvc.annotation.Validate; import loophole.mvc.base.BaseKontroller; import loophole.mvc.filter.SecurityFilter; import org.apache.commons.fileupload.FileItem; diff --git a/src/main/java/com/ec2box/manage/control/UserSettingsKtrl.java b/src/main/java/io/bastillion/manage/control/UserSettingsKtrl.java similarity index 80% rename from src/main/java/com/ec2box/manage/control/UserSettingsKtrl.java rename to src/main/java/io/bastillion/manage/control/UserSettingsKtrl.java index 7c1ba5eb..455c3ed8 100755 --- a/src/main/java/com/ec2box/manage/control/UserSettingsKtrl.java +++ b/src/main/java/io/bastillion/manage/control/UserSettingsKtrl.java @@ -25,20 +25,23 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; - -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.AuthDB; -import com.ec2box.manage.db.PrivateKeyDB; -import com.ec2box.manage.db.UserThemeDB; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.UserSettings; -import com.ec2box.manage.util.PasswordUtil; +package io.bastillion.manage.control; + +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.AuthDB; +import io.bastillion.manage.db.LicenseDB; +import io.bastillion.manage.db.PrivateKeyDB; +import io.bastillion.manage.db.UserThemeDB; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.UserSettings; +import io.bastillion.manage.util.LicenseUtil; +import io.bastillion.manage.util.PasswordUtil; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; import loophole.mvc.annotation.Validate; import loophole.mvc.base.BaseKontroller; +import org.apache.commons.lang3.StringUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -47,7 +50,6 @@ import static java.util.Map.entry; - /** * Action for user settings */ @@ -74,6 +76,11 @@ public class UserSettingsKtrl extends BaseKontroller { Auth auth; @Model(name = "userSettings") UserSettings userSettings; + @Model(name = "license") + String license; + @Model(name ="expirationDt") + String expirationDt; + public UserSettingsKtrl(HttpServletRequest request, HttpServletResponse response) { @@ -83,6 +90,11 @@ public UserSettingsKtrl(HttpServletRequest request, HttpServletResponse response @Kontrol(path = "/admin/userSettings", method = MethodType.GET) public String userSettings() { userSettings = UserThemeDB.getTheme(AuthUtil.getUserId(getRequest().getSession())); + license = LicenseDB.getLicense(); + expirationDt = LicenseUtil.getExpirationDt(license); + if(StringUtils.isNotEmpty(license) && !LicenseUtil.isValid(license)) { + addError("License is invalid or has expired"); + } return "/admin/user_settings.html"; } @@ -118,6 +130,17 @@ public String themeSubmit() { return "redirect:/admin/menu.html"; } + @Kontrol(path = "/admin/licenseSubmit", method = MethodType.POST) + public String licenseSubmit() { + String retVal = "/admin/user_settings.html"; + if(LicenseUtil.isValid(license)) { + LicenseDB.saveLicense(license); + retVal = "redirect:/admin/menu.html"; + } else { + addError("License is invalid or has expired"); + } + return retVal; + } /** * Validates fields for password submit */ diff --git a/src/main/java/com/ec2box/manage/control/UsersKtrl.java b/src/main/java/io/bastillion/manage/control/UsersKtrl.java similarity index 84% rename from src/main/java/com/ec2box/manage/control/UsersKtrl.java rename to src/main/java/io/bastillion/manage/control/UsersKtrl.java index 2b52a2ba..58aa2fc4 100755 --- a/src/main/java/com/ec2box/manage/control/UsersKtrl.java +++ b/src/main/java/io/bastillion/manage/control/UsersKtrl.java @@ -25,20 +25,20 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.control; - -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.db.UserDB; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.model.User; -import com.ec2box.manage.util.PasswordUtil; +package io.bastillion.manage.control; + +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.db.UserDB; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.model.User; +import io.bastillion.manage.util.LicenseUtil; +import io.bastillion.manage.util.PasswordUtil; import loophole.mvc.annotation.Kontrol; import loophole.mvc.annotation.MethodType; import loophole.mvc.annotation.Model; import loophole.mvc.annotation.Validate; import loophole.mvc.base.BaseKontroller; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -72,6 +72,7 @@ public String viewUsers() { @Kontrol(path = "/manage/saveUser", method = MethodType.POST) public String saveUser() { + String retVal = "redirect:/manage/viewUsers.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField(); if (user.getId() != null) { if (user.getPassword() == null || user.getPassword().trim().equals("")) { @@ -84,11 +85,19 @@ public String saveUser() { UserDB.resetSharedSecret(user.getId()); } } else { - UserDB.insertUser(user); - } - return "redirect:/manage/viewUsers.ktrl?sortedSet.orderByDirection=" + sortedSet.getOrderByDirection() + "&sortedSet.orderByField=" + sortedSet.getOrderByField(); + if(LicenseUtil.isValid() || UserDB.getUserSet(sortedSet).getItemList().size() < 6) { + UserDB.insertUser(user); + } else { + addError("Users can no longer be added without a valid license"); + userId = AuthUtil.getUserId(getRequest().getSession()); + sortedSet = UserDB.getUserSet(sortedSet); + + retVal="/manage/view_users.html"; + } + } + return retVal; } @Kontrol(path = "/manage/deleteUser", method = MethodType.GET) diff --git a/src/main/java/com/ec2box/manage/db/AuthDB.java b/src/main/java/io/bastillion/manage/db/AuthDB.java similarity index 98% rename from src/main/java/com/ec2box/manage/db/AuthDB.java rename to src/main/java/io/bastillion/manage/db/AuthDB.java index 1a2aa7aa..1a5717e1 100755 --- a/src/main/java/com/ec2box/manage/db/AuthDB.java +++ b/src/main/java/io/bastillion/manage/db/AuthDB.java @@ -25,13 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.User; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.EncryptionUtil; -import com.ec2box.manage.util.ExternalAuthUtil; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.User; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.EncryptionUtil; +import io.bastillion.manage.util.ExternalAuthUtil; import org.apache.commons.lang3.StringUtils; import java.sql.Connection; diff --git a/src/main/java/com/ec2box/manage/db/DefaultRegionDB.java b/src/main/java/io/bastillion/manage/db/DefaultRegionDB.java similarity index 98% rename from src/main/java/com/ec2box/manage/db/DefaultRegionDB.java rename to src/main/java/io/bastillion/manage/db/DefaultRegionDB.java index bdd017e9..8b30652a 100755 --- a/src/main/java/com/ec2box/manage/db/DefaultRegionDB.java +++ b/src/main/java/io/bastillion/manage/db/DefaultRegionDB.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.util.DBUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/IAMRoleDB.java b/src/main/java/io/bastillion/manage/db/IAMRoleDB.java similarity index 97% rename from src/main/java/com/ec2box/manage/db/IAMRoleDB.java rename to src/main/java/io/bastillion/manage/db/IAMRoleDB.java index e2ae0923..0579cfeb 100755 --- a/src/main/java/com/ec2box/manage/db/IAMRoleDB.java +++ b/src/main/java/io/bastillion/manage/db/IAMRoleDB.java @@ -25,10 +25,10 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.EncryptionUtil; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.EncryptionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/PrivateKeyDB.java b/src/main/java/io/bastillion/manage/db/PrivateKeyDB.java similarity index 94% rename from src/main/java/com/ec2box/manage/db/PrivateKeyDB.java rename to src/main/java/io/bastillion/manage/db/PrivateKeyDB.java index a5d8b47e..43cf9912 100755 --- a/src/main/java/com/ec2box/manage/db/PrivateKeyDB.java +++ b/src/main/java/io/bastillion/manage/db/PrivateKeyDB.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.ApplicationKey; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.EncryptionUtil; +import io.bastillion.manage.model.ApplicationKey; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.EncryptionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/ProfileDB.java b/src/main/java/io/bastillion/manage/db/ProfileDB.java similarity index 97% rename from src/main/java/com/ec2box/manage/db/ProfileDB.java rename to src/main/java/io/bastillion/manage/db/ProfileDB.java index 200f3708..b2b27de1 100755 --- a/src/main/java/com/ec2box/manage/db/ProfileDB.java +++ b/src/main/java/io/bastillion/manage/db/ProfileDB.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.Profile; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.model.Profile; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.util.DBUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/ScriptDB.java b/src/main/java/io/bastillion/manage/db/ScriptDB.java similarity index 97% rename from src/main/java/com/ec2box/manage/db/ScriptDB.java rename to src/main/java/io/bastillion/manage/db/ScriptDB.java index 12b27702..ece1ddea 100755 --- a/src/main/java/com/ec2box/manage/db/ScriptDB.java +++ b/src/main/java/io/bastillion/manage/db/ScriptDB.java @@ -25,17 +25,18 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.Script; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.model.Script; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.util.DBUtils; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/SessionAuditDB.java b/src/main/java/io/bastillion/manage/db/SessionAuditDB.java similarity index 98% rename from src/main/java/com/ec2box/manage/db/SessionAuditDB.java rename to src/main/java/io/bastillion/manage/db/SessionAuditDB.java index 4661990c..8640246c 100755 --- a/src/main/java/com/ec2box/manage/db/SessionAuditDB.java +++ b/src/main/java/io/bastillion/manage/db/SessionAuditDB.java @@ -25,12 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.model.*; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.model.*; +import io.bastillion.manage.model.*; +import io.bastillion.manage.util.DBUtils; import org.apache.commons.lang3.StringUtils; import java.sql.Connection; diff --git a/src/main/java/com/ec2box/manage/db/SystemDB.java b/src/main/java/io/bastillion/manage/db/SystemDB.java similarity index 99% rename from src/main/java/com/ec2box/manage/db/SystemDB.java rename to src/main/java/io/bastillion/manage/db/SystemDB.java index 0afee1d3..1ec5eaf4 100755 --- a/src/main/java/com/ec2box/manage/db/SystemDB.java +++ b/src/main/java/io/bastillion/manage/db/SystemDB.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.HostSystem; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.model.HostSystem; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.util.DBUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/SystemStatusDB.java b/src/main/java/io/bastillion/manage/db/SystemStatusDB.java similarity index 97% rename from src/main/java/com/ec2box/manage/db/SystemStatusDB.java rename to src/main/java/io/bastillion/manage/db/SystemStatusDB.java index 1ea5de99..a2523523 100755 --- a/src/main/java/com/ec2box/manage/db/SystemStatusDB.java +++ b/src/main/java/io/bastillion/manage/db/SystemStatusDB.java @@ -25,12 +25,12 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.HostSystem; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.HostSystem; +import io.bastillion.manage.util.DBUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/db/UserDB.java b/src/main/java/io/bastillion/manage/db/UserDB.java similarity index 98% rename from src/main/java/com/ec2box/manage/db/UserDB.java rename to src/main/java/io/bastillion/manage/db/UserDB.java index 547b43cb..4e729033 100755 --- a/src/main/java/com/ec2box/manage/db/UserDB.java +++ b/src/main/java/io/bastillion/manage/db/UserDB.java @@ -25,12 +25,12 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.SortedSet; -import com.ec2box.manage.model.User; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.EncryptionUtil; +import io.bastillion.manage.model.SortedSet; +import io.bastillion.manage.model.User; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.EncryptionUtil; import org.apache.commons.lang3.StringUtils; import java.sql.Connection; diff --git a/src/main/java/com/ec2box/manage/db/UserProfileDB.java b/src/main/java/io/bastillion/manage/db/UserProfileDB.java similarity index 98% rename from src/main/java/com/ec2box/manage/db/UserProfileDB.java rename to src/main/java/io/bastillion/manage/db/UserProfileDB.java index 34dea067..868b9eb9 100755 --- a/src/main/java/com/ec2box/manage/db/UserProfileDB.java +++ b/src/main/java/io/bastillion/manage/db/UserProfileDB.java @@ -25,10 +25,10 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.Profile; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.model.Profile; +import io.bastillion.manage.util.DBUtils; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/src/main/java/com/ec2box/manage/db/UserThemeDB.java b/src/main/java/io/bastillion/manage/db/UserThemeDB.java similarity index 97% rename from src/main/java/com/ec2box/manage/db/UserThemeDB.java rename to src/main/java/io/bastillion/manage/db/UserThemeDB.java index f816fe10..8a694ead 100755 --- a/src/main/java/com/ec2box/manage/db/UserThemeDB.java +++ b/src/main/java/io/bastillion/manage/db/UserThemeDB.java @@ -25,10 +25,10 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.db; +package io.bastillion.manage.db; -import com.ec2box.manage.model.UserSettings; -import com.ec2box.manage.util.DBUtils; +import io.bastillion.manage.model.UserSettings; +import io.bastillion.manage.util.DBUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/model/ApplicationKey.java b/src/main/java/io/bastillion/manage/model/ApplicationKey.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/ApplicationKey.java rename to src/main/java/io/bastillion/manage/model/ApplicationKey.java index 169823f1..4f3b3788 100755 --- a/src/main/java/com/ec2box/manage/model/ApplicationKey.java +++ b/src/main/java/io/bastillion/manage/model/ApplicationKey.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * Value object for applications ssh keys diff --git a/src/main/java/com/ec2box/manage/model/AuditWrapper.java b/src/main/java/io/bastillion/manage/model/AuditWrapper.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/AuditWrapper.java rename to src/main/java/io/bastillion/manage/model/AuditWrapper.java index 128304ee..da1bcd86 100755 --- a/src/main/java/com/ec2box/manage/model/AuditWrapper.java +++ b/src/main/java/io/bastillion/manage/model/AuditWrapper.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; public class AuditWrapper { diff --git a/src/main/java/com/ec2box/manage/model/Auth.java b/src/main/java/io/bastillion/manage/model/Auth.java similarity index 99% rename from src/main/java/com/ec2box/manage/model/Auth.java rename to src/main/java/io/bastillion/manage/model/Auth.java index 5fc1d6de..d0f0d27a 100755 --- a/src/main/java/com/ec2box/manage/model/Auth.java +++ b/src/main/java/io/bastillion/manage/model/Auth.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * Value object that contains login information diff --git a/src/main/java/com/ec2box/manage/model/EC2Key.java b/src/main/java/io/bastillion/manage/model/EC2Key.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/EC2Key.java rename to src/main/java/io/bastillion/manage/model/EC2Key.java index 66c88f5f..4270e526 100755 --- a/src/main/java/com/ec2box/manage/model/EC2Key.java +++ b/src/main/java/io/bastillion/manage/model/EC2Key.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * Value object that contains information on private key diff --git a/src/main/java/com/ec2box/manage/model/HostSystem.java b/src/main/java/io/bastillion/manage/model/HostSystem.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/HostSystem.java rename to src/main/java/io/bastillion/manage/model/HostSystem.java index 54ac1df5..eac16217 100755 --- a/src/main/java/com/ec2box/manage/model/HostSystem.java +++ b/src/main/java/io/bastillion/manage/model/HostSystem.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; -import com.ec2box.common.util.AppConfig; +import io.bastillion.common.util.AppConfig; import java.util.List; diff --git a/src/main/java/com/ec2box/manage/model/Profile.java b/src/main/java/io/bastillion/manage/model/Profile.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/Profile.java rename to src/main/java/io/bastillion/manage/model/Profile.java index 175edfde..a4cdcc8e 100755 --- a/src/main/java/com/ec2box/manage/model/Profile.java +++ b/src/main/java/io/bastillion/manage/model/Profile.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * Value object that contains profile information diff --git a/src/main/java/com/ec2box/manage/model/SchSession.java b/src/main/java/io/bastillion/manage/model/SchSession.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/SchSession.java rename to src/main/java/io/bastillion/manage/model/SchSession.java index c2d9b600..f0374834 100755 --- a/src/main/java/com/ec2box/manage/model/SchSession.java +++ b/src/main/java/io/bastillion/manage/model/SchSession.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import com.jcraft.jsch.Channel; import com.jcraft.jsch.Session; diff --git a/src/main/java/com/ec2box/manage/model/Script.java b/src/main/java/io/bastillion/manage/model/Script.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/Script.java rename to src/main/java/io/bastillion/manage/model/Script.java index ba9cc7d7..29908700 100755 --- a/src/main/java/com/ec2box/manage/model/Script.java +++ b/src/main/java/io/bastillion/manage/model/Script.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * Value object that contains script information diff --git a/src/main/java/com/ec2box/manage/model/SessionAudit.java b/src/main/java/io/bastillion/manage/model/SessionAudit.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/SessionAudit.java rename to src/main/java/io/bastillion/manage/model/SessionAudit.java index 5675325e..7cb7f441 100755 --- a/src/main/java/com/ec2box/manage/model/SessionAudit.java +++ b/src/main/java/io/bastillion/manage/model/SessionAudit.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import java.util.Date; diff --git a/src/main/java/com/ec2box/manage/model/SessionOutput.java b/src/main/java/io/bastillion/manage/model/SessionOutput.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/SessionOutput.java rename to src/main/java/io/bastillion/manage/model/SessionOutput.java index 3ecb63ea..8d77fe9a 100755 --- a/src/main/java/com/ec2box/manage/model/SessionOutput.java +++ b/src/main/java/io/bastillion/manage/model/SessionOutput.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; /** * host id and string builder output diff --git a/src/main/java/com/ec2box/manage/model/SortedSet.java b/src/main/java/io/bastillion/manage/model/SortedSet.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/SortedSet.java rename to src/main/java/io/bastillion/manage/model/SortedSet.java index c9d50922..c1fd26c0 100755 --- a/src/main/java/com/ec2box/manage/model/SortedSet.java +++ b/src/main/java/io/bastillion/manage/model/SortedSet.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/com/ec2box/manage/model/User.java b/src/main/java/io/bastillion/manage/model/User.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/User.java rename to src/main/java/io/bastillion/manage/model/User.java index 0cf814af..b066b4bc 100755 --- a/src/main/java/com/ec2box/manage/model/User.java +++ b/src/main/java/io/bastillion/manage/model/User.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import java.util.List; diff --git a/src/main/java/com/ec2box/manage/model/UserSchSessions.java b/src/main/java/io/bastillion/manage/model/UserSchSessions.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/UserSchSessions.java rename to src/main/java/io/bastillion/manage/model/UserSchSessions.java index 702ae630..7f0ec9e6 100755 --- a/src/main/java/com/ec2box/manage/model/UserSchSessions.java +++ b/src/main/java/io/bastillion/manage/model/UserSchSessions.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import java.util.Map; diff --git a/src/main/java/com/ec2box/manage/model/UserSessionsOutput.java b/src/main/java/io/bastillion/manage/model/UserSessionsOutput.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/UserSessionsOutput.java rename to src/main/java/io/bastillion/manage/model/UserSessionsOutput.java index 53e0ad2b..12b06742 100755 --- a/src/main/java/com/ec2box/manage/model/UserSessionsOutput.java +++ b/src/main/java/io/bastillion/manage/model/UserSessionsOutput.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/com/ec2box/manage/model/UserSettings.java b/src/main/java/io/bastillion/manage/model/UserSettings.java similarity index 98% rename from src/main/java/com/ec2box/manage/model/UserSettings.java rename to src/main/java/io/bastillion/manage/model/UserSettings.java index 118e18a0..d614cc85 100755 --- a/src/main/java/com/ec2box/manage/model/UserSettings.java +++ b/src/main/java/io/bastillion/manage/model/UserSettings.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.model; +package io.bastillion.manage.model; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/com/ec2box/manage/socket/GetHttpSessionConfigurator.java b/src/main/java/io/bastillion/manage/socket/GetHttpSessionConfigurator.java similarity index 98% rename from src/main/java/com/ec2box/manage/socket/GetHttpSessionConfigurator.java rename to src/main/java/io/bastillion/manage/socket/GetHttpSessionConfigurator.java index 1401f848..59084f7b 100755 --- a/src/main/java/com/ec2box/manage/socket/GetHttpSessionConfigurator.java +++ b/src/main/java/io/bastillion/manage/socket/GetHttpSessionConfigurator.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.socket; +package io.bastillion.manage.socket; import javax.servlet.http.HttpSession; import javax.websocket.HandshakeResponse; diff --git a/src/main/java/com/ec2box/manage/socket/SecureShellWS.java b/src/main/java/io/bastillion/manage/socket/SecureShellWS.java similarity index 95% rename from src/main/java/com/ec2box/manage/socket/SecureShellWS.java rename to src/main/java/io/bastillion/manage/socket/SecureShellWS.java index 430106b0..233e40d5 100755 --- a/src/main/java/com/ec2box/manage/socket/SecureShellWS.java +++ b/src/main/java/io/bastillion/manage/socket/SecureShellWS.java @@ -25,17 +25,17 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.socket; +package io.bastillion.manage.socket; -import com.ec2box.manage.db.UserDB; +import io.bastillion.manage.db.UserDB; import com.google.gson.Gson; -import com.ec2box.common.util.AppConfig; -import com.ec2box.common.util.AuthUtil; -import com.ec2box.manage.control.SecureShellKtrl; -import com.ec2box.manage.model.SchSession; -import com.ec2box.manage.model.UserSchSessions; -import com.ec2box.manage.task.SentOutputTask; -import com.ec2box.manage.util.SessionOutputUtil; +import io.bastillion.common.util.AppConfig; +import io.bastillion.common.util.AuthUtil; +import io.bastillion.manage.control.SecureShellKtrl; +import io.bastillion.manage.model.SchSession; +import io.bastillion.manage.model.UserSchSessions; +import io.bastillion.manage.task.SentOutputTask; +import io.bastillion.manage.util.SessionOutputUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/task/SecureShellTask.java b/src/main/java/io/bastillion/manage/task/SecureShellTask.java similarity index 95% rename from src/main/java/com/ec2box/manage/task/SecureShellTask.java rename to src/main/java/io/bastillion/manage/task/SecureShellTask.java index 6e541ddc..0cecc780 100755 --- a/src/main/java/com/ec2box/manage/task/SecureShellTask.java +++ b/src/main/java/io/bastillion/manage/task/SecureShellTask.java @@ -25,10 +25,10 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.task; +package io.bastillion.manage.task; -import com.ec2box.manage.util.SessionOutputUtil; -import com.ec2box.manage.model.SessionOutput; +import io.bastillion.manage.util.SessionOutputUtil; +import io.bastillion.manage.model.SessionOutput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/task/SentOutputTask.java b/src/main/java/io/bastillion/manage/task/SentOutputTask.java similarity index 92% rename from src/main/java/com/ec2box/manage/task/SentOutputTask.java rename to src/main/java/io/bastillion/manage/task/SentOutputTask.java index 9e15ddd9..03045c31 100755 --- a/src/main/java/com/ec2box/manage/task/SentOutputTask.java +++ b/src/main/java/io/bastillion/manage/task/SentOutputTask.java @@ -25,13 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.task; +package io.bastillion.manage.task; -import com.ec2box.manage.model.User; +import io.bastillion.manage.model.User; import com.google.gson.Gson; -import com.ec2box.manage.model.SessionOutput; -import com.ec2box.manage.util.DBUtils; -import com.ec2box.manage.util.SessionOutputUtil; +import io.bastillion.manage.model.SessionOutput; +import io.bastillion.manage.util.DBUtils; +import io.bastillion.manage.util.SessionOutputUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/util/AWSClientConfig.java b/src/main/java/io/bastillion/manage/util/AWSClientConfig.java similarity index 96% rename from src/main/java/com/ec2box/manage/util/AWSClientConfig.java rename to src/main/java/io/bastillion/manage/util/AWSClientConfig.java index 27d57c6e..e39542cd 100755 --- a/src/main/java/com/ec2box/manage/util/AWSClientConfig.java +++ b/src/main/java/io/bastillion/manage/util/AWSClientConfig.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; @@ -36,12 +36,11 @@ import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder; import com.amazonaws.services.securitytoken.model.AssumeRoleRequest; import com.amazonaws.services.securitytoken.model.AssumeRoleResult; -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.db.IAMRoleDB; +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.db.IAMRoleDB; import org.apache.commons.lang3.StringUtils; import java.util.Calendar; -import java.util.Date; /** * return client configuration for AWS service calls @@ -136,7 +135,7 @@ public static BasicSessionCredentials getCredentials(String arn) { AssumeRoleRequest assumeRequest = new AssumeRoleRequest() .withRoleArn(arn) - .withRoleSessionName("EC2Box"); + .withRoleSessionName("Bastillion-EC2"); AssumeRoleResult assumeResult = stsClient.assumeRole(assumeRequest); diff --git a/src/main/java/com/ec2box/manage/util/DBUtils.java b/src/main/java/io/bastillion/manage/util/DBUtils.java similarity index 98% rename from src/main/java/com/ec2box/manage/util/DBUtils.java rename to src/main/java/io/bastillion/manage/util/DBUtils.java index 3251ee9d..c24fdd66 100755 --- a/src/main/java/com/ec2box/manage/util/DBUtils.java +++ b/src/main/java/io/bastillion/manage/util/DBUtils.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/main/java/com/ec2box/manage/util/DSPool.java b/src/main/java/io/bastillion/manage/util/DSPool.java similarity index 97% rename from src/main/java/com/ec2box/manage/util/DSPool.java rename to src/main/java/io/bastillion/manage/util/DSPool.java index e390b78e..1884c1a1 100755 --- a/src/main/java/com/ec2box/manage/util/DSPool.java +++ b/src/main/java/io/bastillion/manage/util/DSPool.java @@ -25,11 +25,11 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; +import io.bastillion.common.util.AppConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.ec2box.common.util.AppConfig; import org.apache.commons.dbcp2.BasicDataSource; /** diff --git a/src/main/java/com/ec2box/manage/util/EncryptionUtil.java b/src/main/java/io/bastillion/manage/util/EncryptionUtil.java similarity index 89% rename from src/main/java/com/ec2box/manage/util/EncryptionUtil.java rename to src/main/java/io/bastillion/manage/util/EncryptionUtil.java index acd3428b..69882a19 100755 --- a/src/main/java/com/ec2box/manage/util/EncryptionUtil.java +++ b/src/main/java/io/bastillion/manage/util/EncryptionUtil.java @@ -25,17 +25,17 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import java.security.MessageDigest; import java.security.SecureRandom; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Utility to encrypt, decrypt, and hash @@ -100,10 +100,11 @@ public static String hash(String str) { /** * return encrypted value of string * + * @param key secret key * @param str unencrypted string * @return encrypted string */ - public static String encrypt(String str) { + public static String encrypt(byte[] key, String str) { String retVal = null; if (str != null && str.length() > 0) { @@ -123,10 +124,11 @@ public static String encrypt(String str) { /** * return decrypted value of encrypted string * + * @param key secret key * @param str encrypted string * @return decrypted string */ - public static String decrypt(String str) { + public static String decrypt(byte[] key, String str) { String retVal = null; if (str != null && str.length() > 0) { try { @@ -142,5 +144,25 @@ public static String decrypt(String str) { return retVal; } + /** + * return encrypted value of string + * + * @param str unencrypted string + * @return encrypted string + */ + public static String encrypt(String str) { + return encrypt(key, str); + } + + /** + * return decrypted value of encrypted string + * + * @param str encrypted string + * @return decrypted string + */ + public static String decrypt(String str) { + return decrypt(key, str); + } + } diff --git a/src/main/java/com/ec2box/manage/util/ExternalAuthUtil.java b/src/main/java/io/bastillion/manage/util/ExternalAuthUtil.java similarity index 98% rename from src/main/java/com/ec2box/manage/util/ExternalAuthUtil.java rename to src/main/java/io/bastillion/manage/util/ExternalAuthUtil.java index 96a043d3..fd391809 100755 --- a/src/main/java/com/ec2box/manage/util/ExternalAuthUtil.java +++ b/src/main/java/io/bastillion/manage/util/ExternalAuthUtil.java @@ -25,14 +25,14 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; - -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.db.AuthDB; -import com.ec2box.manage.db.UserDB; -import com.ec2box.manage.db.UserProfileDB; -import com.ec2box.manage.model.Auth; -import com.ec2box.manage.model.User; +package io.bastillion.manage.util; + +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.db.AuthDB; +import io.bastillion.manage.db.UserDB; +import io.bastillion.manage.db.UserProfileDB; +import io.bastillion.manage.model.Auth; +import io.bastillion.manage.model.User; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/ec2box/manage/util/KeyStoreUtil.java b/src/main/java/io/bastillion/manage/util/KeyStoreUtil.java similarity index 96% rename from src/main/java/com/ec2box/manage/util/KeyStoreUtil.java rename to src/main/java/io/bastillion/manage/util/KeyStoreUtil.java index 56cff0b5..275c4214 100755 --- a/src/main/java/com/ec2box/manage/util/KeyStoreUtil.java +++ b/src/main/java/io/bastillion/manage/util/KeyStoreUtil.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; -import com.ec2box.common.util.AppConfig; +import io.bastillion.common.util.AppConfig; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +48,7 @@ public class KeyStoreUtil { private static KeyStore keyStore = null; private static final String keyStoreFile = AppConfig.CONFIG_DIR - + "/ec2box.jceks"; + + "/bastillion.jceks"; private static final char[] KEYSTORE_PASS = new char[]{ 'G', '~', 'r', 'x', 'Z', 'E', 'w', 'f', 'a', '[', '!', 'f', 'Z', 'd', '*', 'L', '8', 'm', 'h', 'u', '#', 'j', '9', ':', '~', ';', 'U', '>', 'O', 'i', '8', 'r', 'C', '}', 'f', 't', '%', '[', 'H', 'h', 'M', '&', diff --git a/src/main/java/com/ec2box/manage/util/OTPUtil.java b/src/main/java/io/bastillion/manage/util/OTPUtil.java similarity index 99% rename from src/main/java/com/ec2box/manage/util/OTPUtil.java rename to src/main/java/io/bastillion/manage/util/OTPUtil.java index f1b30e55..035ecccb 100755 --- a/src/main/java/com/ec2box/manage/util/OTPUtil.java +++ b/src/main/java/io/bastillion/manage/util/OTPUtil.java @@ -25,7 +25,7 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import org.apache.commons.codec.binary.Base32; diff --git a/src/main/java/com/ec2box/manage/util/PasswordUtil.java b/src/main/java/io/bastillion/manage/util/PasswordUtil.java similarity index 96% rename from src/main/java/com/ec2box/manage/util/PasswordUtil.java rename to src/main/java/io/bastillion/manage/util/PasswordUtil.java index dce49fc3..824e519e 100755 --- a/src/main/java/com/ec2box/manage/util/PasswordUtil.java +++ b/src/main/java/io/bastillion/manage/util/PasswordUtil.java @@ -25,9 +25,9 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; -import com.ec2box.common.util.AppConfig; +import io.bastillion.common.util.AppConfig; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/src/main/java/com/ec2box/manage/util/SSHUtil.java b/src/main/java/io/bastillion/manage/util/SSHUtil.java similarity index 97% rename from src/main/java/com/ec2box/manage/util/SSHUtil.java rename to src/main/java/io/bastillion/manage/util/SSHUtil.java index 2ab95c45..1b069dc4 100755 --- a/src/main/java/com/ec2box/manage/util/SSHUtil.java +++ b/src/main/java/io/bastillion/manage/util/SSHUtil.java @@ -25,19 +25,22 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import com.jcraft.jsch.*; -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.db.*; -import com.ec2box.manage.model.*; -import com.ec2box.manage.task.SecureShellTask; +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.db.*; +import io.bastillion.manage.model.*; +import io.bastillion.manage.task.SecureShellTask; +import io.bastillion.manage.db.PrivateKeyDB; +import io.bastillion.manage.db.SystemDB; +import io.bastillion.manage.db.SystemStatusDB; +import io.bastillion.manage.model.*; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; import org.slf4j.Logger; @@ -196,7 +199,7 @@ public static String keyGen(String passphrase) { } else if ("ecdsa".equals(SSHUtil.KEY_TYPE)) { type = KeyPair.ECDSA; } - String comment = "ec2box@global_key"; + String comment = "bastillion@global_key"; JSch jsch = new JSch(); diff --git a/src/main/java/com/ec2box/manage/util/SessionOutputSerializer.java b/src/main/java/io/bastillion/manage/util/SessionOutputSerializer.java similarity index 97% rename from src/main/java/com/ec2box/manage/util/SessionOutputSerializer.java rename to src/main/java/io/bastillion/manage/util/SessionOutputSerializer.java index 041afdcc..36405d63 100755 --- a/src/main/java/com/ec2box/manage/util/SessionOutputSerializer.java +++ b/src/main/java/io/bastillion/manage/util/SessionOutputSerializer.java @@ -25,13 +25,13 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import com.ec2box.manage.model.AuditWrapper; +import io.bastillion.manage.model.AuditWrapper; import java.lang.reflect.Type; import java.util.Date; diff --git a/src/main/java/com/ec2box/manage/util/SessionOutputUtil.java b/src/main/java/io/bastillion/manage/util/SessionOutputUtil.java similarity index 94% rename from src/main/java/com/ec2box/manage/util/SessionOutputUtil.java rename to src/main/java/io/bastillion/manage/util/SessionOutputUtil.java index 62cb91af..56eaeea3 100755 --- a/src/main/java/com/ec2box/manage/util/SessionOutputUtil.java +++ b/src/main/java/io/bastillion/manage/util/SessionOutputUtil.java @@ -25,16 +25,16 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -package com.ec2box.manage.util; +package io.bastillion.manage.util; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.ec2box.common.util.AppConfig; -import com.ec2box.manage.db.SessionAuditDB; -import com.ec2box.manage.model.AuditWrapper; -import com.ec2box.manage.model.SessionOutput; -import com.ec2box.manage.model.User; -import com.ec2box.manage.model.UserSessionsOutput; +import io.bastillion.common.util.AppConfig; +import io.bastillion.manage.db.SessionAuditDB; +import io.bastillion.manage.model.AuditWrapper; +import io.bastillion.manage.model.SessionOutput; +import io.bastillion.manage.model.User; +import io.bastillion.manage.model.UserSessionsOutput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.commons.lang3.StringUtils; @@ -53,7 +53,7 @@ public class SessionOutputUtil { private static Map userSessionsOutputMap = new ConcurrentHashMap<>(); public final static boolean enableInternalAudit = "true".equals(AppConfig.getProperty("enableInternalAudit")); private static Gson gson = new GsonBuilder().registerTypeAdapter(AuditWrapper.class, new SessionOutputSerializer()).create(); - private static Logger systemAuditLogger = LoggerFactory.getLogger("com.ec2box.manage.util.SystemAudit"); + private static Logger systemAuditLogger = LoggerFactory.getLogger("io.bastillion.manage.util.SystemAudit"); private SessionOutputUtil() { } diff --git a/src/main/resources/EC2BoxConfig.properties b/src/main/resources/BastillionConfig.properties similarity index 93% rename from src/main/resources/EC2BoxConfig.properties rename to src/main/resources/BastillionConfig.properties index 00fe2af6..8dd00279 100755 --- a/src/main/resources/EC2BoxConfig.properties +++ b/src/main/resources/BastillionConfig.properties @@ -1,5 +1,5 @@ # -# EC2Box Configuration Options +# Bastillion-EC2 Configuration Options # #set to true to regenerate and import SSH keys resetApplicationSSHKey=false @@ -62,13 +62,13 @@ use256EncryptionKey=false #Database and connection pool settings #Database user -dbUser=ec2box +dbUser=bastillion #Database password dbPassword= #Database JDBC driver dbDriver=org.h2.Driver #Connection URL to the DB -dbConnectionURL=jdbc:h2:ec2db/ec2box;CIPHER=AES; +dbConnectionURL=jdbc:h2:ec2db/bastillion;CIPHER=AES; #Max connections in the connection pool maxActive=25 #When true, objects will be validated before being returned by the connection pool @@ -80,8 +80,8 @@ maxWait=15000 #The session time out value of application in minutes sessionTimeout=15 # The optional tag on an instance that defines the host user to use -userTagName=ec2box-user +userTagName=bastillion-user #AWS IAM access key -accessKey= +accessKey=AKIAJDQKDPCS4W7PEKUQ #AWS IAM secret key -secretKey= +secretKey=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 diff --git a/src/main/resources/VERSION.txt b/src/main/resources/VERSION.txt index 385dcf4f..7e05f121 100755 --- a/src/main/resources/VERSION.txt +++ b/src/main/resources/VERSION.txt @@ -1 +1 @@ -EC2Box - Version: ${version} \ No newline at end of file +Bastillion-EC2 - Version: ${version} \ No newline at end of file diff --git a/src/main/resources/jaas.conf b/src/main/resources/jaas.conf index 8b9fdb60..23c79320 100755 --- a/src/main/resources/jaas.conf +++ b/src/main/resources/jaas.conf @@ -3,8 +3,8 @@ ldap-ol { //openldap auth first example config com.sun.security.auth.module.LdapLoginModule REQUIRED - userProvider="ldap://:389/ou=users,dc=ec2box,dc=com" - authIdentity="uid={USERNAME},ou=users,dc=ec2box,dc=com" + userProvider="ldap://:389/ou=users,dc=bastillion,dc=com" + authIdentity="uid={USERNAME},ou=users,dc=bastillion,dc=com" userFilter="(&(uid={USERNAME})(objectClass=inetOrgPerson))" authzIdentity="{cn}" //set this to return full name useSSL=false @@ -37,12 +37,12 @@ ldap-ol-with-roles { bindPassword="" authenticationMethod="simple" forceBindingLogin="false" - userBaseDn="ou=users,dc=ec2box,dc=com" + userBaseDn="ou=users,dc=bastillion,dc=com" userRdnAttribute="uid" userIdAttribute="uid" userPasswordAttribute="userPassword" userObjectClass="inetOrgPerson" - roleBaseDn="ou=groups,dc=ec2box,dc=com" + roleBaseDn="ou=groups,dc=bastillion,dc=com" roleNameAttribute="cn" roleMemberAttribute="member" roleObjectClass="groupOfNames"; diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index 4d43aa80..12c70e70 100755 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -9,7 +9,7 @@ @@ -22,11 +22,11 @@ - + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 12a5ae87..525ccaa9 100755 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -11,7 +11,7 @@ AuthFilter - com.ec2box.common.filter.AuthFilter + io.bastillion.common.filter.AuthFilter diff --git a/src/main/webapp/_res/css/keybox.css b/src/main/webapp/_res/css/keybox.css deleted file mode 100755 index eb7c593a..00000000 --- a/src/main/webapp/_res/css/keybox.css +++ /dev/null @@ -1,366 +0,0 @@ -body { - padding-top: 50px; -} - -a { - color: #666; -} -table { - border-collapse: collapse; - font-size: small; - min-width: 50%; -} - -table tbody { - overflow-x: auto; -} - -.container a { - text-decoration: underline; -} - -.navbar .container a { - text-decoration: none; -} -.navbar .note { - padding: 10px 2px 2px 0; - float: right; -} - -.navbar-inverse label { - color: #dddddd; -} - -form table { - background-color: #FFF; - min-width:10px; -} - -form table input { - padding: 2px; -} - -input:focus { - outline:0; -} - -form table td, form table th { - padding: 5px; -} - -table td, table th { - vertical-align: middle; - line-height: 1.42857; - padding:10px; -} - -.table-striped { - border: 1px solid #CCCCCC; -} - -.tablescroll_head th { - background-color: #e0e0e0; -} - -.table-striped th, .tablescroll_head th, .table-striped td, .tablescroll_head td { - padding: 10px 15px 10px 10px; -} - -.tablescroll_body td { - padding: 10px 15px 10px 10px; -} - -.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { - border: 1px solid #DDD; - line-height: 1.42857; - padding: 10px; - vertical-align: middle; -} - -.table-striped td, .table-striped th, .tablescroll_head th { - border: 1px solid #CCC; - white-space: nowrap; -} - - -.table-striped td a, .table-striped th a, .tablescroll_head th a { - white-space: nowrap; -} - -form table label, -form table .label { - font-size: small; - font-weight: bold; - color: #666; - padding: 2px 2px 2px 2px; -} - -div.block { - overflow: hidden; - border: 1px solid #CCC; -} - -div.block label, div.block .inner_block { - width: 120px; - display: block; - float: left; - text-align: left; - margin: 8px 8px 8px 8px; -} - -div.block .input { - float: left; - margin: 8px 8px 8px 8px; -} - -.error, .error a { - color: #b94a48; -} - -.warning { - font-weight: bold; - color: #b8b60e; -} - -.success { - font-weight: bold; - color: #008000; -} - -.sort { - background-position: right center; - background-repeat: no-repeat; - cursor: pointer; - background-image: url("../../img/bg.gif") -} - -.asc { - background-position: right center; - background-repeat: no-repeat; - cursor: pointer; - background-image: url("../../img/asc.gif") -} - -.desc { - background-position: right center; - background-repeat: no-repeat; - cursor: pointer; - background-image: url("../../img/desc.gif") -} - -.ui-button { - height: 22px; -} - -div.term { - margin: 10px; - border: 1px solid #CCCCCC; -} - -div.termwrapper { - width:98%; - margin: 0 auto; -} - -div.termwrapper div h6 { - margin: 8px 0 0 8px; -} - -.term-header { - white-space: nowrap; -} - -.top_nav { - padding: 0; - list-style: none; -} - -.top_nav_item { - float: left; - padding: 0 15px 0 0; -} - -.run_cmd { - background: #f0f0f0; - border: 1px solid #cccccc; -} - -.run_cmd_active { - background: #555753; - border: 1px solid #cccccc; -} - -.run_cmd_active h6 { - color: #f0f0f0; -} - -.run_cmd { - border-radius: 4px; - margin-top: 5px; - float: left; - width: 50%; -} - -.term { - background-color: #000; -} - -.term-header { - cursor:move; -} - -.top_link { - float: left; - padding: 0 0 10px 30px; - font-weight: bold; - text-decoration: underline; - cursor: pointer; -} - -.clear { - clear: both; -} - -.output { - z-index: 100; -} - -.terminal { - font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; - font-size: 12px; - color: #000; - background: #f0f0f0; - line-height: 1.231; -} - -.terminal pre { - font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; - font-size: 12px; - border: none; - line-height: 1.231; -} - -.terminal div { - white-space: nowrap; - height: 14px; -} - -.reverse-video { - color: #f0f0f0; - background: #4d4d4d; -} - -.note { - font-style: italic; - font-size: smaller; -} - -.template { - padding: 40px 15px; -} - -.btn { - padding: 5px; -} - -.nav-img { - float: left; - margin-top: -10px; - margin-left: -50px; -} - -.navbar-brand { - font-weight: bold; -} - -.align_left { - padding-left :0; - margin-left :0; -} - -.align_right { - padding-right :0; - margin-right :0; -} - -.modal-body .row { - padding-left:10px; -} - -.modal-footer .btn { - margin-bottom: 0; - padding: 8px 12px; -} - -.spacer { - display: inline-block; -} - -.spacer-middle { - margin: 0 5px; -} - -.spacer-left { - margin: 0 5px 0 0; -} - -.spacer-right { - margin: 0 0 0 5px; -} - -.spacer-top { - margin: 0 0 5px 0; -} - -.spacer-bottom { - margin: 5px 0 0 0; -} - -.alertContainer { - margin-top: 25px; -} - -a.btn { - text-decoration: none; -} -.existing_key_label .alert, .new_key_label .alert{ - float:right; - margin-right:30px; - padding:6px 18px; -} - -.scrollWrapperActive { - overflow-y: scroll; - height:450px; - display: inline-block; -} -.uploadScrollWrapperActive{ - overflow-y: scroll; - height:200px; - display: inline-block; -} - -.uploadScrollableTable { - min-width: 600px; -} -.scrollableTable { - min-width: 700px; -} -.scrollableTable th { - background-color: #e0e0e0; -} -table.floatThead-table { - border-top: none; - border-bottom: none; - background-color: #FFF; -} -.show { - display: block; -} -.hidden { - display: none; - visibility: hidden; -} -.invisible { - visibility: hidden; -} diff --git a/src/main/webapp/_res/inc/header.html b/src/main/webapp/_res/inc/header.html index fed34d55..e22fe0e9 100755 --- a/src/main/webapp/_res/inc/header.html +++ b/src/main/webapp/_res/inc/header.html @@ -34,8 +34,8 @@ - - + + - EC2Box - Main Menu + Bastillion for EC2 - Main Menu @@ -117,7 +117,7 @@ - + Audit Sessions diff --git a/src/main/webapp/admin/secure_shell.html b/src/main/webapp/admin/secure_shell.html index d94c3b44..2df191f4 100755 --- a/src/main/webapp/admin/secure_shell.html +++ b/src/main/webapp/admin/secure_shell.html @@ -538,7 +538,7 @@ - EC2Box - Composite Terms + Bastillion for EC2 - Composite Terms @@ -549,10 +549,10 @@