GNU/Linux >> Tutoriales Linux >  >> Panels >> Panels

Configure Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa

Incluye:Shorewall, NAT, servidor de nombres en caché, servidor DHCP, servidor VPN, Webmin, Munin, Apache (SSL habilitado), Squirrelmail, configuración de Postfix con dominios virtuales, courier imap imaps pop3 pop3s, autenticación sasl para road warriors, MailScanner como un contenedor para SpamAssassin, Razor, ClamAV, etc. Samba instalado, no configurado.

Necesita muy poco mantenimiento y es extensible más allá de su imaginación más salvaje. Todo dependiendo del hardware utilizado, por supuesto.

Esto es solo un procedimiento de COPIAR Y PEGAR. Para más información usa la red. Lo hice... Sin embargo, ¡las contribuciones y sugerencias son siempre bienvenidas! Sé que esto se puede hacer mejor, así que siéntete libre.

Debería haber basado este tutorial en 6.06 LTS de inmediato, debido a LTS. Lo siento por eso. Debido a algunos cambios menores pero importantes necesarios para que esto funcione con Ubuntu 6.06 LTS, lo escribí de nuevo.

Si alguno de ustedes puede encontrar el tiempo para agregar una buena instalación y configuración para snort AND snortsam, incluido un panel de control integral, se lo agradecería.

