Commit b472814c authored by Matija Obreza's avatar Matija Obreza
Browse files

FTP server configuration

parent 473831a1
......@@ -19,3 +19,6 @@ db.hbm2ddl=true
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
data.dir=/data/genesys/
# Disable FTP
repository.ftp.port=-1
......@@ -79,6 +79,15 @@ public class FileRepositoryConfig implements InitializingBean {
@Value("${repository.ftp.keystore.password}")
private String ftpKeystorePwd;
@Value("${repository.ftp.port}")
private int ftpServerPort;
@Value("${repository.ftp.passivePorts}")
private String ftpServerPassivePorts;
@Value("${repository.ftp.externalAddress}")
private String ftpServerExternalAddress;
/**
* File repository service.
*
......@@ -164,15 +173,13 @@ public class FileRepositoryConfig implements InitializingBean {
@Bean
public RepositoryFtpServer ftpServer() {
RepositoryFtpServer ftpServer = new RepositoryFtpServer();
ftpServer.setFtpPort(8022);
ftpServer.setFtpPort(ftpServerPort);
ftpServer.setUserManager(ftpUserManager());
// TODO configurable!
ftpServer.setKeystorePath(ftpKeystorePath);
ftpServer.setKeystorePsw(ftpKeystorePwd);
// external IP address
// ftpServer.setExternalAddress("127.0.0.1");
ftpServer.setPassivePorts("2300-2301");
ftpServer.setExternalAddress(ftpServerExternalAddress);
ftpServer.setPassivePorts(ftpServerPassivePorts);
return ftpServer;
}
......@@ -182,7 +189,7 @@ public class FileRepositoryConfig implements InitializingBean {
return new AbstractUserManager() {
@Autowired
private AccountLockoutManager lockoutManager;
private final Logger LOG = LoggerFactory.getLogger(this.getClass());
@Autowired
......@@ -231,7 +238,7 @@ public class FileRepositoryConfig implements InitializingBean {
org.genesys2.server.model.impl.User user = userService.getUserByEmail(upauth.getUsername());
if (user == null || ! user.isActive() || user.isAccountLocked() || user.isAccountExpired() || ! user.isEnabled() || user.isPasswordExpired()) {
if (user == null || !user.isActive() || user.isAccountLocked() || user.isAccountExpired() || !user.isEnabled() || user.isPasswordExpired()) {
// user not found
throw new AuthenticationFailedException("Authentication failed");
}
......@@ -270,9 +277,13 @@ public class FileRepositoryConfig implements InitializingBean {
System.err.println("Using built-in keystore for FTP server /repository/ftpserver.jks");
ftpKeystorePath = getClass().getResource(DEFAULT_REPOSITORY_KEYSTORE_RESOURCE).getPath();
}
if (StringUtils.isBlank(ftpKeystorePwd)) {
System.err.println("Using built-in keystore password");
ftpKeystorePwd = DEFAULT_REPOSITORY_KEYSTORE_PASSWORD;
}
ftpServerExternalAddress = StringUtils.trimToNull(ftpServerExternalAddress);
ftpServerPassivePorts = StringUtils.trimToNull(ftpServerPassivePorts);
}
}
......@@ -180,3 +180,6 @@ s3.region=
# FTP
repository.ftp.keystore.path=
repository.ftp.keystore.password=changeit!
repository.ftp.port=8021
repository.ftp.passivePorts=2300-2350
repository.ftp.externalAddress=
......@@ -45,6 +45,9 @@ file.repository.dir=${data.dir}/repository
# FTP
repository.ftp.keystore.path=
repository.ftp.keystore.password=changeit!
repository.ftp.port=8021
repository.ftp.passivePorts=2300-2350
repository.ftp.externalAddress=
# ITPGRFA Easy-SMTA account (if you have one)
itpgrfa.easysmta.url=https://mls.planttreaty.org/itt/index.php?r=extsys/userinfo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment