mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 04:59:51 +08:00
修改加密key名称,取消默认值
This commit is contained in:
parent
e51eb2e996
commit
6ed98bf09a
@ -6,4 +6,4 @@ current.publicKey=
|
||||
current.privateKey=
|
||||
current.service.username=
|
||||
current.service.password=
|
||||
dp.public.k=
|
||||
db.encrypt.key=
|
||||
|
@ -52,7 +52,7 @@ public class Engine {
|
||||
long instanceId;
|
||||
int taskGroupId = -1;
|
||||
if (isJob) {
|
||||
JobPwdDescryptUtil.decrypt(allConf);
|
||||
JobDataBasePwdDecryptUtil.decrypt(allConf);
|
||||
allConf.set(CoreConstant.DATAX_CORE_CONTAINER_JOB_MODE, RUNTIME_MODE);
|
||||
container = new JobContainer(allConf);
|
||||
instanceId = allConf.getLong(
|
||||
|
@ -3,22 +3,28 @@ package com.alibaba.datax.core.util;
|
||||
import com.alibaba.datax.common.util.Configuration;
|
||||
import com.alibaba.datax.core.util.container.CoreConstant;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**job数据库密码解密
|
||||
/**
|
||||
* 数据库密码解密
|
||||
*
|
||||
* @Author weizhao.dong
|
||||
* @Date 2023/3/23 14:37
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class JobPwdDescryptUtil {
|
||||
public class JobDataBasePwdDecryptUtil {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JobDataBasePwdDecryptUtil.class);
|
||||
|
||||
public static void decrypt(Configuration configuration) {
|
||||
if (configuration.getBool(CoreConstant.DATAX_JOB_SETTING_PASSWD_ENCRYPT, false)) {
|
||||
String readerPwd = configuration.getString(CoreConstant.DATA_JOB_READER_PARAMETER_PASSWORD);
|
||||
String writePwd = configuration.getString(CoreConstant.DATA_JOB_WRITER_PARAMETER_PASSWORD);
|
||||
//加密key
|
||||
String key = SecretUtil.getSecurityProperties().getProperty(CoreConstant.PASSWD_KEY);
|
||||
String key = SecretUtil.getSecurityProperties().getProperty(CoreConstant.DB_ENCRYPT_KEY);
|
||||
if (StringUtils.isEmpty(key)) {
|
||||
key = CoreConstant.PASSWD_KEY_DEFAULT;
|
||||
LOG.warn("{} is empty,use original password,", CoreConstant.DB_ENCRYPT_KEY);
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(readerPwd)) {
|
||||
configuration.set(CoreConstant.DATA_JOB_READER_PARAMETER_PASSWORD, SecretUtil.decrypt3DES(readerPwd, key));
|
@ -157,8 +157,8 @@ public class CoreConstant {
|
||||
public static final String CURRENT_SERVICE_USERNAME = "current.service.username";
|
||||
|
||||
public static final String CURRENT_SERVICE_PASSWORD = "current.service.password";
|
||||
public static final String PASSWD_KEY="dp.public.k";
|
||||
public static final String PASSWD_KEY_DEFAULT="dwz1qaz2wsx";
|
||||
|
||||
public static final String DB_ENCRYPT_KEY = "db.encrypt.key";
|
||||
|
||||
// ----------------------------- 环境变量 ---------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user