Self-Hosting Security Guide for your HomeLab

Techno Tim
29 Jan 202218:43

Summary

TLDR本文介绍了在家庭实验室中自托管服务的最佳安全实践。从硬件到网络配置,再到防火墙设置,提供了全面的安全架构指导。强调了硬件固件更新的重要性,操作系统的选择和维护,以及虚拟化环境的管理。网络方面,建议进行网络分割以提升安全性和性能,并使用云服务如Cloudflare来增强外部网络安全。还讨论了反向代理、SSL证书、两因素认证等技术,以及如何通过Authelia增加服务的认证层。最后,鼓励用户根据自己的舒适度决定是否自托管服务,并提供了一些额外的安全建议。

Takeaways

  • 🛡️ 安全性始于家庭实验室的基础,而不仅仅是最后一步。
  • 🌐 推荐使用VPN来安全地公开服务,只允许拥有VPN访问权限的人访问。
  • 🏢 在公共云中托管服务可以减少家庭网络的风险。
  • 🔩 硬件需要保持最新的固件更新,包括服务器、主板、硬盘、网络适配器等。
  • 🖥️ 虚拟化操作系统时,确保虚拟机管理程序保持最新并完全修补。
  • 📊 选择一个安全的操作系统,定期打补丁,并遵循最小权限原则。
  • 🚀 对于容器化应用,使用官方来源的容器,并考虑使用最小化基础镜像。
  • 🔄 网络分割是控制网络流量和提高安全性的关键。
  • 🌐 外部网络配置应只转发必要的端口,并使用公共反向代理如Cloudflare来提高性能和安全性。
  • 🔒 使用防火墙规则和入侵检测/预防系统来增强网络安全。
  • 🔗 内部反向代理可以简化证书管理和流量路由,同时提供额外的安全层。
  • 🛡️ 使用Authelia等认证代理为服务提供额外的认证和授权层。

Q & A

  • 什么是'最后一英里'在自托管服务中的含义?

    -在自托管服务中,'最后一英里'指的是用户访问服务之前的最后一个跳转。这通常涉及到使用证书或反向代理等技术,以确保用户能够安全地访问服务。

  • 为什么说安全从家庭实验室的基础开始?

    -安全从家庭实验室的基础开始,因为整个系统的安全性依赖于其最薄弱的环节。这意味着,除了关注用户访问服务的'最后一英里'之外,还需要确保硬件、软件、网络配置等所有组件的安全性。

  • 为什么硬件在自托管服务中很重要?

    -硬件在自托管服务中很重要,因为它是运行应用程序的基础。需要确保服务器及其所有连接设备的固件都是最新的,以减少潜在的安全风险。

  • 虚拟化操作系统和裸机运行有什么区别?

    -虚拟化操作系统允许多个操作系统在同一硬件上运行,而裸机运行则是直接在硬件上运行操作系统。选择哪种方式取决于个人对基础设施的管理偏好,但关键是确保虚拟化技术得到积极维护和完全补丁化。

  • 为什么要选择一个安全的操作系统?

    -选择一个安全的操作系统可以降低安全风险。应该选择一个仍然得到支持且未达到生命周期终点的操作系统,并定期进行补丁更新。

  • 什么是最小化容器镜像,为什么它更安全?

    -最小化容器镜像是基于轻量级操作系统(如Alpine Linux)构建的容器,它体积小,依赖少,因此攻击面也较小,需要打补丁的地方也较少,从而减少了潜在的漏洞。

  • 网络分割在自托管服务中有什么作用?

    -网络分割可以将家庭实验室网络划分为多个子网或网络段,每个段像一个独立的小网络。这样可以控制不同网络段之间的流量,提高性能和安全性,降低设备被攻击时的风险。

  • 为什么外部网络配置对自托管服务很重要?

    -外部网络配置决定了用户和设备如何进入你的网络。正确配置端口转发规则,使用反向代理,以及结合Cloudflare等公共反向代理服务,可以提高性能,保护IP地址,提供缓存、TLS加密,并防御攻击。

  • 如何使用Cloudflare增强自托管服务的安全性?

    -通过将域名指向Cloudflare的反向代理,并利用其提供的免费服务,可以提高网站性能,保护IP地址,提供TLS加密,并利用Cloudflare的防御系统来检测和阻止恶意攻击。

  • 什么是入侵检测系统(IDS)和入侵预防系统(IPS)?

    -入侵检测系统(IDS)和入侵预防系统(IPS)是网络安全技术,用于检测和阻止基于已知签名的攻击。IDS会分析请求和流量,匹配签名并发出警报,而IPS则会在检测到攻击时主动阻止。

  • 为什么建议在自托管服务中使用Authelia这样的认证代理?

    -Authelia是一个认证代理,可以与反向代理一起工作,为服务提供认证和授权,即使这些服务本身不支持认证。这为应用程序提供了额外的安全层,特别是通过两因素认证确保只有授权用户才能访问。

