develop csync container

This commit is contained in:
2016-06-06 21:03:58 +01:00
parent 28e6361194
commit a81bdbf983
9 changed files with 75 additions and 48 deletions

View File

@@ -1,10 +1,12 @@
## Configuration
export_env CSYNC_VERSION 2.0
export_env CSYNC_CONFIG /host/etc/csync/csync2.cfg
export_env CSYNC_DATABASE /host/var/lib/csync
export_env CSYNC_LOG /host/var/log/csync.log
export_env LSYNC_CONFIG /host/etc/lsyncd.conf
export_env LSYNC_LOG /host/var/log/lsyncd.log
export_env LSYNC_STATUS /host/var/log/lsyncd_status.log
export_env HOSTALIASES /host/etc/host.aliases
export_env HOSTALIASES /host/etc/host_aliases
## Dependencies
apt_install_permanent librsync-dev libsqlite3-dev libgnutls28-dev pkg-config
@@ -15,6 +17,7 @@ wget http://oss.linbit.com/csync2/csync2-$CSYNC_VERSION.tar.gz
tar xzvf csync2-$CSYNC_VERSION.tar.gz
cd csync2-$CSYNC_VERSION
./configure
sed -i 's/\(verify_peername(\(const[^)]*\))\)/\1 {return 1;} int disabled(\2)/' daemon.c
make
make install
make cert
@@ -22,29 +25,11 @@ make cert
## Address aliases
cd /opt
mv /addr_aliases.c .
gcc -fPIC -shared -o addr_aliases.so addr_aliases.c
gcc -fPIC -shared -o addr_aliases.so addr_aliases.c -ldl
mkdir -p /host/etc/
touch /host/etc/addr_aliases
echo /opt/addr_aliases.so >> /etc/ld.so.preload
## Xinetd
apt_install_permanent xinetd
## Configuration
cat << EOF > /etc/xinetd.d/csync2
service csync2
{
disable = no
protocol = tcp
socket_type = stream
wait = no
user = root
server = /usr/local/sbin/csync2
server_args = -i
}
EOF
echo "csync2 30865/tcp" >> /etc/services
## Lsyncd dependencies
apt_install_permanent lua5.2 liblua5.2-dev bash-completion

View File

@@ -6,16 +6,18 @@ mkdir /var/run/sshd
cd /opt
AUTHORIZED_KEYS=/root/.ssh/authorized_keys
DIR=`dirname "$AUTHORIZED_KEYS"`
mkdir -p "$DIR"
chmod 700 "$DIR"
chown root:root "$DIR"
pwd
ssh-keygen -t rsa -N "" -f id_rsa
cat /opt/id_rsa.pub >> "$AUTHORIZED_KEYS"
mkdir -p $DIR
chmod 700 $DIR
cp /opt/id_rsa $DIR
cat /opt/id_rsa.pub >> $AUTHORIZED_KEYS
## X11 forwarding
apt_install_permanent xauth
## Configuration
echo "ListenAddress 0.0.0.0" >> /etc/ssh/sshd_config
## Setup environment
sed -i "1iexport HOME=/root" /root/.profile
sed -i "1isource /etc/container_environment.sh" /root/.profile
echo "export HOME=/root" >> /root/.profile
echo "source /etc/container_environment.sh" >> /root/.profile