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:
Timothy Prepscius 2013-09-08 11:20:52 -04:00
parent 32dab58ffe
commit fb2a267e33
101 changed files with 85 additions and 113 deletions

View File

@ -3,4 +3,5 @@
./dev-server-deploy mail-user ./dev-server-deploy mail-user
./dev-server-deploy mail-key ./dev-server-deploy mail-key
./dev-server-deploy tools ./dev-server-deploy tools
./dev-server-deploy web
./dev-tomcat-restart

View File

@ -54,7 +54,7 @@
<!-- <!--
<domainlist class="org.apache.james.domainlist.xml.XMLDomainList"> <domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
<domainnames> <domainnames>
# <domainname>mailiverse.com</domainname> <domainname>mailiverse.com</domainname>
</domainnames> </domainnames>
<autodetect>false</autodetect> <autodetect>false</autodetect>
<autodetectIP>false</autodetectIP> <autodetectIP>false</autodetectIP>

View File

@ -24,7 +24,7 @@
database.driverClassName=com.mysql.jdbc.Driver database.driverClassName=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost/james database.url=jdbc:mysql://localhost/james
database.username=james database.username=james
database.password=JAMES_DB_PASSWORD database.password=bHPw8MLzd2N%
# Supported adapters are: # Supported adapters are:
# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE # DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE

View File

@ -0,0 +1 @@
../../../config/hosts

View File

@ -1 +0,0 @@
../../../config/hosts/auth_dev

View File

@ -1 +0,0 @@
../../../config/hosts/auth_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_prod

View File

@ -1 +0,0 @@
../../../config/hosts/primary_dev

View File

@ -1 +0,0 @@
../../../config/hosts/primary_prod

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_dev

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_prod

View File

@ -1 +0,0 @@
../../../config/hosts/web_dev

View File

@ -1 +0,0 @@
../../../config/hosts/web_prod

View File

@ -4,3 +4,6 @@ ln -fs deploy/apache-james-conf
ln -fs deploy/apache-james-mailbox-memory.jar ln -fs deploy/apache-james-mailbox-memory.jar
ln -fs deploy/apache-james-server-mailets.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

View File

@ -0,0 +1 @@
../../../config/hosts

View File

@ -1 +0,0 @@
../../../config/hosts/auth_dev

View File

@ -1 +0,0 @@
../../../config/hosts/auth_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_prod

View File

@ -1 +0,0 @@
../../../config/hosts/primary_dev

View File

@ -1 +0,0 @@
../../../config/hosts/primary_prod

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_dev

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_prod

View File

@ -1 +0,0 @@
../../../config/hosts/web_dev

View File

@ -1 +0,0 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts

View File

@ -1 +0,0 @@
../../../config/hosts/auth_dev

View File

@ -1 +0,0 @@
../../../config/hosts/auth_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_prod

View File

@ -1 +0,0 @@
../../../config/hosts/primary_dev

View File

@ -1 +0,0 @@
../../../config/hosts/primary_prod

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_dev

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_prod

View File

@ -1 +0,0 @@
../../../config/hosts/web_dev

View File

@ -1 +0,0 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../passwords/captcha_private_key

View File

@ -0,0 +1 @@
../../../config/hosts

View File

@ -1 +0,0 @@
../../../config/hosts/auth_dev

View File

@ -1 +0,0 @@
../../../config/hosts/auth_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_prod

View File

@ -1 +0,0 @@
../../../config/hosts/primary_dev

View File

@ -1 +0,0 @@
../../../config/hosts/primary_prod

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_dev

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_prod

View File

@ -1 +0,0 @@
../../../config/hosts/web_dev

View File

@ -1 +0,0 @@
../../../config/hosts/web_prod

View File

@ -0,0 +1 @@
../../../config/hosts

View File

@ -1 +0,0 @@
../../../config/hosts/auth_dev

View File

@ -1 +0,0 @@
../../../config/hosts/auth_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_db_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_key_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_mail_prod

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_dev

View File

@ -1 +0,0 @@
../../../config/hosts/local_smtp_prod

View File

@ -1 +0,0 @@
../../../config/hosts/primary_dev

View File

@ -1 +0,0 @@
../../../config/hosts/primary_prod

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_dev

View File

@ -1 +0,0 @@
../../../config/hosts/tomcat_prod

View File

@ -1 +0,0 @@
../../../config/hosts/web_dev

View File

@ -1 +0,0 @@
../../../config/hosts/web_prod

View File

@ -1,6 +1,6 @@
if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi if [ -z "$1" ]; then echo "Must supply name"; exit 0; fi
source ./hosts.config source ./config.hosts
server=$M_HOST_PROD server=$M_HOST_PROD
ssh $1@$server "tail -n 100 -f run.log" ssh $1@$server "tail -n 100 -f run.log"