Outlines

00:00

🏠 家庭实验室的自托管服务安全基础

在家庭实验室中自托管服务时,人们通常只关注最后一步,即用户访问服务前的最后一个跳转。虽然这一步非常重要,但安全措施应从基础做起。视频介绍了家庭实验室的架构,并强调了从硬件到网络配置的各个层面。提到了赞助商Micro Center,提供了硬件购买建议,并讨论了通过VPN暴露服务的安全性,以及公共云托管作为替代方案的优缺点。

05:00

🛡️ 自托管服务的硬件和操作系统安全

讨论了自托管服务时硬件的重要性,强调了保持服务器及其连接设备固件的最新状态的必要性。在选择操作系统时,建议选择仍在支持且非生命周期结束的系统,并定期打补丁。还提到了虚拟化操作系统的考虑因素,包括确保虚拟化软件的更新和使用官方来源的容器。此外,还强调了网络分割的重要性,以提高性能和安全性。

10:01

🌐 网络配置与外部保护的最佳实践

深入探讨了内部和外部网络配置,强调了仅转发所需端口的重要性,并推荐使用像Cloudflare这样的公共反向代理服务来提高性能和安全性。Cloudflare可以检测和阻止恶意攻击,提供缓存、TLS加密等。还介绍了如何通过条件端口转发规则强制流量通过Cloudflare,并讨论了防火墙规则、入侵检测系统和入侵预防系统的设置。

15:02

🔒 反向代理、认证和自托管服务的最终安全措施

讨论了内部反向代理的使用,它可以简化证书管理并提供流量路由。提到了使用Authelia这样的认证代理来为服务添加认证和授权层,特别是对于那些自身不支持这些功能的应用。最后,视频总结了从用户通过Cloudflare到防火墙,再到反向代理和认证代理,最终到达服务器的完整安全流程,并鼓励观众在评论中分享他们对家庭自托管服务的看法。

Mindmap

Keywords

💡自托管服务

自托管服务指的是用户在自己的服务器或家庭实验室中搭建和维护服务,而不是依赖第三方服务提供商。在视频中,自托管服务是讨论的核心,涵盖了从硬件到软件的多个方面,例如网络配置、防火墙设置以及使用VPN等。

💡最后英里

在视频脚本中,'最后英里'是指用户访问服务之前的最后一个跳转点。虽然使用证书或反向代理来保护这个跳转点非常重要,但视频强调了安全实际上应该从家庭实验室的基础开始,而不仅仅是最后英里。

💡硬件

硬件在自托管服务中扮演着基础性的角色。视频提到,确保服务器硬件及其组件(如主板、硬盘、网络适配器等)都更新到最新的固件版本是至关重要的。这有助于保障自托管服务的安全性和稳定性。

💡虚拟化

虚拟化技术允许用户在单一物理服务器上创建多个虚拟机,每个虚拟机都可以运行不同的操作系统和应用程序。视频提到,如果选择虚拟化操作系统,需要确保虚拟化软件(如VMware、Hyper-V等)是积极维护且完全补丁化的。

💡操作系统

