From 731a293db99799aab9475bc0f0d27158d6cc821c Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Mon, 6 Mar 2023 15:33:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=84=A4=EC=A0=95=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=95=94=ED=98=B8=ED=99=94=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/{ => ignore}/CacheConfig3.java | 8 ++-- .../core/config/ignore/JasyptConfig.java | 44 +++++++++++++++++++ .../resources/props/dev/globals.properties | 18 +++----- .../resources/props/local/globals.properties | 27 +++++++----- .../spring/service/context-properties.xml | 23 ++++++++++ src/main/webapp/ubi4/check/datasource.jsp | 2 +- 6 files changed, 93 insertions(+), 29 deletions(-) rename src/main/java/kr/xit/framework/core/config/{ => ignore}/CacheConfig3.java (93%) create mode 100644 src/main/java/kr/xit/framework/core/config/ignore/JasyptConfig.java diff --git a/src/main/java/kr/xit/framework/core/config/CacheConfig3.java b/src/main/java/kr/xit/framework/core/config/ignore/CacheConfig3.java similarity index 93% rename from src/main/java/kr/xit/framework/core/config/CacheConfig3.java rename to src/main/java/kr/xit/framework/core/config/ignore/CacheConfig3.java index d41180e0..b2111789 100644 --- a/src/main/java/kr/xit/framework/core/config/CacheConfig3.java +++ b/src/main/java/kr/xit/framework/core/config/ignore/CacheConfig3.java @@ -1,5 +1,4 @@ -/* -package kr.xit.framework.core.config; +package kr.xit.framework.core.config.ignore; import java.net.URISyntaxException; import java.net.URL; @@ -11,8 +10,8 @@ import org.springframework.cache.jcache.JCacheManagerFactoryBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -//@Configuration -//@EnableCaching +@Configuration +@EnableCaching public class CacheConfig3 { @Bean @@ -31,4 +30,3 @@ public class CacheConfig3 { return cmfb; } } -*/ diff --git a/src/main/java/kr/xit/framework/core/config/ignore/JasyptConfig.java b/src/main/java/kr/xit/framework/core/config/ignore/JasyptConfig.java new file mode 100644 index 00000000..9b97998e --- /dev/null +++ b/src/main/java/kr/xit/framework/core/config/ignore/JasyptConfig.java @@ -0,0 +1,44 @@ +package kr.xit.framework.core.config.ignore; + +import org.jasypt.encryption.StringEncryptor; +import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; +import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; +import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class JasyptConfig { + + @Bean(name = "jasyptStringEncryptor") + public StringEncryptor stringEncryptor() { + final String key = "xit5811807!@"; + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + config.setPassword(key); + config.setAlgorithm("PBEWithMD5AndDES"); + config.setPoolSize("1"); + encryptor.setConfig(config); + return encryptor; + } + + //FIXME : 설정의 암호화 필요시 + public static void main(String[] args) { + StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); + encryptor.setAlgorithm("PBEWithMD5AndDES"); + encryptor.setPassword("xit5811807!@"); + String url = encryptor.encrypt("jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=false"); + String id = encryptor.encrypt("root"); + String passwd = encryptor.encrypt("xit5811807"); + String decryptedPass = encryptor.decrypt(url); + System.out.println(url); + System.out.println(id); + System.out.println(passwd); + System.out.println(decryptedPass); + + } + +} + + + diff --git a/src/main/resources/props/dev/globals.properties b/src/main/resources/props/dev/globals.properties index 7ae725ce..f0a3b3bb 100644 --- a/src/main/resources/props/dev/globals.properties +++ b/src/main/resources/props/dev/globals.properties @@ -21,19 +21,15 @@ Globals.OsType = WINDOWS Globals.LocalIp = 127.0.0.1 # DB\uC11C\uBC84 \uD0C0\uC785(mysql,oracle,altibase,tibero) - datasource \uBC0F sqlMap \uD30C\uC77C \uC9C0\uC815\uC5D0 \uC0AC\uC6A9\uB428 -Globals.DbType = mysql -Globals.UserName=root -Globals.Password=xit5811807 -#Globals.UserName=new_inbus -#Globals.Password=bustms!2018 - -# maria # \uAC1C\uBC1C Globals.DriverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy -Globals.Url=jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&useSSL=false -#Globals.DriverClassName=org.mariadb.jdbc.Driver -#Globals.Url=jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&useSSL=false - +#Globals.Url=jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=falsejdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=false +#Globals.UserName=root +#Globals.Password=xit5811807 +Globals.DbType = mysql +Globals.Url=ENC(zkjZYDiQT1ELZvJgKnMmAGq1f6MScCS5J0KxMn58zNI1nwQ+rCSUIZAVZMEvQZ9Gj/ISlqZojzoZp+5/eHQMStpRlXNXxsL8OVls+vVKjqvbABZ3zr9Ko3g9/Bkx+BC3y5Di/ycV3+GqR+ml8Fy5SMyAIXy8O/TFr19gFaqEyJgAmKNGFkGg7OpWUsfs7XXc) +Globals.UserName=ENC(jzgcdK8FU5x06QfuAD0+FA==) +Globals.Password=ENC(S+FRTHOPAw/XPGBz4j/f9ZN4RZzbnbsz) #Globals.DriverClassName=com.mysql.jdbc.Driver #Globals.Url=jdbc:mysql://211.119.124.122:3306/xplatform diff --git a/src/main/resources/props/local/globals.properties b/src/main/resources/props/local/globals.properties index 67f1e1c6..8ba16e64 100644 --- a/src/main/resources/props/local/globals.properties +++ b/src/main/resources/props/local/globals.properties @@ -21,16 +21,19 @@ Globals.OsType = WINDOWS Globals.LocalIp = 127.0.0.1 # DB\uC11C\uBC84 \uD0C0\uC785(mysql,oracle,altibase,tibero) - datasource \uBC0F sqlMap \uD30C\uC77C \uC9C0\uC815\uC5D0 \uC0AC\uC6A9\uB428 -Globals.DbType = mysql -Globals.UserName=root -Globals.Password=xit5811807 #Globals.UserName=new_inbus #Globals.Password=bustms!2018 # maria # \uAC1C\uBC1C Globals.DriverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy -Globals.Url=jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&useSSL=false +#Globals.Url=jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=falsejdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=false +#Globals.UserName=root +#Globals.Password=xit5811807 +Globals.DbType = mysql +Globals.Url=ENC(zkjZYDiQT1ELZvJgKnMmAGq1f6MScCS5J0KxMn58zNI1nwQ+rCSUIZAVZMEvQZ9Gj/ISlqZojzoZp+5/eHQMStpRlXNXxsL8OVls+vVKjqvbABZ3zr9Ko3g9/Bkx+BC3y5Di/ycV3+GqR+ml8Fy5SMyAIXy8O/TFr19gFaqEyJgAmKNGFkGg7OpWUsfs7XXc) +Globals.UserName=ENC(jzgcdK8FU5x06QfuAD0+FA==) +Globals.Password=ENC(S+FRTHOPAw/XPGBz4j/f9ZN4RZzbnbsz) #Globals.DriverClassName=org.mariadb.jdbc.Driver #Globals.Url=jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&useSSL=false @@ -127,8 +130,8 @@ exception.log.trace=true file.upload.allow.max-size: 2048 file.upload.allow.ext= -#file.upload.root=/Users/minuk/data/fims/upload -file.upload.root=D:/data/fims/upload +file.upload.root=/Users/minuk/data/fims/upload +#file.upload.root=D:/data/fims/upload file.upload.temp.path=/temp file.upload.natl-newspaper.path=/natl-newspaper file.upload.busonly-cctv.path=/busonly @@ -136,11 +139,11 @@ file.upload.cctv-fix.path=/cctv-fix file.upload.cctv-drv.path=/cctv-drv file.upload.cmm-board.path=/cmm-board -#file.rcv.root=/Users/minuk/data/fims/extnl/rcv -#file.rcv.backup.root=/Users/minuk/data/fims/extnl/backup -#file.res.root=/Users/minuk/data/fims/extnl/res -file.rcv.root=D:/data/fims/extnl/rcv -file.rcv.backup.root=D:/data/fims/extnl/backup -file.res.root=D:/data/fims/extnl/res +file.rcv.root=/Users/minuk/data/fims/extnl/rcv +file.rcv.backup.root=/Users/minuk/data/fims/extnl/backup +file.res.root=/Users/minuk/data/fims/extnl/res +#file.rcv.root=D:/data/fims/extnl/rcv +#file.rcv.backup.root=D:/data/fims/extnl/backup +#file.res.root=D:/data/fims/extnl/res file.rcv.natl-newspaper.path=/natl-newspaper file.rcv.busonly-cctv.path=/busonly diff --git a/src/main/resources/spring/service/context-properties.xml b/src/main/resources/spring/service/context-properties.xml index e0386ff4..c1f7a2ae 100644 --- a/src/main/resources/spring/service/context-properties.xml +++ b/src/main/resources/spring/service/context-properties.xml @@ -7,6 +7,29 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + + + + + + + + + + + + + + + classpath:/props/${env}/globals.properties + + + + + + + + diff --git a/src/main/webapp/ubi4/check/datasource.jsp b/src/main/webapp/ubi4/check/datasource.jsp index ce560123..a5e9ee1a 100644 --- a/src/main/webapp/ubi4/check/datasource.jsp +++ b/src/main/webapp/ubi4/check/datasource.jsp @@ -13,7 +13,7 @@ String user = request.getParameter("user"); String password = request.getParameter("password"); - String sql = request.getParameter("sql"); + String sql = request.getParameter("db/sql"); if( type == null || type.equalsIgnoreCase("null") ) type = ""; if( dsNm == null || dsNm.equalsIgnoreCase("null") ) dsNm = "";