mirror of
https://github.com/moparisthebest/mailiverse
synced 2024-12-03 13:32:15 -05:00
makes the hosts links just a directory, changed the captcha servlet to load privatekey from file, changed the mail and push to ensure tables of mail_extra, various changes to install which might not be permanent
This commit is contained in:
parent
32dab58ffe
commit
fb2a267e33
@ -3,4 +3,5 @@
|
||||
./dev-server-deploy mail-user
|
||||
./dev-server-deploy mail-key
|
||||
./dev-server-deploy tools
|
||||
|
||||
./dev-server-deploy web
|
||||
./dev-tomcat-restart
|
||||
|
@ -54,7 +54,7 @@
|
||||
<!--
|
||||
<domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
|
||||
<domainnames>
|
||||
# <domainname>mailiverse.com</domainname>
|
||||
<domainname>mailiverse.com</domainname>
|
||||
</domainnames>
|
||||
<autodetect>false</autodetect>
|
||||
<autodetectIP>false</autodetectIP>
|
||||
|
@ -24,7 +24,7 @@
|
||||
database.driverClassName=com.mysql.jdbc.Driver
|
||||
database.url=jdbc:mysql://localhost/james
|
||||
database.username=james
|
||||
database.password=JAMES_DB_PASSWORD
|
||||
database.password=bHPw8MLzd2N%
|
||||
|
||||
# Supported adapters are:
|
||||
# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
|
||||
|
1
deploy/james/resources/hosts
Symbolic link
1
deploy/james/resources/hosts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../config/hosts
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_prod
|
@ -4,3 +4,6 @@ ln -fs deploy/apache-james-conf
|
||||
ln -fs deploy/apache-james-mailbox-memory.jar
|
||||
ln -fs deploy/apache-james-server-mailets.jar
|
||||
|
||||
M_PRIMARY=`cat resources/hosts/prod`
|
||||
cd apache-james/bin
|
||||
./james-cli.sh adddomain $M_PRIMARY -h localhost
|
||||
|
1
deploy/mail-key/resources/hosts
Symbolic link
1
deploy/mail-key/resources/hosts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../config/hosts
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_prod
|
1
deploy/mail-user/resources/hosts
Symbolic link
1
deploy/mail-user/resources/hosts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../config/hosts
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_prod
|
1
deploy/tomcat/resources/captcha_private_key
Symbolic link
1
deploy/tomcat/resources/captcha_private_key
Symbolic link
@ -0,0 +1 @@
|
||||
../../../passwords/captcha_private_key
|
1
deploy/tomcat/resources/hosts
Symbolic link
1
deploy/tomcat/resources/hosts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../config/hosts
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_prod
|
1
deploy/tools/resources/hosts
Symbolic link
1
deploy/tools/resources/hosts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../config/hosts
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/auth_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_db_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_key_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_mail_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/local_smtp_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/primary_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/tomcat_prod
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_dev
|
@ -1 +0,0 @@
|
||||
../../../config/hosts/web_prod
|
@ -1,6 +1,6 @@
|
||||
if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi
|
||||
|
||||
source ./hosts.config
|
||||
source ./config.hosts
|
||||
server=$M_HOST_PROD
|
||||
|
||||
ssh $1@$server "tail -n 100 -f run.log"
|
||||
|
@ -2,6 +2,7 @@ set -x
|
||||
|
||||
M_HOST=$1
|
||||
|
||||
scp apache-james-3.0*.tar.gz james@$M_HOST:
|
||||
scp setup-james.remote james@$M_HOST:
|
||||
ssh james@$M_HOST ./setup-james.remote
|
||||
|
||||
|
@ -1,11 +1,23 @@
|
||||
set -x
|
||||
|
||||
wget http://apache.mirrors.pair.com//james/apache-james/3.0beta4/apache-james-3.0-beta4-app.tar.gz
|
||||
tar xzvf apache-james-3.0-beta4-app.tar.gz
|
||||
|
||||
ln -s apache-james-3.0-beta4 apache-james
|
||||
#mkdir build
|
||||
#cd build
|
||||
#svn checkout http://svn.apache.org/repos/asf/james/current/ james
|
||||
#cd james
|
||||
#mvn clean
|
||||
#mvn package -Pwith-assembly -DskipTests=true
|
||||
|
||||
|
||||
|
||||
tar xzf apache-james-3.0-beta5*.tar.gz
|
||||
ln -fs apache-james-3.0-beta5*/ apache-james
|
||||
cd apache-james
|
||||
|
||||
mv conf conf-original
|
||||
ln -s ../apache-james-conf conf
|
||||
|
||||
cd lib
|
||||
ln -fs ~/deploy/apache-james-mailbox-memory.jar apache-james-mailbox-memory*.jar
|
||||
|
||||
echo The final pieces will be installed during deploy
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
sudo add-apt-repository ppa:webupd8team/java --yes
|
||||
sudo apt-get update
|
||||
sudo apt-get install oracle-java7-installer --yes
|
||||
#sudo apt-get install oracle-java7-installer --yes
|
||||
sudo apt-get install oracle-java6-installer --yes
|
||||
|
||||
echo "Check the version after running this script, if it is not sun java then"
|
||||
echo "read this: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html"
|
||||
|
@ -5,6 +5,8 @@ set -x
|
||||
M_HOST=$1
|
||||
|
||||
./create-server-accounts $M_HOST
|
||||
|
||||
./setup-utils $M_HOST
|
||||
./setup-james $M_HOST
|
||||
./setup-java $M_HOST
|
||||
./setup-mysql $M_HOST
|
||||
|
8
install/setup-utils
Normal file
8
install/setup-utils
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
M_ROOT=`cat requirements/server_root_account`
|
||||
M_HOST=$1
|
||||
|
||||
scp setup-utils.remote $M_ROOT@$M_HOST:
|
||||
ssh $M_ROOT@$M_HOST ./setup-utils.remote
|
||||
|
||||
|
5
install/setup-utils.remote
Executable file
5
install/setup-utils.remote
Executable file
@ -0,0 +1,5 @@
|
||||
sudo apt-get install subversion
|
||||
|
||||
sudo apt-get install maven
|
||||
sudo dpkg -i --force-all /var/cache/apt/archives/libwagon2-java_2.2-3+nmu1_all.deb
|
||||
sudo apt-get install maven
|
@ -30,6 +30,7 @@ public class PushDb
|
||||
{
|
||||
cryptor = new CryptorRSAAES(new CryptorRSAJCE(ExternalResource.getResourceAsStream(getClass(), "keystore.jks"), null));
|
||||
mailExtra = new MailExtraDb();
|
||||
mailExtra.ensureTables();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -4,7 +4,9 @@
|
||||
*/
|
||||
package mail.streamserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Random;
|
||||
|
||||
import mail.server.db.MailUserDb;
|
||||
@ -35,11 +37,12 @@ public class MailServerSessionDb implements SRPServerUserSessionDb
|
||||
MailExtraDb payment;
|
||||
Captcha captcha;
|
||||
|
||||
public MailServerSessionDb (MailUserDb db)
|
||||
public MailServerSessionDb (MailUserDb db) throws SQLException, IOException
|
||||
{
|
||||
this.db = db;
|
||||
this.captcha = new Captcha();
|
||||
this.payment = new MailExtraDb();
|
||||
payment.ensureTables();
|
||||
}
|
||||
|
||||
public void setBlock (String userName, byte[] block) throws Exception
|
||||
|
@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import core.constants.ConstantsServer;
|
||||
import core.server.captcha.Captcha;
|
||||
import core.util.ExternalResource;
|
||||
import core.util.LogNull;
|
||||
import core.util.LogOut;
|
||||
|
||||
@ -68,30 +69,37 @@ public class CaptchaResponse extends HttpServlet {
|
||||
doCors(response);
|
||||
response.setContentType("application/json");
|
||||
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
|
||||
reCaptcha.setPrivateKey("YOUR_PRIVATE_KEY");
|
||||
|
||||
String challenge = request.getParameter("recaptcha_challenge_field");
|
||||
String uresponse = request.getParameter("recaptcha_response_field");
|
||||
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
|
||||
|
||||
if (reCaptchaResponse.isValid())
|
||||
{
|
||||
try
|
||||
{
|
||||
String token = captcha.captchaSucceeded();
|
||||
response.getWriter().write(("{'succeeded':true,'token':'" + token + "'}").replaceAll("'", "\""));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
response.getWriter().write("{'succeeded':false,'reason':'System error'}".replaceAll("'", "\""));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.getWriter().write("{'succeeded':false,'reason':'User error'}".replaceAll("'", "\""));
|
||||
}
|
||||
try
|
||||
{
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
|
||||
reCaptcha.setPrivateKey(ExternalResource.getTrimmedString("captcha_private_key"));
|
||||
|
||||
String challenge = request.getParameter("recaptcha_challenge_field");
|
||||
String uresponse = request.getParameter("recaptcha_response_field");
|
||||
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
|
||||
|
||||
if (reCaptchaResponse.isValid())
|
||||
{
|
||||
try
|
||||
{
|
||||
String token = captcha.captchaSucceeded();
|
||||
response.getWriter().write(("{'succeeded':true,'token':'" + token + "'}").replaceAll("'", "\""));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
response.getWriter().write("{'succeeded':false,'reason':'System error'}".replaceAll("'", "\""));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.getWriter().write("{'succeeded':false,'reason':'User error'}".replaceAll("'", "\""));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
response.getWriter().write("{'succeeded':false,'reason':'System error, captcha private key not set'}".replaceAll("'", "\""));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user