操作系统是管理计算机硬件资源和提供公共服务来使应用程序软件运行的平台。视频强调选择一个安全且仍在支持周期内的操作系统,如Windows或Linux的不同发行版,并定期打补丁,遵循最小权限原则,不以root或管理员权限运行服务。

💡容器化

容器化是一种轻量级虚拟化技术,它允许将应用程序及其依赖项打包在容器中。视频提到,使用容器时,应确保容器引擎(如Docker或Podman)是最新的,并且推荐使用官方来源的容器,以减少攻击面和潜在的漏洞。

💡网络分割

网络分割是将网络划分为多个子网或网段的过程,每个子网可以像一个独立的小网络一样运作。视频提到,网络分割可以提高性能和安全性,通过控制网络流量和基于网络策略的访问控制,减少设备被入侵时的风险。

💡外部网络

外部网络是指连接到互联网的部分网络,它是用户和设备进入家庭实验室网络的入口。视频提到,为了安全,应该只转发必要的端口,并且使用反向代理来处理外部流量,同时推荐使用Cloudflare等公共反向代理服务来提高性能和安全性。

💡防火墙规则

防火墙规则用于定义哪些类型的网络流量被允许或禁止进入或离开网络。视频提到,可以设置防火墙规则来限制VPN的访问,或者通过Cloudflare的IP范围来强制流量通过Cloudflare,以防止直接访问IP地址的情况。

💡入侵检测系统(IDS)和入侵防御系统(IPS)

IDS和IPS是网络安全技术,用于检测和阻止恶意活动。IDS主要用于检测攻击,而IPS则进一步阻止这些攻击。视频建议开启这些系统,因为它们可以基于已知的攻击签名来提供保护,提高自托管服务的安全性。

💡反向代理

反向代理服务器充当客户端和服务器之间的中介,将客户端的请求转发到后端服务器。视频提到,使用反向代理可以简化证书管理,提供额外的安全层,并能够与Cloudflare等公共反向代理服务结合使用,以增强安全性和性能。

💡两因素认证

两因素认证是一种安全验证方法,要求用户提供两种不同的认证因素,通常包括密码和手机验证码等。视频提到,使用两因素认证可以为服务提供额外的安全保护,确保只有授权用户才能访问应用。

Highlights

安全始于家庭实验室的基础,而不仅仅是最后一跳。

讨论了在家庭中自托管服务的最佳架构实践。

硬件和配置、应用程序托管考虑事项、网络配置和分割、反向代理、证书和双因素认证、防火墙配置、互联网安全设置等都是自托管服务的重要组成部分。

Microcenter是购买硬件和科技产品的最佳去处,为新客户提供了免费的SSD。

通过自托管VPN暴露服务是公开暴露服务的下一个最佳选择。

公共云托管可以减少在家托管的风险。

硬件选择和固件更新对于自托管服务至关重要。

虚拟化操作系统时,确保虚拟机管理程序是积极维护和完全修补的。

选择一个安全的操作系统并定期打补丁。

容器化时,确保容器引擎是最新的,使用官方来源的容器。

网络分割对于提高性能和安全性至关重要。

外部网络配置应该只转发必要的端口,使用反向代理提高安全性。

Cloudflare可以提供反向代理,免费层级即可使用,增强性能和安全性。

通过Cloudflare的IP范围列表设置条件端口转发规则,以增强安全性。

启用入侵检测系统和入侵预防系统来检测和阻止攻击。

使用内部反向代理可以简化证书管理和流量路由。

Authelia这样的认证代理可以为服务提供额外的认证和授权层。

从Cloudflare到防火墙,再到反向代理和认证代理,构建了一个完整的自托管服务安全链。

如果感到不舒服或未准备好,可以选择不自托管服务,而是使用VPN或公共云服务。

Transcripts

play00:00

when most people think about

play00:01

self-hosting services in their home lab

play00:03

they often focus and only think about

play00:05

the last mile and by last mile i mean

play00:08

the last hop before a user accesses your

play00:10

services this last hop whether it's

play00:12

using certificates or a reverse proxy is

play00:14

incredibly important but it's also

play00:16

important to know that security starts

play00:18