Alcance:crear un cortafuegos/puerta de enlace (de correo) para una red pequeña (digamos de 10 a 15 usuarios más o menos en un PIII de 450 MHz, 512 MB de RAM y dos tarjetas de interfaz de red idénticas, conexión de banda ancha, con todas las funciones, para un entorno empresarial. Mejores especificaciones de su hardware (especialmente la cantidad de RAM) mejorará significativamente el rendimiento de su servidor. Las especificaciones mencionadas son mínimas para los clientes no tan exigentes, solo para indicar que si realmente lo desea, se puede hacer de hecho (se debe aunque algunos retoques después).

Audiencia esperada:(principiante) sysop.

Este tutorial conduce a un sistema sólido 'listo para usar'. Creo que la parte divertida (ajustar y afinar, etc.) comienza cuando terminas. Es posible que desee inspeccionar sus registros para encontrar pistas sobre dónde debe comenzar el ajuste. Munin también podría contarte muchas cosas.

¡Diviértete!

Primero, haga una instalación limpia usando Ubuntu-Server 6.06 LTS. Durante la instalación, la configuración adecuada para eth0 se detectará automáticamente. Si esto falla, cambie los cables de red y vuelva a intentarlo. Existe una posibilidad muy pequeña de que su ISP no ejecute un servidor DHCP (nunca he visto que eso suceda), o simplemente podría estar inactivo (lo he visto varias veces, también pueden arruinar su DNS de vez en cuando), en En cuyo caso, usted está solo, es mejor esperar hasta que terminen de arreglarlo. Así que comenzamos con una dirección asignada por DHCP para eth0. Esta es solo una manera fácil de averiguar qué NIC es realmente eth0. Si ya sabe cuál es cuál, es mejor que comience con una dirección estática para eth0. Si su ISP no es malo, tiene la configuración adecuada para ello.

Ahora proceda y acepte todos los valores predeterminados (pero es posible que desee hacer su propia partición), no instale LAMP.

Ahora inicie sesión como el nuevo usuario que acaba de crear y haga:

sudo passwd

Ahora ingrese su contraseña nuevamente. A continuación, ingrese la nueva contraseña para el usuario "root" y confirme. Así que eliminamos la desagradable experiencia de sudo (un poco extraño en un servidor, ¿no?) Ahora cierre la sesión y vuelva a iniciar sesión como root con la nueva contraseña de root.

Usando vim (o su editor favorito) edite /etc/apt/sources.list. Comente el repositorio de cd. A continuación, agregue "universo" (sin las comillas) a todas las líneas que no estén comentadas y elimine los comentarios de los repositorios de backport. Guarde el archivo.

Edite /etc/network/interfaces y agregue lo siguiente en la parte inferior:

auto eth1
iface eth1 inet static
	address		192.168.1.1
	netmask	        255.255.255.0
	broadcast	192.168.1.255
	network		192.168.1.0

Tenga en cuenta que el resto de este tutorial asume que realmente realiza la configuración para eth1 como se muestra.

Mi full/etc/network/interfaces se ve así:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
	address		192.168.1.1
	netmask		255.255.255.0
	broadcast	192.168.1.255
	network		192.168.1.0

Como puede ver, mi eth0 obtiene su configuración mediante DHCP.

Guarda el archivo. Siguiente paso:

apt-get update
apt-get install openssh-server
apt-get upgrade

Durante el proceso de actualización, se instala una nueva imagen del núcleo. Entonces haz lo siguiente:

reboot

El resto de esto lo puede hacer desde su estación de trabajo, ya sea Linux o el otro (debe tener PuTTY), para que pueda copiar y pegar. Simplemente inicie sesión en 192.168.1.1 como root y continúe.

Asegúrese de que la configuración de red de su estación de trabajo coincida con la configuración de eth1 de su servidor

Si está confundido aquí, primero configure e inicie su servidor DHCP como se muestra en este artículo, y deje que su estación de trabajo detecte la configuración adecuada automáticamente.

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 2

Ahora haz:

apt-get install libmd5-perl libnet-ssleay-perl libauthen-pam-perl libio-pty-perl shorewall dnsmasq openssl
wget http://surfnet.dl.sourceforge.net/sourceforge/webadmin/webmin_1.390_all.deb

"surfnet" es el servidor holandés. Cámbielo a "heanet" (para Irlanda), "belnet" (para Bélgica), "mesh" (para Alemania) y así sucesivamente.

dpkg -i webmin_1.390_all.deb
cp /usr/share/doc/shorewall/examples/two-interfaces/* /etc/shorewall/
cd /etc/shorewall
gunzip interfaces.gz masq.gz rules.gz

Ahora abra su navegador e inicie sesión en webmin en https://192.168.1.1:10000 como root con su contraseña de root y, utilizando el módulo Shorewall de webmin, cambie las políticas y reglas de su firewall según sea necesario (por ahora, solo configuro las reglas archivo al ejemplo como se muestra, puede copiar y pegar mi archivo de reglas para empezar, si no le gusta webmin).

También configure en /etc/shorewall/shorewall.conf  la línea "IP_FORWARDING=Keep"  a  "IP_FORWARDING=On" (sin comillas)
y habilite el firewall en /etc/default/shorewall.

Mi /etc/shorewall/rules ahora tiene este aspecto:

#############################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/
# PORT PORT(S) DEST LIMIT GROUP
# PORT PORT(S) DEST LIMIT GROUP
#
# Accept DNS connections from the firewall to the network
#
DNS/ACCEPT $FW net
ACCEPT $FW net all
ACCEPT $FW loc all
ACCEPT loc $FW all
#
# Accept SSH connections from the local network for administration
#
SSH/ACCEPT loc $FW
#
# Allow Ping from the local network
#
Ping/ACCEPT loc $FW
#
# Reject Ping from the "bad" net zone.. and prevent your log from being flooded..
#
Ping/REJECT net $FW
ACCEPT $FW loc icmp
ACCEPT $FW net icmp
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
Siguiente haz:
rm /etc/shorewall/README.txt Makefile
/etc/init.d/shorewall start

Ahora debería poder navegar por la red.

NO CONTINÚE HASTA QUE CONSIGA NAVEGAR POR LA RED. YA QUE ESTE ES SU MARCO. TIENE QUE ESTAR BIEN.

Configure Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 3

Así que ahora necesitamos algunos paquetes. Hacer (¡todo en una sola línea!):

apt-get install clamav-daemon xfsdump razor pyzor mailscanner spamc spamassassin postfix courier-authmysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-modules-sql sasl2-bin libpam-mysql build-essential dpkg-dev fakeroot debhelper libdb4.2-dev libgdbm-dev libldap2-dev libpcre3-dev libmysqlclient12-dev libssl-dev libsasl2-dev postgresql-dev po-debconf dpatch zoo unzip arj rdate fetchmail zip ncftp zlib1g-dev libpopt-dev nmap lynx fileutils curl imagemagick squirrelmail squirrelmail-locales munin munin-node ntp nfs-kernel-server samba unzoo mysql-server mysql-client libapache2-mod-php4 libapache2-mod-perl2 php4 php4-cli php4-common php4-curl php4-dev php4-domxml php4-gd php4-imap php4-ldap php4-mcal php4-mhash php4-mysql php4-odbc php4-pear php4-xslt curl php-pear mailx libzzip-dev libgmp3c2 libgmp3-dev dhcp3-server pptpd

Acepte todos los valores predeterminados.

Ahora haz:

mysqladmin -u root password yourrootsqlpassword

¡UTILICE UNA CONTRASEÑA REAL AQUÍ!

Ahora configure Apache y Squirrelmail.

/usr/sbin/squirrelmail-configure

Establézcalo en courier (opción D) y haga ik como desee.
No olvide habilitar algunos complementos y establecer un idioma predeterminado si lo desea. También sugiero configurar esto:

$show_contain_subfolders_option = true;

Mi/etc/squirrelmail/config.php ahora se ve así:(Solo mi configuración actual. No copie esto, utilícelo como referencia).

<?php

/**
* SquirrelMail Configuration File
* Created using the configure script, conf.pl
*/

global $version;
$config_version = '1.4.0';
$config_use_color = 2;

$org_name = "Lürsen";
$org_logo = SM_PATH . 'images/sm_logo.png';
$org_logo_width = '564';
$org_logo_height = '261';
$org_title = "Lürsen";
$signout_page = 'https://lursen.net/webmail';
$frame_top = '_top';

$provider_uri = 'http://www.squirrelmail.org/';

$provider_name = 'SquirrelMail';

$motd = "";

$squirrelmail_default_language = 'nl_NL';
$default_charset = 'iso-8859-1';
$lossy_encoding = false;

$domain = 'lursen.net';
$imapServerAddress = 'localhost';
$imapPort = 143;
$useSendmail = false;
$smtpServerAddress = 'localhost';
$smtpPort = 25;
$sendmail_path = '/usr/sbin/sendmail';
$sendmail_args = '-i -t';
$pop_before_smtp = false;
$imap_server_type = 'courier';
$invert_time = false;
$optional_delimiter = '.';
$encode_header_key = '';

$default_folder_prefix = 'INBOX.';
$trash_folder = 'Trash';
$sent_folder = 'Sent';
$draft_folder = 'Drafts';
$default_move_to_trash = true;
$default_move_to_sent = true;
$default_save_as_draft = true;
$show_prefix_option = false;
$list_special_folders_first = true;
$use_special_folder_color = true;
$auto_expunge = true;
$default_sub_of_inbox = false;
$show_contain_subfolders_option = true;
$default_unseen_notify = 2;
$default_unseen_type = 1;
$auto_create_special = true;
$delete_folder = true;
$noselect_fix_enable = false;

$data_dir = '/var/lib/squirrelmail/ data/';
$attachment_dir = '/var/spool/squirrelmail/attach/';
$dir_hash_level = 0;
$default_left_size = '150';
$force_username_lowercase = false;
$default_use_priority = true;
$hide_sm_attributions = false;
$default_use_mdn = true;
$edit_identity = true;
$edit_name = true;
$hide_auth_header = false;
$allow_thread_sort = false;
$allow_server_sort = false;
$allow_charset_search = true;
$uid_support = true;

$plugins[0] = 'abook_take';
$plugins[1] = 'delete_move_next';
$plugins[2] = 'calendar';
$plugins[3] = 'filters';
$plugins[4] = 'message_details';
$plugins[5] = 'mail_fetch';
$plugins[6] = 'newmail';

$theme_css = '';
$theme_default = 0;
$theme[0]['PATH'] = SM_PATH . 'themes/default_theme.php';
$theme[0]['NAME'] = 'Default';
$theme[1]['PATH'] = SM_PATH . 'themes/plain_blue_theme.php';
$theme[1]['NAME'] = 'Plain Blue';
$theme[2]['PATH'] = SM_PATH . 'themes/sandstorm_theme.php';
$theme[2]['NAME'] = 'Sand Storm';
$theme[3]['PATH'] = SM_PATH . 'themes/deepocean_theme.php';
$theme[3]['NAME'] = 'Deep Ocean';
$theme[4]['PATH'] = SM_PATH . 'themes/slashdot_theme.php';
$theme[4]['NAME'] = 'Slashdot';
$theme[5]['PATH'] = SM_PATH . 'themes/purple_theme.php';
$theme[5]['NAME'] = 'Purple';
$theme[6]['PATH'] = SM_PATH . 'themes/forest_theme.php';
$theme[6]['NAME'] = 'Forest';
$theme[7]['PATH'] = SM_PATH . 'themes/ice_theme.php';
$theme[7]['NAME'] = 'Ice';
$theme[8]['PATH'] = SM_PATH . 'themes/seaspray_theme.php';
$theme[8]['NAME'] = 'Sea Spray';
$theme[9]['PATH'] = SM_PATH . 'themes/bluesteel_theme.php';
$theme[9]['NAME'] = 'Blue Steel';
$theme[10]['PATH'] = SM_PATH . 'themes/dark_grey_theme.php';
$theme[10]['NAME'] = 'Dark Grey';
$theme[11]['PATH'] = SM_PATH . 'themes/high_contrast_theme.php';
$theme[11]['NAME'] = 'High Contrast';
$theme[12]['PATH'] = SM_PATH . 'themes/bla ck_bean_burrito_theme.php';
$theme[12]['NAME'] = 'Black Bean Burrito';
$theme[13]['PATH'] = SM_PATH . 'themes/servery_theme.php';
$theme[13]['NAME'] = 'Servery';
$theme[14]['PATH'] = SM_PATH . 'themes/maize_theme.php';
$theme[14]['NAME'] = 'Maize';
$theme[15]['PATH'] = SM_PATH . 'themes/bluesnews_theme.php';
$theme[15]['NAME'] = 'BluesNews';
$theme[16]['PATH'] = SM_PATH . 'themes/deepocean2_theme.php';
$theme[16]['NAME'] = 'Deep Ocean 2';
$theme[17]['PATH'] = SM_PATH . 'themes/blue_grey_theme.php';
$theme[17]['NAME'] = 'Blue Grey';
$theme[18]['PATH'] = SM_PATH . 'themes/dompie_theme.php';
$theme[18]['NAME'] = 'Dompie';
$theme[19]['PATH'] = SM_PATH . 'themes/methodical_theme.php';
$theme[19]['NAME'] = 'Methodical';
$theme[20]['PATH'] = SM_PATH . 'themes/greenhouse_effect.php';
$theme[20]['NAME'] = 'Greenhouse Effect (Changes)';
$theme[21]['PATH'] = SM_PATH . 'themes/in_the_pink.php';
$theme[21]['NAME'] = 'In The Pink (Changes)';
$theme[22]['PATH'] = SM_PATH . 'themes/kind_of_blue.php';
$theme[22]['NAME'] = 'Kind of Blue (Changes)';
$theme[23]['PATH'] = SM_PATH . 'themes/monostochastic.php';
$theme[23]['NAME'] = 'Monostochastic (Changes)';
$theme[24]['PATH'] = SM_PATH . 'themes/shades_of_grey.php';
$theme[24]['NAME'] = 'Shades of Grey (Changes)';
$theme[25]['PATH'] = SM_PATH . 'themes/spice_of_life.php';
$theme[25]['NAME'] = 'Spice of Life (Changes)';
$theme[26]['PATH'] = SM_PATH . 'themes/spice_of_life_lite.php';
$theme[26]['NAME'] = 'Spice of Life - Lite (Changes)';
$theme[27]['PATH'] = SM_PATH . 'themes/spice_of_life_dark.php';
$theme[27]['NAME'] = 'Spice of Life - Dark (Changes)';
$theme[28]['PATH'] = SM_PATH . 'themes/christmas.php';
$theme[28]['NAME'] = 'Holiday - Christmas';
$theme[29]['PATH'] = SM_PATH . 'themes/darkness.php';
$theme[29]['NAME'] = 'Darkness (Changes)';
$theme[30]['PATH'] = SM_PATH . 'themes/random.php';
$theme[30]['NAME'] = 'Random (Changes every login)';
$theme[31]['PATH'] = SM _PATH . 'themes/midnight.php';
$theme[31]['NAME'] = 'Midnight';
$theme[32]['PATH'] = SM_PATH . 'themes/alien_glow.php';
$theme[32]['NAME'] = 'Alien Glow';
$theme[33]['PATH'] = SM_PATH . 'themes/dark_green.php';
$theme[33]['NAME'] = 'Dark Green';
$theme[34]['PATH'] = SM_PATH . 'themes/penguin.php';
$theme[34]['NAME'] = 'Penguin';
$theme[35]['PATH'] = SM_PATH . 'themes/minimal_bw.php';
$theme[35]['NAME'] = 'Minimal BW';
$theme[36]['PATH'] = SM_PATH . 'themes/redmond.php';
$theme[36]['NAME'] = 'Redmond';
$theme[37]['PATH'] = SM_PATH . 'themes/netstyle_theme.php';
$theme[37]['NAME'] = 'Net Style';
$theme[38]['PATH'] = SM_PATH . 'themes/silver_steel_theme.php';
$theme[38]['NAME'] = 'Silver Steel';
$theme[39]['PATH'] = SM_PATH . 'themes/simple_green_theme.php';
$theme[39]['NAME'] = 'Simple Green';
$theme[40]['PATH'] = SM_PATH . 'themes/wood_theme.php';
$theme[40]['NAME'] = 'Wood';
$theme[41]['PATH'] = SM_PATH . 'themes/bluesome.php';
$theme[41]['NAME'] = 'Bluesome';
$theme[42]['PATH'] = SM_PATH . 'themes/simple_green2.php';
$theme[42]['NAME'] = 'Simple Green 2';
$theme[43]['PATH'] = SM_PATH . 'themes/simple_purple.php';
$theme[43]['NAME'] = 'Simple Purple';
$theme[44]['PATH'] = SM_PATH . 'themes/autumn.php';
$theme[44]['NAME'] = 'Autumn';
$theme[45]['PATH'] = SM_PATH . 'themes/autumn2.php';
$theme[45]['NAME'] = 'Autumn 2';
$theme[46]['PATH'] = SM_PATH . 'themes/blue_on_blue.php';
$theme[46]['NAME'] = 'Blue on Blue';
$theme[47]['PATH'] = SM_PATH . 'themes/classic_blue.php';
$theme[47]['NAME'] = 'Classic Blue';
$theme[48]['PATH'] = SM_PATH . 'themes/classic_blue2.php';
$theme[48]['NAME'] = 'Classic Blue 2';
$theme[49]['PATH'] = SM_PATH . 'themes/powder_blue.php';
$theme[49]['NAME'] = 'Powder Blue';
$theme[50]['PATH'] = SM_PATH . 'themes/techno_blue.php';
$theme[50]['NAME'] = 'Techno Blue';
$theme[51]['PATH'] = SM_PATH . 'themes/turquoise.php';
$theme[51]['NAME'] = 'Turquoise';

$default_use_jav ascript_addr_book = false;
$abook_global_file = '';
$abook_global_file_writeable = false;

$addrbook_dsn = '';
$addrbook_table = 'address';

$prefs_dsn = '';
$prefs_table = 'userprefs';
$prefs_user_field = 'user';
$prefs_key_field = 'prefkey';
$prefs_val_field = 'prefval';
$addrbook_global_dsn = '';
$addrbook_global_table = 'global_abook';
$addrbook_global_writeable = false;
$addrbook_global_listing = false;

$no_list_for_subscribe = false;
$smtp_auth_mech = 'none';
$imap_auth_mech = 'login';
$use_imap_tls = false;
$use_smtp_tls = false;
$session_name = 'SQMSESSID';

$config_location_base = '';

@include SM_PATH . 'config/config_local.php';

/**
* Make sure there are no characters after the PHP closing
* tag below (including newline characters and whitespace).
* Otherwise, that character will cause the headers to be
* sent and regular output to begin, which will majorly screw
* things up when we try to send more headers later.
*/
?>

Siguiente haz:

apache2-ssl-certificate -days 3650

¡Complete el nombre del servidor correcto!

Es decir:la dirección en la que planea dar a sus usuarios acceso a Squirrelmail o cualquier otro servicio de apache en el puerto 443. Solo el dominio servirá (DEBE EXISTIR EN DNS). No dominio/webmail.

Si algo salió mal, simplemente elimine el certificado y repita este paso.

Ahora ingrese:

a2enmod ssl
a2enmod rewrite
a2enmod include
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/https
ln -s /etc/apache2/sites-available/https /etc/apache2/sites-enabled/https
ln -s /etc/squirrelmail/apache.conf /etc/apache2/sites-enabled/squirrelmail

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 4

A continuación, edite /etc/courier/imapd-ssl y cambie lo siguiente:

TLS_CERTFILE=/etc/apache2/ssl/apache.pem

Ahora haz lo mismo con tu /etc/courier/pop3d-ssl.

Ahora edite /etc/apache2/sites-disponible/default. La parte superior tiene que cambiarse para que diga:

NameVirtualHost *:80
<VirtualHost *:80>

Edite /etc/apache2/sites-disponible/https también, la parte superior del archivo debería decir:

NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
Edite /etc/squirrelmail/apache.conf Debería verse así:
Alias /webmail /usr/share/squirrelmail

<Directory /usr/share/squirrelmail>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>

# access to configtest is limited by default to prevent information leak
<Files configtest.php>
order deny,allow
deny from all
allow from 127.0.0.1
</Files>
</Directory>
# users will prefer a simple URL like http://webmail.example.com
#<VirtualHost 1.2.3.4>
# DocumentRoot /usr/share/squirrelmail
# ServerName webmail.example.com
#</VirtualHost>
# redirect to https when available (thanks [email protected])
#
# Note: There are multiple ways to do this, and which one is suitable for
# your site's configuration depends. Consult the apache documentation if
# you're unsure, as this example might not work everywhere.
#
<IfModule mod_rewrite.c>
<IfModule mod_ssl.c>
<Location /webmail>
RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]
</Location>
</IfModule>
</IfModule>

