Reduce abuse complaints when running vpn service
VPN またはプロキシサービスをサーバー上で実行すると、いくつかのリスクが生じる可能性があります。
IP の所有者であるあなたと、あなたのユーザーが悪用または違法行為について責任を負います
あなたのサービスを通じて行われるアクティビティから保護するために
問題に対処するには、あらかじめ対策を講じて保護する必要があります。
reputation.
Strict Mode:
Whitelisting
One way to make sure your server is not being abused is to only allow
特定のアクティビティに限定します。このホワイトリスト方式は完全ではなく、
ユーザーは他のサーバーへの攻撃に使用でき、その結果あなたのサーバーが
停止される可能性があります。ただし、悪用をより難しくし、攻撃者を
遠ざける効果があります。
services (and, unfortunately, some legitimate users as well).
What we’re proposing here is to drop all incoming and outgoing
あなたのサーバーからのパケットは、絶対に必要なもの以外すべてブロックします。
その方法を説明します。
The only thing you need to consider before following the guide is
サーバーで他のファイアウォールが有効になっていないことを確認してください。
このガイドではUbuntuでの手順を説明していますが、このOSを使う必要はありません。他のOSでも論理は同じです。
プロセスの論理は他のOSでも同じです。
well.
1. Installing UFW
まずUFWをインストールします。
sudo apt install ufw
2.
Blocking all incoming and outgoing connections
Make sure you disable UFW because the following commands may
サーバーへの接続を中断する場合があります:
sudo ufw disable
the commands below will basically drop every packet that tries to
サーバーとの接続を確立または切断します。後で、必要な接続のみ許可します。
our users need:
sudo ufw default deny incoming
sudo ufw default deny outgoing
3. Allowing
yourself to connect to your server
次にポート22への着信接続を許可します。これはSSH接続の確立に使うポートです。別のポートに変更することをお勧めします:
SSH接続の確立に使うポートです。デフォルトから変更することが推奨されますが:
SSHポートをデフォルト以外に変更する場合:
sudo ufw allow in 22/tcp comment “Allows me to SSH to my server”
発信接続はすでにブロックされていますが、特に明示的にブロックします
block all outgoing packets that have port 22 as their destination (in
将来デフォルトポリシーを変更した場合に備えて)。これにより両方向が
you and your users unable to connect to other servers using SSH on port
ポート22が設定されます。手間がかかるように見えますが、サーバー停止の最も一般的な原因を実際に解決します。このコマンドにより、
一般的な原因を実際に解決します。このコマンドを使用すれば、ユーザーは
あなたのサーバーからSSHブルートフォース攻撃を実行できなくなります。
your server:
sudo ufw deny out 22/tcp comment “Stops SSH brute force”
ポート22への着信接続を許可した後、サーバーから切断されずに
ファイアウォールを有効にできます:
sudo ufw enable
サーバーから切断された場合でも、Cloudzyのコンソールを使用して
VNC to gain access to your server again and disable your firewall.
4.
Allowing your users to connect to your server to get proxy/VPN
services
ユーザーはサーバーのプロキシサービスに接続して使用する必要があります。
すべての着信接続をブロックするとこれが不可能になります。
them. So, we need to allow the proxy/VPN ports used by the users for
例えば、ユーザーがポート1194に接続できるようにしたい場合、
は通常 OpenVPN 用に使用されます。これを実行するには、次のコマンドを入力してください。
sudo ufw allow in 1194/tcp comment “OpenVPN port for users”
または、OpenVPN を UDP 上で実行している場合:
sudo ufw allow in 1194/udp comment “OpenVPN port for users”
VPN および他のプロキシサーバーも同じロジックが適用されます。
find out which port your users need to connect to and allow incoming
connections to it.
これで、ユーザーはサーバーと VPN に接続できるようになりますが、
外部との接続ができなくなります。これは
ホワイトリストの役割: ユーザーは許可されたIP以外には接続できません
ポートを明示的に許可しない限り、アクセスを遮断します。こうすることで、
getting abuse reports.
5.
Allowing your users to visit websites and use
applications
Now we will allow outgoing traffic to ports that are used to browse
ウェブ上で API 呼び出しをウェブサーバーで実行するために、以下を許可する必要があります
TCP ポート 80 および TCP ポート 443。UDP ポート 443 も許可することで
ユーザーが HTTP3 接続を確立できるようにしましょう:
sudo ufw allow out 80/tcp comment “HTTP connections”
sudo ufw allow out 443 comment “HTTPS and HTTP3 connections”
6. Allowing
different services on a need basis
通常はポート80と443を開くだけで十分ですが、フル
特定のアプリケーションやソフトウェアの機能を使う場合、許可設定が必要な場合があります
ユーザーが他のポートも使用できるようにする。
You are generally advised to do your own research and only allow
ports if they’re absolutely required. Each major application has a
networking documentation with information for network administrators
あなたのような方々のためです。以下のドキュメントで、
アプリケーションの使用状況を確認して、同様にホワイトリストに登録します。いくつか一般的なものを紹介します
ones as examples.
WhatsApp
(No video or voice call):
sudo ufw allow out 443/tcp comment “WhatsApp”
sudo ufw allow out 5222/tcp comment “WhatsApp”
Git:
sudo ufw allow out 9418/tcp comment “Git”
Some services like Discord,
Zoom,
または WhatsApp の音声・ビデオ通話には UDP ポート幅が必要です。
may open these at your own discretion.
Lenient Mode:
Blacklisting
ホワイトリストでは、すべてをブロックして特定のポートのみを許可します。一方
ブラックリスト方式では、すべてを許可した上で特定のポートのみをブロックします。
1. Installing UFW
まずUFWをインストールする必要があります
sudo apt install ufw
2. Blocking the
incoming connections
Make sure you disable UFW because the following commands may
サーバーへの接続を中断する場合があります:
sudo ufw disable
It makes sense to block all incoming connections unless we serve
specific services. So let’s reject all incoming traffic:
sudo ufw default deny incoming
このとき、すべての送信接続をブロックしているわけではないことに注意してください。
ユーザーが任意のポートに接続できるようになります。これは
ユーザーを完全に信頼できる場合を除き、推奨されません。
3.
Allowing yourself to connect to your server
次に、ポート 22 への受信接続を許可します。ポート 22 は
サーバーへの SSH 接続を確立するために使用されます。ただし、
SSH ポートは別のものに変更することをお勧めします:
sudo ufw allow in 22/tcp comment “Allows me to SSH to my server”
SSH ポートをブロックしてブルートフォース攻撃の報告を避けたい場合は、
以下のコマンドを使用できます:
sudo ufw allow out 22/tcp comment “Block Outgoing SSH ”
4. Block BitTorrent
同じ考え方で、以下に使用されるポートをブロックする必要があります
BitTorrent。ただし、複数のポートがあるため、次のものが必要です
to do your research and block public tracker IPs as well as the ports
BitTorrent に通常使用されるもの。
ご質問がありましたら、お気軽にお問い合わせください submitting a
ticket.
Also in Security
Related guides.
Need help with something else?
Median response time under 1 hour. Real humans, not bots.