at the foundation of your home lab take

play00:20

for instance this diagram this most

play00:22

likely makes up most things in your home

play00:24

lab and whether that be physical or

play00:26

virtual you'll find that you have most

play00:28

of these components but what if i told

play00:29

you your home lab should look like this

play00:31

that might seem incredibly complicated

play00:33

but it's much easier than you think

play00:35

today we're going to discuss some great

play00:37

practices in architecture for

play00:38

self-hosting services within your home

play00:41

we'll dive into individual systems

play00:43

hardware and configuration application

play00:45

hosting considerations network

play00:47

configuration and segmentation reverse

play00:49

proxies certificates and two-factor auth

play00:52

firewall configuration internet security

play00:54

settings and we'll even lean into

play00:56

external protection from a provider like

play00:58

cloudflare this will cover everything

play01:00

from the last mile all the way down to

play01:02

the hardware and speaking of hardware if

play01:05

you're looking for great deals on

play01:06

hardware you should look no further than

play01:08

our sponsor microcenter if you're a huge

play01:10

nerd like me one of the best places to

play01:12

shop for all your technology needs is

play01:14

micro center nothing beats walking into

play01:16

a store and feeling right at home and

play01:18

that's how i feel the minute i walk into

play01:20

a micro center store each and every time

play01:22

they have the best deals on gear for

play01:24

gamers streamers custom build pcs with

play01:26

performance and budget options keyboard

play01:28

and accessories desktops and laptops and

play01:31

much much more whether you're looking to

play01:32

build your own dream system networking

play01:34

and storage pre-built desktops or

play01:36

laptops home security and home

play01:38

automation diy and tech hobbies even

play01:41

printers and television or just some

play01:43

help from any of their experts they

play01:45

really do know what they're talking

play01:46

about microcenter should be your

play01:48

destination also microcenter has been

play01:50

generous enough to give a free ssd to

play01:52

all new customers and is available in

play01:54

store only so see the link in the

play01:55

description so be sure to visit your

play01:57

local micro center store today and if

play01:59

you can't make it in be sure to check

play02:01

them out on the web oh and tell them

play02:03

techno tim sent you they'll have no idea

play02:05

who you're talking about so what's the

play02:07

best way of protecting yourself while

play02:09

self-hosting

play02:10

don't

play02:12

just don't do it seriously you don't

play02:13

have to do it exposing yourself to the

play02:15

internet also exposes yourself to risks

play02:18

and the easiest way to mitigate that is

play02:20

to just don't do it at all i know that's

play02:22

not why you're here or what you want to

play02:24

hear so let's move on to the next best

play02:26

step also keep in mind that i'm not a

play02:28

security professional i'm just some

play02:30

random person on the internet giving you

play02:32

advice exposing your services through a

play02:34

self-hosted vpn is probably the next

play02:36

best way of exposing your services

play02:39

without doing it publicly this will

play02:41

create a secure tunnel from the outside

play02:42

of your network to the inside of your

play02:44

network from there you can create

play02:46

firewall rules and limit what the vpn

play02:48

can access this is a quick win and a

play02:51

secure way of exposing your services but

play02:53

only the people with vpn access will be

play02:55

able to access them so you've made it

play02:57

this far and you decided you still want

play02:59

to expose some services publicly so

play03:01

let's talk about public options this

play03:03

first option kind of falls into the

play03:05

don't host it at home option

play03:07

which is to host it in a public cloud

play03:09

hosting it in a public cloud still has

play03:11

its own set of concerns but it does

play03:13

mitigate a lot of the risk of hosting it

play03:15

at home that's because if that machine

play03:17

gets compromised they haven't

play03:19

compromised a machine on your local

play03:21

network they've compromised a machine in

play03:23

the public cloud but again that's not

play03:25

why we're here today we're here to

play03:27

self-host services on our own network

play03:29

but for those who want to expose some

play03:31

services directly from their home

play03:34

this is where the fun begins and again

play03:36

most people think of the last mile when

play03:38

self-hosting services it's this path

play03:40

right here

play03:41

but security starts at a much deeper

