Archiv

Artikel Tagged ‘Debian’

Installing amtu on Debian Lenny (Etch) as non-root

23. März 2010 Kommentare ausgeschaltet

The secure installation of amtu on Debian has some pitfalls. The problem is that amtu uses java.util.prefs.Preferences#systemNodeForPackage instead of java.util.prefs.Preferences#userNodeForPackage (com.amazon.merchants.transport.preferences.UserAccountPreferences). This leads to the problem that the configuration is not stored as non-root user or even more unpredictable: It is stored if you do the configuration as root and cannot be read or updated with another user. The fact that the configuration is stored in the directory /usr/lib/jvm/java-6-sun/.systemPrefs -> /etc/.java/.systemPrefs, which I have never used before, doesn’t make the thing easier. So heres a quick guide for setting up amtu on Debian:

sudo useradd -d /var/lib/amtu -s /bin/bash amtu
sudo mkdir /usr/local/share/amtu /var/lib/amtu /var/log/amtu
cd /usr/local/share/amtu
sudo tar xzvf .../amtu-linux-1.0.9.tar.gz
sudo -s
export JAVA_HOME=/usr/lib/jvm/java-6-sun
./install.sh
exit
sudo /etc/init.d/amt stop; sudo /etc/init.d/amt_monitor stop
cd /usr/local/share/amtu/service/bin
sudo mv data /var/lib/amtu/
sudo ln -s /var/lib/amtu/data .
cd /var/lib/amtu
sudo rm -rf logs
sudo ln -s /var/log/amtu logs
sudo chown -R amtu:amtu data
sudo chown -R amtu:amtu -R /etc/.java /var/lib/amtu /var/log/amtu

Next we change the user the service runs as:
* PIDDIR=”/var/lib/amtu”
* RUN_AS_USER=amtu

sudo vi /etc/init.d/amt
sudo vi /etc/init.d/amt_monitor

Now we change the logging:
* wrapper.java.command=/usr/lib/jvm/java-6-sun/bin/java
* wrapper.logfile=/var/log/amtu/-wrapper.log
* wrapper.logfile.maxsize=1m
* wrapper.logfile.maxfiles=2

sudo vi /usr/local/share/amtu/service/conf/amt.conf
sudo vi /usr/local/share/amtu/service/conf/monitor.conf

Cleanup & start

sudo chsh -s /bin/false amtu
sudo /etc/init.d/amt start; sudo /etc/init.d/amt_monitor start

Debugging:
The wrapper around amtu swallows exceptions. So running within the wrapper I have never seen an error, I have to call the Service on its own via:

amtu@sten:/usr/local/share/amtu/service/bin$ /usr/lib/jvm/java-6-sun/bin/java \
        -Dlog4j.configuration=/usr/local/share/amtu/service/conf/log4j.properties \
-Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder \
        -Djava.library.path=../lib -classpath \ ../../lib/mx4j.jar:../../lib/mx4j-impl.jar:../../lib/mx4j-jmx.jar:../../lib/commons-lang-2.0.jar:../../lib/commons-logging.jar:../../lib/log4j-1.2.8.jar:../../lib/hsqldb.jar:../../lib/activation.jar:../../lib/mailapi.jar:../../lib/saaj.jar:../../lib/commons-discovery.jar:../../lib/jaxrpc.jar:../../lib/wsdl4j.jar:../../lib/jakarta-commons-io-SNAPSHOT.jar:../../lib/amtu.jar:../../lib/axis.jar:../../lib/mx4j-remote.jar:../../lib/mx4j-rimpl.jar:../../lib/mx4j-rmjx.jar:../../lib/mx4j-tools.jar \
        com.amazon.merchants.transport.TransportMain transport

The intervals when amtu connects to amazon are quiet long for debugging, you can change them here: /etc/.java/.systemPrefs/com/amazon/merchants/transport/preferences/prefs.xml

KategorienAllgemein Tags: ,