View File

@ -2,6 +2,7 @@ set -x
M_HOST=$1 M_HOST=$1
scp apache-james-3.0*.tar.gz james@$M_HOST:
scp setup-james.remote james@$M_HOST: scp setup-james.remote james@$M_HOST:
ssh james@$M_HOST ./setup-james.remote ssh james@$M_HOST ./setup-james.remote

View File

@ -1,11 +1,23 @@
set -x 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 cd apache-james
mv conf conf-original mv conf conf-original
ln -s ../apache-james-conf conf 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 echo The final pieces will be installed during deploy

View File

@ -4,7 +4,8 @@
sudo add-apt-repository ppa:webupd8team/java --yes sudo add-apt-repository ppa:webupd8team/java --yes
sudo apt-get update 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 "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" echo "read this: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html"

View File

@ -5,6 +5,8 @@ set -x
M_HOST=$1 M_HOST=$1
./create-server-accounts $M_HOST ./create-server-accounts $M_HOST
./setup-utils $M_HOST
./setup-james $M_HOST ./setup-james $M_HOST
./setup-java $M_HOST ./setup-java $M_HOST
./setup-mysql $M_HOST ./setup-mysql $M_HOST

8
install/setup-utils Normal file
View 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
View 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

View File

@ -30,6 +30,7 @@ public class PushDb
{ {
cryptor = new CryptorRSAAES(new CryptorRSAJCE(ExternalResource.getResourceAsStream(getClass(), "keystore.jks"), null)); cryptor = new CryptorRSAAES(new CryptorRSAJCE(ExternalResource.getResourceAsStream(getClass(), "keystore.jks"), null));
mailExtra = new MailExtraDb(); mailExtra = new MailExtraDb();
mailExtra.ensureTables();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -4,7 +4,9 @@
*/ */
package mail.streamserver; package mail.streamserver;
import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.sql.SQLException;
import java.util.Random; import java.util.Random;
import mail.server.db.MailUserDb; import mail.server.db.MailUserDb;
@ -35,11 +37,12 @@ public class MailServerSessionDb implements SRPServerUserSessionDb
MailExtraDb payment; MailExtraDb payment;
Captcha captcha; Captcha captcha;
public MailServerSessionDb (MailUserDb db) public MailServerSessionDb (MailUserDb db) throws SQLException, IOException
{ {
this.db = db; this.db = db;
this.captcha = new Captcha(); this.captcha = new Captcha();
this.payment = new MailExtraDb(); this.payment = new MailExtraDb();
payment.ensureTables();
} }
public void setBlock (String userName, byte[] block) throws Exception public void setBlock (String userName, byte[] block) throws Exception

View File

@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
import core.constants.ConstantsServer; import core.constants.ConstantsServer;
import core.server.captcha.Captcha; import core.server.captcha.Captcha;
import core.util.ExternalResource;
import core.util.LogNull; import core.util.LogNull;
import core.util.LogOut; import core.util.LogOut;
@ -68,30 +69,37 @@ public class CaptchaResponse extends HttpServlet {
doCors(response); doCors(response);
response.setContentType("application/json"); response.setContentType("application/json");
String remoteAddr = request.getRemoteAddr(); try
ReCaptchaImpl reCaptcha = new ReCaptchaImpl(); {
reCaptcha.setPrivateKey("YOUR_PRIVATE_KEY"); String remoteAddr = request.getRemoteAddr();
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
reCaptcha.setPrivateKey(ExternalResource.getTrimmedString("captcha_private_key"));
String challenge = request.getParameter("recaptcha_challenge_field"); String challenge = request.getParameter("recaptcha_challenge_field");
String uresponse = request.getParameter("recaptcha_response_field"); String uresponse = request.getParameter("recaptcha_response_field");
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse); ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
if (reCaptchaResponse.isValid()) if (reCaptchaResponse.isValid())
{ {
try try
{ {
String token = captcha.captchaSucceeded(); String token = captcha.captchaSucceeded();
response.getWriter().write(("{'succeeded':true,'token':'" + token + "'}").replaceAll("'", "\"")); response.getWriter().write(("{'succeeded':true,'token':'" + token + "'}").replaceAll("'", "\""));
} }
catch (Exception e) catch (Exception e)
{ {
response.getWriter().write("{'succeeded':false,'reason':'System error'}".replaceAll("'", "\"")); response.getWriter().write("{'succeeded':false,'reason':'System error'}".replaceAll("'", "\""));
} }
} }
else else
{ {
response.getWriter().write("{'succeeded':false,'reason':'User error'}".replaceAll("'", "\"")); 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 @Override

Some files were not shown because too many files have changed in this diff Show More