play03:43

level so rather than focus on this last

play03:46

hop right here we're going to zoom in

play03:47

and focus on the server that's running

play03:49

your services

play03:51

you typically don't think of the

play03:52

hardware when you're hosting

play03:53

applications in in the cloud you really

play03:55

don't have to but since we're hosting in

play03:58

our own personal cloud we do need to

play04:00

consider this the biggest takeaway here

play04:02

is to be sure that the hardware that

play04:04

your application is running on are

play04:06

patched with the latest firmware this

play04:08

includes firmware for the server itself

play04:11

firmware for devices like the

play04:13

motherboard hard drives

play04:15

network adapters

play04:16

and any other device that's physically

play04:18

connected to the server this also

play04:21

includes any firmware for any router or

play04:23

network device in your environment but

play04:25

we'll get into configuration here in a

play04:27

little bit and next we need to decide if

play04:29

we're going to virtualize our operating

play04:32

system or just run them bare metal

play04:34

really there is no wrong answer here it

play04:37

really depends on how you want to manage

play04:38

your infrastructure the key takeaway

play04:41

here is to make sure that your

play04:42

hypervisor is actively maintained up to

play04:44

date and fully patched there are some

play04:47

networking considerations here but we'll

play04:49

cover that in the networking section

play04:51

since virtualized network and physical

play04:53

network have a lot of the same concerns

play04:56

next is making sure you'll choose a

play04:58

secure operating system that your

play05:00

applications will run on now this is a

play05:02

big topic for debate so we aren't going

play05:03

to go into which ones are more secure

play05:05

but you have choices like windows

play05:08

embedded and many flavors of linux here

play05:11

are the takeaways you'll want to use one

play05:13

that's still supported and not end of

play05:16

life

play05:17

you'll want to patch all of these

play05:18

regularly and work it into your

play05:19

maintenance schedule you'll also want to

play05:21

use the principle of least privilege

play05:24

meaning giving the minimum level of

play05:26

access to any user on this system you

play05:28

also want to be sure you don't run

play05:30

anything as root or admin you also want

play05:32

to restrict who has access to these

play05:34

machines and try not to install

play05:37

additional services on these machines

play05:39

it's also a good idea if you can to use

play05:41

an application firewall and at the end

play05:44

of the day the os should be purposely

play05:46

built and maintained if you're running

play05:48

containers you'll have much of the same

play05:50

concerns as you do with an operating

play05:51

system

play05:52

however at a much smaller scale

play05:57

you'll first want to make sure that your

play05:58

containerization engine is up to date

play06:01

whether that be docker container d or

play06:03

pod man or any other you want to be sure

play06:05

that this service is patched and

play06:07

up-to-date also i recommend using

play06:09

containers from official sources

play06:12

this can be a challenge but you'll want

play06:14

to be sure that you're getting

play06:15

containers from the maintainer

play06:16

themselves or from a reputable source

play06:19

something like linux server.io and after

play06:22

you've chosen your container you'll want

play06:25

to check to see if they support a

play06:26

minimal image one that's built on

play06:28

something like alpine the reason you

play06:30

want to do this is for a couple of

play06:32

reasons first of all you get a smaller

play06:34

container next this container now has

play06:37

less attack surface containers with less

play06:40

dependencies means less to worry about

play06:42

and containers with less dependencies

play06:44

have less to patch or the possibility of

play06:48

vulnerabilities so if you choose a

play06:50

container that has more services that's

play06:52

more to patch more with the possibility

play06:55

of vulnerabilities and overall more to

play06:57

worry about after you've selected your

play07:00

container you'll also want to take into

play07:01

consideration the tags that you use now

play07:04

this is kind of a double-edged sword

play07:06

because most people want to pin their

play07:07

containers to latest to ensure that they

play07:09

have the latest container and then

play07:11

they'll use something like watchtower to

play07:13

update it automatically however keep in

play07:15

mind that latest may not have gone

play07:17

through the same testing and rigor that

play07:20

a tagged version of an image has this

play07:22

convention is really going to be up to

play07:24

the container maintainer but my general

play07:27

guidance is looking at the nginx

play07:28

container is that if you can pin to a

play07:31

specific version like this one

play07:32

1.21.5-alpine

play07:35

that's a good bet or you can pin to a

play07:37

less specific version like 1-alpine or

play07:41

even 1.21-alpine

play07:43

and then if all else fails you can pin

play07:45

the latest if you really wanted a high

play07:48

level a specificity you could actually

play07:51

pin to this digest here but that's going

play07:53

a little far but this does add some

play07:55

maintenance over time and you'll need to

play07:57

work this into your maintenance rotation

play07:59

but the takeaway here is that the higher

play08:01

level of specificity on your tag means

play08:04

that it's more easily reproduced in the

play08:06

future and now on to networking there

play08:09

are two sections to networking that are

play08:11

equally important

play08:12

internal networking and external

play08:14

networking starting with internal

play08:16

networking it's a must to segment your

play08:19

network if you're planning on

play08:20

self-hosting applications the idea

play08:23

behind network segmentation is that you

play08:25

divide your network into multiple

play08:28

segments or subnet each acting like its

play08:30

own small network this allows you to

play08:32

control the flow of the network between

play08:35

two networks and even internally based

play08:37

on a network policy

play08:40

this can not only improve performance

play08:42

but also security you can do this by

play08:44

subnetting or vlans and this allows you

play08:47

to keep trusted devices separate from

play08:50

devices that are connected or exposed to

play08:52

the internet or untrusted devices this

play08:55

can help mitigate the risk that if one

play08:57

of these devices get compromised

play09:04

they can only communicate with other

play09:07

devices on this network and if you have

play09:10

a network policy in place

play09:12

they can't get through to your trusted

play09:13

devices thus mitigating the risk this is

play09:16

not only a good idea for machines that

play09:19

are publicly exposed to the internet but

play09:21

also

play09:22

a good idea for iot devices

play09:24

[Music]

play09:27

but maybe more on that some other time

play09:29

the takeaway here is to segment your

play09:31

network to mitigate risk and now on to

play09:33

external network this is where the real

play09:36

fun begins this is how users and devices

play09:39

enter your network

play09:42

and for obvious reasons you want to be

play09:44

sure that only the ports you need to be

play09:45

forwarded are forwarded to the proper

play09:48

device in most cases you'll be hosting

play09:50

something like a website and if that's

play09:52

the case you'll want to be sure that

play09:54

it's only going to port forward 443 for

play09:57

https

play09:59

to the server that it's running on you

play10:01

don't want to open any additional ports

play10:03

and in most cases you'll want to port

play10:05

forward that to a reverse proxy that

play10:08

sits in front of your website

play10:11

however i highly recommend using a

play10:13

public reverse proxy along with your own

play10:16

so cloudflare provides a reverse proxy

play10:19

even with a free tier that you can use

play10:21

to improve performance

play10:23

somewhat protect your ip online

play10:25

provide some caching tls encryption or

play10:28

certificates and i think most

play10:30

importantly protect your site from

play10:32

attacks cloudflare is able to detect and

play10:35

block malicious attacks if you use them

play10:37

for dns

play10:39

and if you use them for dns your dns

play10:41

will point at them at their reverse

play10:43

proxy and it's in their best interest to

play10:46

detect and block these types of attacks

play10:48

since an attack on you is really an

play10:51

attack against them and this might sound

play10:54

complicated to set up but it's as easy

play10:56

as using a dynamic dns container or

play10:59

script that updates your domain to point

play11:01

to cloudflare then this will route all

play11:04

traffic through their reverse proxy and

play11:06

forward it on to you with tls encryption

play11:09

and if you're ever under attack you can

play11:11

simply turn on attack mode and force the

play11:14

javascript language challenge when

play11:16

people visit it

play11:20

so that attackers get stopped

play11:22

but real human beings get through

play11:26

and you can see some of my stats here

play11:28

you can see lots of requests are being

play11:30

routed through cloudflare you can see

play11:32

the total bandwidth over time you can

play11:34

see how many unique visitors visited and

play11:37

then you can also check out the security

play11:38

piece and you can see from this chart

play11:41

that they've actually blocked some

play11:42

threats and these were blocked at the

play11:44

cloudflare level and they never made it

play11:46

down to my reverse proxy you could see

play11:48

threats by country by region and the

play11:51

type of crawlers or bots i feel like

play11:53

setting up cloudflare is a huge win for

play11:55

privacy security and protection but

play11:58

what's stopping anyone from just going

play12:00

directly to my ip address what happens

play12:03

if someone figures out my ip address and

play12:05

wants to bypass cloudflare altogether

play12:08

well in this setup nothing at all

play12:11

don't worry friends there are ways to

play12:13

protect against this too this is where

play12:15

we'll combine our port forwarding rules

play12:17

along with cloudflare we'll force anyone

play12:19

from the outside coming in to go through

play12:21

cloudflare

play12:22

and if they don't we'll just block them

play12:24

so it looks like this clownflare

play12:27

publishes their list of ip ranges this

play12:29

is super helpful because we can build

play12:31

rules based on these ipv ranges

play12:34

see where i'm going here from these list

play12:36

of rules we can build a conditional port

play12:38

forward to say that if you're not coming

play12:40

from one of these sources just block and

play12:44

if you are let them through and it looks

play12:46

like this i'm basically doing

play12:48

conditional poor forwarding and i'm

play12:50

using udm and it works just the same

play12:53

probably a lot easier on p of sense but

play12:56

if we look at one of these rules what

play12:58

we're saying that hey if the source is a

play13:01

cloudflare ip on the port of 443 that's

play13:04

https then we'll forward to our reverse

play13:07

proxy otherwise we drop it and i had to

play13:10

do this quite a few times in udm because

play13:12

there isn't an easy way to do this but

play13:15

it's much easier if you're using pfsense

play13:17

and if you're using something else just

play13:19

look at your port forwarding rules and

play13:21

see if they support conditional port

play13:23

forwarding and since we're talking about

play13:25

cloudflare we may as well talk about

play13:26

some firewall rules too that you can set

play13:28

up there now some people will block

play13:30

entire countries from their firewall or

play13:32

even blocked or now i've never really

play13:34

found these to be too helpful because

play13:37

most of the time bad actors are just

play13:39

going to use a vpn in your local country

play13:41

and come in that way but if you do want

play13:43

to block countries it's here in firewall

play13:45

rules but while we're talking about

play13:47

networking in firewalls we should also

play13:49

talk about ids which is intrusion

play13:51

detection system and ips which is

play13:54

intrusion prevention system and

play13:56

generally speaking these are just ways

play13:58

to detect and block attacks based on

play14:00

some signatures they do this by

play14:02

analyzing the request and the traffic

play14:04

and then seeing if that matches a

play14:06

signature and then alerting you if you

play14:09

have ids turned on and blocking it if

play14:11

you have ips turned on now i would

play14:13

definitely turn these both on

play14:15

self-hosting or not because they block

play14:16

against known attacks now i say known

play14:20

because they're only as good as the

play14:21

signatures that you have so if you're

play14:23

running something like pfsense that'll

play14:24

be snort or tsurikata and if you're

play14:27

running udm pro it'll be right here

play14:29

under firewall and security but you'll

play14:31

want to make sure that you detect and

play14:33

block and then you can set a sensitivity

play14:35

level here i have mine to the highest

play14:37

possible and here we can see the list of

play14:40

threat categories now i have these all

play14:42

turned on and you might have some

play14:44

additional toggles like dark web blocker

play14:46

and malicious website blocker but you'll

play14:48

want to make sure that all of the

play14:49

security systems that your firewall

play14:51

supports are turned on and up to date

play14:53

and you'll want to make sure that you

play14:55

regularly check these for me that's as

play14:57

simple as going into notifications and

play15:00

making sure that any intrusion attempts

play15:02

were blocked and now that we have

play15:04

everything in place we can finally meet

play15:07

in the middle and use our own internal

play15:09

reverse proxy arguably you don't need

play15:12

one if you're using cloudflare but i do

play15:15

it with or without cloudflare so a

play15:17

reverse proxy is an easy way to direct

play15:20

traffic from your clients to one of your

play15:22

servers

play15:23

we talked about this with cloudflare and

play15:25

it's also a place where you can have

play15:28

your certificates having them here

play15:30

versus each individual server makes

play15:32

maintenance much easier and setting up a

play15:35

reverse proxy can be challenging however

play15:38

i've already documented this in a video

play15:40

and the reverse proxy i usually choose

play15:42

is traffic traffic can route requests to

play15:44

your servers and get publicly signed

play15:46

certificates for you to use and even

play15:49

integrate with other systems using

play15:52

middleware so speaking of middleware

play15:54

another choice you'll have to make is

play15:56

whether or not you want your services to

play15:58

have authentication or not some services

play16:01

do provide authentication

play16:03

but they may not support two-factor

play16:05

authentication this is where something

play16:07

like authalia comes into play authalia

play16:09

is an auth proxy that works with your

play16:12

reverse proxy

play16:13

to provide authentication and

play16:15

authorization for your services even if

play16:18

they don't have authentication of their

play16:20

own this is great for applications that

play16:22

need another layer of protection and

play16:24

with two-factor authentication helps

play16:26

give you confidence that your apps can

play16:28

be accessed by you and only you put them

play16:31

upside down because he's mad because

play16:33

auth is in the middle but whatever this

play16:36

is definitely an advanced use case and

play16:38

should only be set up after you have

play16:40

all of this already running

play16:43

after we have this last step set up

play16:45

we've gone all the way from the end user

play16:47

going through cloudflare to your

play16:49

firewall configured a firewall with

play16:51

protection set up a reverse proxy then

play16:54

set up an auth proxy and for a server we

play16:57

configured our hardware

play17:02

and the operating system and then our

play17:04

service

play17:05

if it's running in a container you

play17:07

should now have a little more confidence

play17:09

in self-hosting some things in your home

play17:11

lab and remember you don't have to do

play17:14

any of this

play17:15

if you feel uncomfortable or you're not

play17:17

ready you can still fall back to a vpn

play17:20

or host it in a public cloud or do

play17:23

nothing at all and there are also some

play17:25

side quests we didn't talk about like

play17:26

tunneling but you could set this up

play17:29

different altogether so what do you

play17:31

think about self-hosting some services

play17:33

at home do you not want to expose

play17:34

anything publicly but your vpn did i

play17:37

miss anything in my guide

play17:39

let me know in the comments section

play17:40

below and remember if you found anything

play17:43

in this video helpful

play17:44

don't forget to like and subscribe

play17:47

thanks for watching first name here from

play17:49

the netherlands all right thank you

play17:50

thank you so much funny i j i i won't go

play17:53

into there but

play17:55

people at work joke around because

play17:56

they're like you must be big in the

play17:57

netherlands and i was like actually a

play18:00

fair portion of my traffic on youtube

play18:02

comes from the netherlands but they they

play18:04

joke around with me because once i

play18:05

jumped on uh a call at work and the

play18:08

people on the other side of the call

play18:09

were from the netherlands and one guy

play18:11

was like are you techno gym do you have

play18:13

a youtube channel i kind of i didn't

play18:15

even see it in chat and then later on

play18:17

that you know they were teasing me at

play18:19

work they're like you must be huge in

play18:20

the netherlands because that guy

play18:21

recognized you and i didn't even see in

play18:23

chat that he had said he knew who i was

play18:26

because it was zoom chat not like

play18:27

anywhere else and that's obviously class

play18:29

but anyways long story short someone

play18:32

from from work

play18:33

when i was on a call

play18:35

recognized me i was like oh that's

play18:37

that's pretty awesome anyways uh thank

play18:39

you and welcome um from the us thank you

play18:42

for being here

Rate This

5.0 / 5 (0 votes)

相关标签
自托管服务网络安全硬件选择网络配置VPN防火墙云服务流量分析身份验证容器技术云防护