Ahora asegúrese de que la línea DirectoryIndex en /etc/apache2/apache2.conf diga:

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

Edite /etc/apache2/ports.conf y agregue Listen 443:

Listen 80
Listen 443

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 5

Ahora haz que Squirrelmail hable tu idioma. Si solo usa inglés, puede omitir la última línea del archivo, por supuesto.

Edite /var/lib/locales/supported.d/local.

Debería verse así:(si es holandés, de lo contrario, ajústelo como desee). Lo principal es habilitar su configuración regional con el juego de caracteres ISO-8859-1.

en_US.UTF-8 UTF-8
en_US.ISO-8859-1	ISO-8859-1
nl_NL.ISO-8859-1	ISO-8859-1

dpkg-reconfigure locales

Ahora configuramos postfix.

postconf -e 'mynetworks = 127.0.0.0/8, 192.168.1.0/24'
postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'

postconf -e 'smtpd_recipient_restrictions =permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'

postconf -e 'inet_interfaces = all'
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/apache2/ssl/apache.pem'
postconf -e 'smtpd_tls_cert_file = /etc/apache2/ssl/apache.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
postconf -e 'header_checks = regexp:/etc/postfix/header_checks'
postconf -e 'relayhost ='
postconf -e 'virtual_alias_domains = hash:/etc/postfix/virtual'
postconf -e 'virtual_alias_maps = hash:/etc/postfix/virtual'
postconf -e 'smtp_never_send_ehlo = yes'
touch /etc/postfix/header_checks
touch /etc/postfix/virtual

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 6

Ahora edite etc/postfix/header_checks.

Debería verse así:

/^Received:/ HOLD

cd /root
Ahora configure MailScanner.
chown postfix.postfix /var/spool/MailScanner/incoming
chown postfix.postfix /var/spool/MailScanner/quarantine
mkdir /var/spool/MailScanner/spamassassin
ln -s /etc/MailScanner/spam.assassin.prefs.conf /etc/spamassassin/mailscanner.cf
chown postfix.postfix /var/spool/MailScanner/spamassassin

Ahora edite /etc/MailScanner/MailScanner.conf y configure las siguientes líneas como se muestra:

Run As User = postfix
Run As Group = postfix
Queue Scan Interval = 120
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
Virus Scanners = clamav
Always Include SpamAssassin Report = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
Quite el comentario de la línea # run_mailscanner=1 en su archivo /etc/default/mailscanner.

Ahora haga un trabajo cron de /usr/sbin/check_mailscanner y ejecútelo cada 20 minutos.

Ahora vamos a engañar al script de inicio de MailScanner. Esto es necesario porque MailScanner se niega a iniciar, debido a un script dirigido a exim, sospecho (nunca he usado Exim, así que no estoy seguro). No quiero modificar la secuencia de comandos en sí, ya que podría ser reemplazada por otra actualización que "no se inicia" en el futuro. Solo para estar seguro.

touch /etc/init.d/mailscanner_pre

Edite /etc/init.d/mailscanner_pre. Debería verse así:

#!/bin/sh
mkdir /var/lock/subsys
mkdir /var/lock/subsys/MailScanner
mkdir /var/run/MailScanner
chown postfix.postfix /var/run/MailScanner
chown postfix.postfix /var/lock/subsys/MailScanner

chmod 755 /etc/init.d/mailscanner_pre
mv /etc/rc2.d/S20mailscanner /etc/rc2.d/S99mailscanner
mv /etc/rc3.d/S20mailscanner /etc/rc3.d/S99mailscanner
mv /etc/rc4.d/S20mailscanner /etc/rc4.d/S99mailscanner
mv /etc/rc5.d/S20mailscanner /etc/rc5.d/S99mailscanner
ln -s /etc/init.d/mailscanner_pre /etc/rc2.d/S20mailscanner_pre
chown postfix.postfix /var/spool/MailScanner
chown postfix.postfix /var/lib/MailScanner

Eso debería funcionar ahora, ¿no estás de acuerdo?

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 7

Ahora configure la autenticación sasl.

mkdir -p /var/spool/postfix/var/run/saslauthd

Ahora tenemos que editar /etc/default/saslauthd. Debería verse así:

# This needs to be uncommented before saslauthd will be run automatically
START=yes
PARAMS="-m /var/spool/postfix/var/run/saslauthd -r"
# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# "shadow" or "sasldb", like this:
# MECHANISMS="pam shadow"
MECHANISMS="pam"
A continuación, edite /etc/init.d/saslauthd y cambie la ubicación del archivo PID de saslauthd. Cambie el valor de PIDFILE a /var/spool/postfix/var/run/${NAME}/saslauthd.pid, para que se lea:
PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"

Ahora llene su sistema con usuarios reales. Configure el shell de los usuarios en /bin/false para evitar agujeros de seguridad.

A continuación, complete /etc/postfix/virtual como desee. Me encanta Webmin por esto. También puedes editarlo directamente, por supuesto. Sin embargo, webmin hace un gran trabajo.

¡Te tengo!:"algún.dominio", etc. no puede ser igual a nada mencionado en la línea "midestino" en

/etc/postfix/main.cf

Mi /etc/postfix/virtual tiene la siguiente estructura:

some.domain	virtual domain
some.other.domain	virtual domain
some.really.other.domain	virtual domain
[email protected]		user
[email protected]	otheruser
[email protected]	user
[email protected]	otheruser
[email protected]	user
[email protected]	someoneidontlike
[email protected]	someoneidontlike [email protected]
[email protected]	differentuser	[email protected]	someoneidontlike
@some.really.other.domain		someonidontlike		[email protected]
y así. Así que solo tengo que establecer un alias para root y postmaster en /etc/aliasesTodos los demás alias deben estar en este archivo. El reenvío y la entrega de correo a varias direcciones y, por lo tanto, la fortaleza puede (y debería, creo) establecerse también en este archivo.

Tenga en cuenta que en este tipo de configuración, sus usuarios pueden tener tantos alias como deseen (hasta que se canse de ellos), pero para cada usuario aún debe agregar un usuario real, con un directorio de inicio.

No olvides hacer

postmap /etc/postfix/virtual

cuando termines.

Ahora queremos algunas reglas para que spamassassin haga un mejor trabajo.

Primero edite /etc/MailScanner/spam.assassin.prefs.conf.

Comente dcc_path /usr/bin/dccproc. Comente también razor_timeout 10 y
puntúe RCVD_IN_RSL 0.

Siguiente paso:

cd ..
wget http://www.fsl.com/support/Rules_Du_Jour.tar.gz
tar -zxvf Rules_Du_Jour.tar.gz
cd rules_du_jour
mkdir /etc/rulesdujour
cp config /etc/rulesdujour/config
cp rules_du_jour /usr/bin
cp rules_du_jour_wrapper /etc/cron.daily
/etc/cron.daily/rules_du_jour_wrapper

A continuación configuramos el servidor DHCP.

Edite /etc/dhcp3/dhcpd.conf. El mío ahora se ve así:

# Local Network
subnet 192.168.1.0 netmask 255.255.255.0 {
	option netbios-name-servers 192.168.1.1;
	option domain-name-servers 192.168.1.1;
	option domain-name "your.domain.here";
	option broadcast-address 192.168.1.255;
	option routers 192.168.1.1;
	range 192.168.1.100 192.168.1.130;
	}

Edite /etc/default/dhcp3-server. Debería leer

INTERFACES=eth1

Siguiente paso:

/etc/init.d/dhcp3-server start

A continuación, instale dcc desde la fuente

cd /root
wget http://www.dcc-servers.net/dcc/source/dcc.tar.Z
gunzip dcc.tar.Z
tar -xvf dcc.tar
cd dcc*
./configure
make
make install
shutdown -r now

y espera a que vuelva a funcionar.

Configurar Ubuntu-Server 6.06 LTS como cortafuegos/puerta de enlace para el entorno de su pequeña empresa - Página 8

Ahora debe enviar a cada usuario real un mensaje de bienvenida, creando así las estructuras Maildir iniciales en sus directorios de inicio necesarios para poder iniciar sesión en sus cuentas. Puede usar el módulo postfix de webmin para esto. No es necesario enviar nada a sus alias. Es posible que desee utilizar una cuenta de correo electrónico externa para enviar esos mensajes de bienvenida, sin embargo, primero deberá abrir el puerto 25 en su firewall para hacerlo, como se muestra en esta página del tutorial.

Tenga en cuenta que, por supuesto, también tendrá que enviar un mensaje a cada nuevo usuario agregado después de esta configuración inicial.

Su servidor de correo web se encuentra en https://su.dominio/webmail (¡primero envíe esos mensajes!)

Munin está en http://tu.dominio/munin

Webmin está en https://tu.dominio:10000

Si no ha configurado ningún dominio, use https://192.168.1.1/webmail, etc.

Compruebe que puede iniciar sesión en su correo web y enviar y recibir correo dentro de su red local. Si está satisfecho, abra el puerto 25 en su firewall para el tráfico TCP entrante (postfix) y el puerto 6277 para el tráfico UDP entrante (DCC). Es posible que desee que su servidor de correo web esté disponible para sus usuarios del mundo exterior. Abra el puerto 443 para el tráfico tcp entrante también (apache ssl). Abrir el puerto 993 también es una buena idea para las conexiones tcp entrantes, ya que facilita los imaps.

Mi /etc/shorewall/rules ahora se ve así:(solo para empezar, todas las configuraciones de firewall que se muestran en este artículo son solo para ponerlo en funcionamiento, ¡es posible que desee ajustar estas configuraciones una vez que haya terminado!)

#############################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/
# PORT PORT(S) DEST LIMIT GROUP
# PORT PORT(S) DEST LIMIT GROUP
ACCEPT net $FW tcp 25
ACCEPT net $FW tcp 443
ACCEPT net $FW tcp 993
ACCEPT net $FW udp 6277
#
# Accept DNS connections from the firewall to the network
#
DNS/ACCEPT $FW net
ACCEPT $FW net all
ACCEPT $FW loc all
ACCEPT loc $FW all
#
# Accept SSH connections from the local network for administration
#
SSH/ACCEPT loc $FW
#
# Allow Ping from the local network
#
Ping/ACCEPT loc $FW
#
# Reject Ping from the "bad" net zone.. and prevent your log from being flooded..
#
Ping/REJECT net $FW
ACCEPT $FW loc icmp
ACCEPT $FW net icmp
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
Reinicie el cortafuegos:
/etc/init.d/shorewall restart

Siguiente paso:

/var/dcc/libexec/updatedcc

Ahora configuramos su servidor VPN.

Edite /etc/pptpd.conf. Debería verse así ahora:

###############################################################################
# $Id: pptpd.conf 4255 2004-10-03 18:44:00Z rene $
#
# Sample Poptop configuration file /etc/pptpd.conf
#
# Changes are effective when pptpd is restarted.
###############################################################################

# TAG: ppp
# Path to the pppd program, default '/usr/sbin/pppd' on Linux
#
#ppp /usr/sbin/pppd

# TAG: option
# Specifies the location of the PPP options file.
# By default PPP looks in '/etc/ppp/options'
#
option /etc/ppp/pptpd-options

# TAG: debug
# Turns on (more) debugging to syslog
#
#debug

# TAG: stimeout
# Specifies timeout (in seconds) on starting ctrl connection
#
# stimeout 10

# TAG: noipparam
# Suppress the passing of the client's IP address to PPP, which is
# done by default otherwise.
#
#noipparam

# TAG: logwtmp
# Use wtmp(5) to record client connections and disconnections.
#
logwtmp

# TAG: bcrelay <if>
# Turns on broadcast relay to clients from interface <if>
#
#bcrelay eth1

# TAG: localip
# TAG: remoteip
# Specifies the local and remote IP address ranges.
#
# Any addresses work as long as the local machine takes care of the
# routing. But if you want to use MS-Windows networking, you should
# use IP addresses out of the LAN address space and use the proxyarp
# option in the pppd options file, or run bcrelay.
#
# You can specify single IP addresses seperated by commas or you can
# specify ranges, or both. For example:
#
# 192.168.0.234,192.168.0.245-249,192.168.0.254
#
# IMPORTANT RESTRICTIONS:
#
# 1. No spaces are permitted between commas or within addresses.
#
# 2. If you give more IP addresses than MAX_CONNECTIONS, it will
# start at the beginning of the list and go until it gets
# MAX_CONNECTIONS IPs. Others will be ignored.
#
# 3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238,
# you must type 234-238 if you mean this.
#
# 4. If you give a single localIP, that's ok - all local IPs will
# be set to the given one. You MUST still give at least one remote
# IP for each simultaneous client.
#
# (Recommended)
localip 192.168.1.1
remoteip 192.168.1.10-30
# or
#localip 192.168.0.234-238,192.168.0.245
#remoteip 192.168.1.234-238,192.168.1.245

Next edit /etc/ppp/options.It should look like this:
asyncmap 0
noauth
lock
hide-password
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4
noipx

Edit /etc/ppp/pptpd-options. It should look like this:
###############################################################################
# $Id: pptpd-options 4643 2006-11-06 18:42:43Z rene $
#
# Sample Poptop PPP options file /etc/ppp/pptpd-options
# Options used by PPP when a connection arrives from a client.
# This file is pointed to by /etc/pptpd.conf option keyword.
# Changes are effective on the next connection. See "man pppd".
#
# You are expected to change this file to suit your system. As
# packaged, it requires PPP 2.4.2 and the kernel MPPE module.
###############################################################################


# Authentication

# Name of the local system for authentication purposes
# (must match the second field in /etc/ppp/chap-secrets entries)
name pptp-vpn

# Optional: domain name to use for authentication
# domain mydomain.net

# Strip the domain prefix from the username before authentication.
# (applies if you use pppd with chapms-strip-domain patch)
#chapms-strip-domain


# Encryption
# Debian: on systems with a kernel built with the package
# kernel-patch-mppe >= 2.4.2 and using ppp >= 2.4.2, ...
# {{{
refuse-pap
refuse-chap
refuse-mschap
# Require the peer to authenticate itself using MS-CHAPv2 [Microsoft
# Challenge Handshake Authentication Protocol, Version 2] authentication.
require-mschap-v2
# Require MPPE 128-bit encryption
# (note that MPPE requires the use of MSCHAP-V2 during authentication)
require-mppe-128
# }}}




# Network and Routing

# If pppd is acting as a server for Microsoft Windows clients, this
# option allows pppd to supply one or two DNS (Domain Name Server)
# addresses to the clients. The first instance of this option
# specifies the primary DNS address; the second instance (if given)
# specifies the secondary DNS address.
# Attention! This information may not be taken into account by a Windows
# client. See KB311218 in Microsoft's knowledge base for more information.
#ms-dns 10.0.0.1
ms-dns 192.168.0.1

# If pppd is acting as a server for Microsoft Windows or "Samba"
# clients, this option allows pppd to supply one or two WINS (Windows
# Internet Name Services) server addresses to the clients. The first
# instance of this option specifies the primary WINS address; the
# second instance (if given) specifies the secondary WINS address.
#ms-wins 10.0.0.3
ms-wins 192.168.0.1

# Add an entry to this system's ARP [Address Resolution Protocol]
# table with the IP address of the peer and the Ethernet address of this
# system. This will have the effect of making the peer appear to other
# systems to be on the local ethernet.
# (you do not need this if your PPTP server is responsible for routing
# packets to the clients -- James Cameron)
proxyarp

# Debian: do not replace the default route
nodefaultroute


# Logging

# Enable connection debugging facilities.
# (see your syslog configuration for where pppd sends to)
#debug

# Print out all the option values which have been set.
# (often requested by mailing list to verify options)
#dump


# Miscellaneous

# Create a UUCP-style lock file for the pseudo-tty to ensure exclusive
# access.
lock

# Disable BSD-Compress compression
nobsdcomp
auth

Next, edit /etc/ppp/chap-secrets. Debería verse así:

# Secrets for authentication using CHAP
# client	server	secret			IP addresses
user  pptp-vpn  abcdefg  "*"
Now do:
/etc/init.d/pptpd restart

You must be able now to setup a vpn connection to your new server from the inside of your firewall as "user" with password "abcdefg" (without the quotes) Change this initial username and password and add some users, if you like. Maybe you'll have to reboot some machines to make it work.

Now open your firewall for incoming vpn connections. To do this, set your /etc/shorewall/rules as shown.

My /etc/shorewall/rules at this time:

#############################################################################################################
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/
# PORT PORT(S) DEST LIMIT GROUP
# PORT PORT(S) DEST LIMIT GROUP
ACCEPT net $FW tcp 25
ACCEPT net $FW tcp 443
ACCEPT net $FW tcp 993
ACCEPT net $FW udp 6277
DNAT net fw:192.168.1.1 tcp 1723
DNAT net fw:192.168.1.1 47
#
# Accept DNS connections from the firewall to the network
#
DNS/ACCEPT $FW net
ACCEPT $FW net all
ACCEPT $FW loc all
ACCEPT loc $FW all
#
# Accept SSH connections from the local network for administration
#
SSH/ACCEPT loc $FW
#
# Allow Ping from the local network
#
Ping/ACCEPT loc $FW
#
# Reject Ping from the "bad" net zone.. and prevent your log from being flooded..
#
Ping/REJECT net $FW
ACCEPT $FW loc icmp
ACCEPT $FW net icmp
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
To complete this step, do:
/etc/init.d/shorewall restart

So now your customers will be able to do their (computer network related) job at home as well.

Note, that this only makes sense when your server has a reliable broadband connection to the internet, which in The Netherlands is the defacto standard, even for very tiny offices and most home addresses. In this respect we are way ahead of the rest of the world.

Now edit your /etc/MailScanner/spam.assassin.prefs.conf and add the following lines at the bottom:

score RCVD_IN_SORBS_WEB 10
score RCVD_IN_WHOIS_INVALID 10
score RCVD_IN_WHOIS_BOGONS 10
score RCVD_IN_NJABL_PROXY 10
score RCVD_IN_DSBL 10
score RCVD_IN_XBL 10
score RCVD_IN_BL_SPAMCOP_NET 10
score RCVD_IN_SORBS_DUL 10
score SARE_LWSYMFMT 3
score SARE_MLB_Stock4 3
score SARE_BAYES_5x8 3
score SARE_BAYES_6x8 3
score URIBL_SC_SURBL 10
score URIBL_WS_SURBL 10
score URIBL_PH_SURBL 10
score URIBL_OB_SURBL 10
score URIBL_AB_SURBL 10
score URIBL_JP_SURBL 10
score URIBL_SBL 10
score ALL_TRUSTED 0

Ahora limpie su directorio /root. Ahí es donde fueron todas las descargas.

Samba está instalado. Como cada configuración de Samba es única, no puedo ayudarte aquí. ¿No sabes cómo hacerlo? Este es un buen punto de partida.

To complete all of this, do:

/etc/init.d/mailscanner restart

Now watch the spam reports in the headers of incoming mail (but make sure your users agree to this, as you will be violating some postal and maybe other laws) to adjust the last edit (and add some) to make it work as you like. Especially false negatives and even more false positives should draw your attention. When you are done you may wish to send most spam, if not all, to /dev/null.

Make this spy yob easy:Create a special account to which you send a copy of all mail handled by your server. Let's assume you create this user and call it "spy" (without quotes) and you have given spy a line in /etc/postfix/virtual, (like "[email protected]    spy", without quotes). Siguiente paso:

postmap /etc/postfix/virtual

Now send spy a welcome message, as a rule of thumb, and check that spy's account is fully operational. Siguiente paso:

postconf -e 'always_bcc = spy' 

DONE!


Panels
  1. Las 5 mejores soluciones de software de llamadas para su empresa

  2. Configure Ubuntu-Server 6.10 como cortafuegos/puerta de enlace para el entorno de su pequeña empresa

  3. Cómo configurar una redirección para su sitio web en cPanel

  4. 7 beneficios de usar un servidor privado virtual para su negocio

  5. ¿Cómo configuro un nick predeterminado para nuevas conexiones irssi?

Cómo configurar el CRM ONLYOFFICE para las necesidades de su negocio

Necesito una solución de alojamiento web para mi pequeña empresa. ¿Cómo elijo?

Cómo configurar un Killswitch de Linux para VPN

Cómo configurar un cortafuegos en su servidor Linux

Más de 15 software de firewall de Linux para proteger su sistema Linux

Linux para empresas:haga crecer su empresa con estas aplicaciones