Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793899
lxc-container-mailserver-start.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
lxc-container-mailserver-start.sh
View Options
#!/bin/sh
# -------------------------------------------------------------
# Nasqueron mail services
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2015-12-16
# License: Trivial work, not eligible to copyright
# Source file: roles/mailserver/systemd-unit/files/lxc-container-mailserver-start.sh
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
#Let systemd launch a lxc mail container through
#/usr/lib/systemd/system/lxc-container-mailserver.service
#
#Start a lxc container, and create iptable rules
IPTABLES
=
"/usr/sbin/iptables"
LXC_START
=
"/usr/bin/lxc-start"
CONTAINER_NAME
=
"mailserver"
HOST_INTERFACE
=
"ens192"
DOCKER_INTERFACE
=
"docker0"
HOST_IP
=
"212.129.32.223"
CONTAINER_IP
=
"10.0.3.8"
PORTS
=
"25 110 143 465 587"
DOCKER_PORTS
=
"25 143 465 587"
NGINX_PORT
=
"21080"
$LXC_START
-n
$CONTAINER_NAME
-d
#Web rules
for
PORT in
$PORTS
do
$IPTABLES
-t nat -I PREROUTING -i
$HOST_INTERFACE
-p TCP -d
$HOST_IP
/32 --dport
$PORT
-j DNAT --to-destination
$CONTAINER_IP
:
$PORT
done
#Need 80 port for main nginx
$IPTABLES
-t nat -I PREROUTING -i
$HOST_INTERFACE
-p TCP -d
$HOST_IP
/32 --dport
$NGINX_PORT
-j DNAT --to-destination
$CONTAINER_IP
:80
#Docker rules
for
PORT in
$DOCKER_PORTS
do
$IPTABLES
-t nat -I PREROUTING -i
$DOCKER_INTERFACE
-p TCP -d
$HOST_IP
/32 --dport
$PORT
-j DNAT --to-destination
$CONTAINER_IP
:
$PORT
done
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Fri, Feb 28, 22:47 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2438288
Default Alt Text
lxc-container-mailserver-start.sh (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment