GNU/Linux >> Linux の 問題 >  >> Panels >> Panels

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSを設定する

Ubuntu-Server6.06LTSをスモールビジネス環境のファイアウォール/ゲートウェイとして設定

>

含まれるもの:Shorewall、NAT、Caching NameServer、DHCP Server、VPN Server、Webmin、Munin、Apache(SSL対応)、Squirrelmail、仮想ドメインを使用したPostfixセットアップ、courier imap imaps pop3 pop3s、ロードウォリアーのsasl認証、MailScanner as SpamAssassin、Razor、ClamAVなどのラッパー。Sambaがインストールされていますが、構成されていません。

メンテナンスはほとんど必要なく、想像を絶するほど拡張可能です。もちろん、すべて使用するハードウェアによって異なります。

これは単なるコピー&ペーストのハウツーです。詳細については、ネットを使用してください。私はしました...しかし、貢献や提案はいつでも大歓迎です!これはもっとうまくできると思いますので、お気軽に。

LTSがあるので、すぐにこのtutoを6.06LTSに基づいて作成する必要がありました。そのために残念。 Ubuntu 6.06 LTSでこれを機能させるために必要ないくつかのマイナーではあるが重要な変更のため、私はそれを書き直しました。

包括的なコントロールパネルを含め、snortとsnortsamの適切なインストールと構成を追加する時間を見つけていただければ幸いです。

範囲:小規模ネットワーク(たとえば、PIII 450MHz、512 MB RAMおよび2つの同一のネットワークインターフェイスカード、フル機能のブロードバンド接続、ビジネス環境向けに10〜15ユーザー程度)用のファイアウォール/(メール)ゲートウェイを作成します。より良い仕様ハードウェア(特にRAMの量)を使用すると、サーバーのパフォーマンスが大幅に向上します。記載されている仕様は、それほど要求の厳しい顧客にとっては最低限のものであり、本当に必要な場合は実際に実行できることを示しています(実行する必要があります)。後で調整することもあります)。

予想される聴衆:(最初の)シスオペ。

このtutoは、堅実な「すぐに使える」システムにつながります。楽しい部分(微調整や調整など)は、完了したときに始まります。ログを調べて、チューニングを開始する場所に関する手がかりを見つけることをお勧めします。ムーニンもたくさん教えてくれるかもしれません。

楽しんでください!

まず、Ubuntu-Server6.06LTSを使用してクリーンインストールを実行します。インストール中に、eth0の適切な設定が自動的に検出されます。これが失敗した場合は、ネットワークケーブルを変更して再試行してください。 ISPがDHCPサーバーを実行していない可能性は非常に低いです(発生することはありません)、または単にダウンしている可能性があります(かなりの回数見られますが、DNSをときどき台無しにする可能性もあります)。その場合、あなたはあなたの1つにいます、彼らがそれを修正し終えるまで待つのが最善です。したがって、まずeth0にDHCPで割り当てられたアドレスから始めます。これは、どのNICが実際にeth0であるかを簡単に把握する方法です。どちらがどちらであるかがすでにわかっている場合は、eth0の静的アドレスから始める方がよいでしょう。 ISPが安っぽくない場合は、適切な設定があります。

次に、すべてのデフォルトを受け入れて(ただし、独自のパーティショニングを行うこともできます)、LAMPをインストールしないでください。

次に、作成したばかりの新しいユーザーとしてログインし、次の操作を行います。

sudo passwd

ここで、パスワードをもう一度入力します。次に、ユーザー「root」の新しいパスワードを入力して確認します。そのため、厄介なsudoエクスペリエンスを削除しました(サーバーでは少し奇妙ですね)。次に、ログアウトして、新しいrootパスワードを使用してrootとして再度ログインします。

vim(またはお気に入りのエディター)を使用して、/ etc / apt/sources.listを編集します。 cdリポジトリをコメントアウトします。次に、コメントアウトされていないすべての行に「universe」(引用符なし)を追加し、バックポートリポジトリのコメントを解除します。ファイルを保存します。

/ etc / network / interfacesを編集し、下部に以下を追加します。

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

このチュートリアルの残りの部分では、実際にeth1の設定を次のように行うことを前提としていることに注意してください。

私のfull/etc / network / interfacesは次のようになります:

# 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

ご覧のとおり、私のeth0はDHCPを使用して設定を取得しています。

ファイルを保存します。次のステップ:

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

アップグレードプロセス中に、新しいカーネルイメージがインストールされます。次は:

reboot

これの残りの部分は、Linuxまたは他のワークステーション(パテが必要)のいずれかから実行できるため、実際にコピーして貼り付けることができます。rootとして192.168.1.1にログインし、続行するだけです。

ワークステーションのネットワーク設定がサーバーのeth1の設定と一致していることを確認してください

ここで混乱している場合は、最初にこの記事に示すようにDHCPサーバーを構成して起動し、ワークステーションに適切な設定を自動的に検出させます。

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSを設定する-2ページ

今すぐ実行:

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」はオランダのサーバーです。これを「heanet」(アイルランドの場合)、「belnet」(ベルギーの場合)、「mesh」(ドイツの場合)などに変更します。

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

次に、ブラウザを開き、rootパスワードを使用してrootとしてhttps://192.168.1.1:10000でwebminにログインし、webminのshorewallモジュールを使用して、必要に応じてファイアウォールのポリシーとルールを変更します(今のところ、ルールを設定するだけです)示されている例にファイルを追加します。webminが気に入らない場合は、初心者向けのルールファイルをコピーして貼り付けることができます。

また、/ etc / shorewall/shorewall.confで「IP_FORWARDING=Keep」の行を「IP_FORWARDING=On」(引用符なし)に設定し、
/ etc / default/shorewallでファイアウォールを有効にします。

/ etc / shorewall / rulesは次のようになります:

#############################################################################################################
#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
次に行うこと:
rm /etc/shorewall/README.txt Makefile
/etc/init.d/shorewall start

これでネットサーフィンができるようになります。

ネットサーフィンに成功するまで先に進まないでください。これがあなたのフレームワークだからです。大丈夫でなければなりません。

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSをセットアップする-3ページ

だから今、いくつかのパッケージが必要です。実行(すべて1行で!):

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

すべてのデフォルトを受け入れます。

今すぐ実行:

mysqladmin -u root password yourrootsqlpassword

ここで実際のパスワードを使用してください!

次に、ApacheとSquirrelmailを構成します。

/usr/sbin/squirrelmail-configure

宅配便(オプションD)に設定し、それ以外の場合は必要に応じてikを作成します。
一部のプラグインを有効にし、必要に応じてデフォルトの言語を設定することを忘れないでください。また、これを設定することをお勧めします:

$show_contain_subfolders_option = true;

My / etc / squirrelmail / config.phpは次のようになります:(現在の設定だけです。これをコピーしないでください。参照として使用してください。)

<?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.
*/
?>

次に行う:

apache2-ssl-certificate -days 3650

正しいサーバー名を入力してください!!!

つまり、ポート443のapacheを使用して、ユーザーにSquirrelmailまたはその他のサービスへのアクセスを許可する予定のアドレスです。ドメインのみが機能します(DNSに存在する必要があります)。ドメイン/ウェブメールではありません。

問題が発生した場合は、証明書を削除してこの手順を繰り返してください。

次に入力します:

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

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSを設定する-4ページ

次に、/ etc / courier / imapd-sslを編集して、以下を変更します。

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

/ etc / courier/pop3d-sslでも同じことを行います。

次に、/ etc / apache2 / sites-available/defaultを編集します。上部は次のように変更する必要があります:

NameVirtualHost *:80
<VirtualHost *:80>

/ etc / apache2 / sites-available/httpsも編集します。ファイルの先頭は次のようになります。

NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
/etc/squirrelmail/apache.confを編集します。次のようになります。
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>

ここで、/ etc / apache2/apache2.confのDirectoryIndex行に次のように表示されていることを確認します。

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

/etc/apache2/ports.confを編集し、Listen443を追加します。

Listen 80
Listen 443

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSをセットアップする-5ページ

squirrelmailにあなたの言語を話させましょう。英語のみを使用する場合は、もちろんファイルの最後の行をスキップできます。

/var/lib/locales/supported.d/localを編集します。

これは次のようになります:(オランダ語の場合、それ以外の場合は必要に応じて調整します)。主なことは、文字セット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

次に、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

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSを設定する-6ページ

次に、etc / postfix/header_checksを編集します。

次のようになります:

/^Received:/ HOLD

cd /root
次に、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

次に、/ etc / MailScanner / MailScanner.confを編集して、次の行を次のように設定します。

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
/ etc / default / mailscannerの行#run_mailscanner=1のコメントを解除します。

次に、/ usr / sbin / check_mailscannerのcronジョブを作成し、20分ごとに実行します。

次に、MailScannerの起動スクリプトをだまします。これが必要なのは、Eximを対象としたスクリプトが原因で、MailScannerが起動を拒否するためです(実際にEximを使用したことがないので、よくわかりません)。将来、スクリプト自体が別の「開始されていない」更新に置き換えられる可能性があるため、スクリプト自体を変更したくありません。安全のために。

touch /etc/init.d/mailscanner_pre

/etc/init.d/mailscanner_preを編集します。次のようになります:

#!/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

これでうまくいくはずです、同意しませんか?

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSを設定する-7ページ

次に、sasl認証を構成します。

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

次に、/ etc / default/saslauthdを編集する必要があります。次のようになります:

# 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"
次に、/ etc / init.d / saslauthdを編集し、saslauthdのPIDファイルの場所を変更します。PIDFILEの値を/var/spool/postfix/var/run/${NAME}/saslauthd.pidに変更して、次のようにします。
PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"

次に、システムに実際のユーザーを配置します。セキュリティホールを回避するために、ユーザーシェルを/ bin/falseに設定します。

次に、必要に応じて/ etc / postfix/virtualを入力します。このためにWebminが大好きです。もちろん、直接編集することもできます。ただし、webminは素晴らしい仕事をします。

落とし穴!:「some.domain」などは、

の「mydestination」行に記載されているものと同じにすることはできません。

/etc/postfix/main.cf

私の/etc/ postfix/virtualの構造は次のとおりです。

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]
等々。したがって、rootとpostmasterのエイリアスを/ etc / aliasesに設定するだけで済みます。他のすべてのエイリアスは、このファイルに含まれている必要があります。メールを複数のアドレスに転送および配信するため、このファイルでもフォートを設定できます(そしてそうすべきだと思います)。

この種の設定では、ユーザーは(飽きるまで)必要な数のエイリアスを持つことができますが、ユーザーごとに、ホームディレクトリを使用して実際のユーザーを追加する必要があることに注意してください。

することを忘れないでください

postmap /etc/postfix/virtual

終わったら。

ここで、spamassassinがより良い仕事をするためのいくつかのルールが必要です。

まず、/ etc / MailScanner/spam.assassin.prefs.confを編集します。

dcc_path / usr / bin/dccprocをコメントアウトします。また、razor_timeout10をコメントアウトして
RCVD_IN_RSL0をスコアリングします。

次のステップ:

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

次に、DHCPサーバーを構成します。

/etc/dhcp3/dhcpd.confを編集します。鉱山は次のようになります:

# 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;
	}

/ etc / default/dhcp3-serverを編集します。読む必要があります

INTERFACES=eth1

次のステップ:

/etc/init.d/dhcp3-server start

次に、ソースからdccをインストールします

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

再び起動するまで待ちます。

中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.06LTSをセットアップする-8ページ

次に、各実際のユーザーにウェルカムメッセージを送信する必要があります。したがって、ホームディレクトリに初期のMaildir構造を作成して、アカウントにログインできるようにする必要があります。これには、webminのpostfixモジュールを使用できます。エイリアスに何も送信する必要はありません。外部の電子メールアカウントを使用してこれらのウェルカムメッセージを送信することもできますが、このページに示されているように、最初にファイアウォールでポート25を開く必要があります。

もちろん、この初期設定後に追加されたすべての新しいユーザーにもメッセージを送信する必要があることに注意してください。

Webメールサーバーはhttps://your.domain/webmailにあります(最初にそれらのメッセージを送信してください!)

Muninはhttp://your.domain/munin

にあります

Webminはhttps://your.domain:10000

にあります

ドメインを設定していない場合は、https://192.168.1.1/webmailなどを使用してください。

Check that you can log in to your webmail and actually send and receive mail within your local network. If you're satisfied, open port 25 on your firewall for incoming tcp traffic (postfix) and port 6277 for incoming udp traffic (dcc). You may wish to make your webmail server availableto your users from the outside world. Open port 443 for incoming tcp traffic as well (apache ssl). Opening port 993 is also a good idea for incoming tcp connections, as it facilitates imaps.

My /etc/shorewall/rules now looks like this:(just to begin with, all firewall settings shown in this article are just ment to get you up and running, you might want to adjust these settings once you are done!)

#############################################################################################################
#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
Restart the firewall:
/etc/init.d/shorewall restart

Next do:

/var/dcc/libexec/updatedcc

Now we configure your VPN Server.

Edit /etc/pptpd.conf. It should look like this now:

###############################################################################
# $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. It should look like this:

# 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

Now clean your /root directory. That's where all the downloads went.

Samba is installed. As every setup of Samba is unique, I can't help you out here. Don't know how to do it? This is a good starting point.

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). Next do:

postmap /etc/postfix/virtual

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

postconf -e 'always_bcc = spy' 

DONE!


Panels
  1. あなたのビジネスに最適な5つの通話ソフトウェアソリューション

  2. cPanelでウェブサイトのリダイレクトを設定する方法

  3. 中小企業向けのクラウドデータベースホスティング:なぜそれが理想的か

  1. ビジネスに仮想プライベートサーバーを使用する7つの利点

  2. ビジネスに適したVPSプランを選択する方法

  3. 新しい irssi 接続にデフォルトのニックネームを設定するにはどうすればよいですか?

  1. 中小企業環境のファイアウォール/ゲートウェイとしてUbuntu-Server6.10を設定する

  2. Ubuntu16.04でUFWを使用してファイアウォールを設定する方法

  3. CentOS/RHEL 7 で systemd サービスの環境変数を設定する方法