< Return to Video

EXPOSE your Homelab to the INTERNET?! (Be Careful)

  • 0:01 - 0:02
    Hi everyone, welcome back
  • 0:02 - 0:05
    So today we're going to try
    something a little bit different.
  • 0:05 - 0:08
    We're gonna start a new video series
  • 0:09 - 0:13
    about all the different ways to
    expose or access our homelab
  • 0:13 - 0:14
    from the internet.
  • 0:15 - 0:18
    The reason is mainly because
    there's tons of options out there,
  • 0:18 - 0:21
    and I feel like it's not talked enough
    about on YouTube.
  • 0:21 - 0:23
    Especially the security part
  • 0:23 - 0:25
    which is most important.
  • 0:25 - 0:29
    Almost everyone just assumes it's secure,
    which isn't always the case,
  • 0:29 - 0:31
    so make sure to hit the Like button
  • 0:31 - 0:32
    Subscribe and Share
  • 0:32 - 0:33
    and let's get started.
  • 0:34 - 0:35
    Okay so how to do it,
  • 0:36 - 0:39
    to expose our homelab
    there are five main ways
  • 0:39 - 0:42
    1. Secure Tunnels like Cloudflare
  • 0:42 - 0:44
    2. Reverse proxies like Nginx
  • 0:44 - 0:48
    3. Traditional VPNs like Wireguard
    or OpenVPN protocols
  • 0:48 - 0:51
    4. Mesh VPNs like ZeroTier and Tailscale
  • 0:52 - 0:55
    and lastly 5. the old classic
    port forwarding or NAT
  • 0:55 - 0:59
    So let's break down each one of them
    quickly to understand the differences.
  • 0:59 - 1:02
    First secure tunnels like Cloudflare.
  • 1:02 - 1:07
    This is often defined as secure tunnels to
    access your app without exposing your IP
  • 1:07 - 1:09
    making remote access easy.
  • 1:09 - 1:11
    It's also fairly easy to setup,
  • 1:11 - 1:11
    however, by default it's not secured enough
  • 1:14 - 1:17
    and solely [relies] on your app security
  • 1:17 - 1:19
    but this can be improved.
  • 1:19 - 1:22
    We'll cover this later in another video.
  • 1:22 - 1:24
    Next, reverse proxies
  • 1:24 - 1:25
    like nginx.
  • 1:25 - 1:28
    It's a server that sits in the middle and forward requests to your homelab
  • 1:28 - 1:32
    helping you manage multiple services under one domain.
  • 1:32 - 1:34
    While adding another layer of protection,
  • 1:34 - 1:39
    you will have more control over your services
    and how to
  • 1:39 - 1:41
    contr-
    manage them.
  • 1:41 - 1:46
    However, it exposes your IP and you must open a port on your router to access it.
  • 1:47 - 1:51
    Next, traditional VPNs like Wireguard or OpenVPN.
  • 1:51 - 1:54
    It creates an encrypted tunnel between your device and
  • 1:54 - 1:55
    your homelab
  • 1:55 - 1:58
    making it feel like you are on the same local network.
  • 1:58 - 2:01
    It's good for privacy and security
  • 2:01 - 2:03
    but only useful when you are the only user because
  • 2:03 - 2:07
    it's impossible to share access without sharing your private key
  • 2:07 - 2:10
    to other users.
  • 2:10 - 2:12
    Next, mesh VPNs
  • 2:12 - 2:14
    like ZeroTier or Tailscale
  • 2:14 - 2:19
    this is similar to normal VPNs except it connects devices between each other
  • 2:19 - 2:22
    instead of connecting them to a central server.
  • 2:22 - 2:26
    It has more control over normal VPNs in the way that you can choose which devices to share
  • 2:26 - 2:29
    but you must manually join the network
  • 2:29 - 2:32
    each time for each devices you want to give access to.
  • 2:32 - 2:36
    Finally NAT this is a classic way of opening specific ports on your router
  • 2:36 - 2:38
    to expose your homelab.
  • 2:38 - 2:42
    It's simple but it also carries high
    security risk if you rely on it alone.
  • 2:42 - 2:47
    Keep in mind NAT often gets used with other
    methods like previously showed,
  • 2:47 - 2:51
    but going purely [on it's own] port forwarding is a no-go for secure setups.
  • 2:52 - 2:53
    Now, you may be wondering,
  • 2:53 - 2:55
    what's the most secure setup
  • 2:55 - 2:56
    to expose your home lab?
  • 2:56 - 3:00
    Actually, [it] depends on your apps and what you want to do?
  • 3:00 - 3:03
    In my opinion, it's not about which method you use
  • 3:03 - 3:06
    but more about how you combine between them.
  • 3:06 - 3:10
    The best setup is to mix them
    and make them work all together
  • 3:10 - 3:12
    to have the perfect setup.
  • 3:14 - 3:17
    Okay so first let's go to cloudflare.com
  • 3:17 - 3:17
    Go to "Sign Up"
  • 3:19 - 3:22
    and free at the website.
  • 3:23 - 3:26
    And let's create a new account now.
  • 3:30 - 3:32
    After that if you already have [a]
    domain [previously purchased]
  • 3:32 - 3:33
    enter it here
  • 3:33 - 3:36
    or for me I'm just going to create a new domain.
  • 3:40 - 3:41
    For some reason I got an error
  • 3:41 - 3:42
    when trying to pay
  • 3:43 - 3:45
    So I'm just going to import an existing domain
  • 3:45 - 3:47
    Just going to type it here.
  • 3:51 - 3:54
    Okay, so then go down
  • 3:55 - 3:56
    and choose the free package.
  • 4:00 - 4:03
    Next click on continue to activation.
  • 4:03 - 4:07
    Confirm. Next we need to
    do some modifications
  • 4:07 - 4:11
    We need to modify, the current name servers
  • 4:11 - 4:13
    with Cloudflare nameservers
  • 4:13 - 4:16
    to allow Cloudflare to control the domain.
  • 4:17 - 4:18
    To do that,
  • 4:18 - 4:20
    we go to the domain provider
  • 4:20 - 4:22
    in my case it's NameCheap.
  • 4:26 - 4:29
    So in my case
    I'm gonna do custom DNS
  • 4:29 - 4:31
    and then I copy....
  • 4:36 - 4:38
    the nameservers
  • 4:39 - 4:40
    and then I save.
  • 4:43 - 4:46
    It tells you that it can take
    up to 48 hours
  • 4:46 - 4:49
    But it's not true it [can take] just a few seconds
  • 4:49 - 4:50
    or a few minutes max
  • 4:50 - 4:52
    But, just in case
  • 4:53 - 4:55
    If it take a long time to update
  • 4:55 - 4:57
    Uh, this is normal so
  • 4:57 - 4:58
    just wait
  • 4:58 - 5:00
    There is no other choice
  • 5:01 - 5:02
    Okay, so after a while,
  • 5:02 - 5:05
    We get this page this means everything is good
  • 5:05 - 5:07
    Now we go to access page
  • 5:07 - 5:10
    and then NetZero Trust.
  • 5:10 - 5:12
    We choose our account
  • 5:12 - 5:14
    Next you go to access
  • 5:15 - 5:18
    Next we choose teamname
  • 5:18 - 5:20
    Just anything
  • 5:23 - 5:26
    Then we choose the free package of course
  • 5:27 - 5:30
    There is zero payment
  • 5:33 - 5:35
    Next we go to Networks
  • 5:36 - 5:36
    Tunnels
  • 5:37 - 5:39
    And we add a tunnel
  • 5:40 - 5:41
    We choose this one Cloudflared
  • 5:42 - 5:43
    We name our Tunnel
  • 5:43 - 5:45
    Homelab uh test
  • 5:48 - 5:50
    Next it will ask you to choose your environment
  • 5:50 - 5:52
    In this case you just uh
  • 5:52 - 5:54
    You just choose docker
  • 5:54 - 5:55
    and then we just copy the comment
  • 5:55 - 5:58
    because we just need the token.
  • 5:58 - 6:00
    We don't need to run anything docker
  • 6:00 - 6:02
    Then we go back to TrueNAS
  • 6:02 - 6:04
    and we install
  • 6:04 - 6:06
    the Cloudflared app.
  • 6:07 - 6:09
    This one
  • 6:11 - 6:13
    And here we['ve] got [to just]
    paste what we had
  • 6:13 - 6:15
    and we just keep.
  • 6:16 - 6:19
    Remove everything, we just keep the token.
  • 6:25 - 6:27
    So anything before this goes.
  • 6:29 - 6:30
    That's it.
  • 6:32 - 6:34
    We don't need to setup anything else.
  • 6:35 - 6:38
    Even storage, it's not necessary.
  • 6:40 - 6:41
    And we install.
  • 6:44 - 6:45
    Okay now it's up and running.
  • 6:46 - 6:48
    Let's go back to Cloudflared profile.
  • 6:48 - 6:51
    Now we need to wait until we get uh
  • 6:51 - 6:53
    something here in connectors.
  • 6:53 - 6:55
    It will automatically search.
  • 6:55 - 6:56
    Alright here we go
  • 6:56 - 6:57
    It's connected.
  • 6:57 - 6:59
    So now we can continue.
  • 6:59 - 7:00
    Next
  • 7:02 - 7:06
    Now we're ready to add our first service.
  • 7:07 - 7:09
    Let's start by adding TrueNAS itself.
  • 7:09 - 7:12
    So let's just copy the IP
  • 7:15 - 7:17
    Then we choose the subdomain
  • 7:17 - 7:18
    TrueNAS
  • 7:18 - 7:20
    and choose the domain
  • 7:21 - 7:23
    then we choose HTTP
  • 7:24 - 7:26
    and then the IP
  • 7:27 - 7:30
    There is nothing specific to add there.
  • 7:30 - 7:31
    That's save.
  • 7:33 - 7:36
    To test this I'm going to disconnect
    from the VPN
  • 7:36 - 7:41
    Because i'm not at home I'm
    connected to my home VPN.
  • 7:41 - 7:43
    So i'm just going to deactivate it
  • 7:43 - 7:44
    and try this.
  • 7:45 - 7:51
    To show that likely if I try to go to the same IP
  • 7:53 - 7:54
    It's not going to work,
  • 7:54 - 7:56
    because I disconnected from the VPN.
  • 7:57 - 7:58
    And if I try
  • 7:59 - 8:00
    a domain,
  • 8:00 - 8:01
    new domain.
  • 8:05 - 8:05
    It works.
  • 8:06 - 8:06
    So now
  • 8:09 - 8:11
    TrueNAS is accessible
  • 8:11 - 8:12
    from the outside.
  • 8:13 - 8:15
    But this is not recommended of course.
  • 8:15 - 8:17
    If you want to expose something
  • 8:17 - 8:19
    just expose the apps individually
  • 8:19 - 8:21
    don't expose the whole thing.
  • 8:22 - 8:23
    so
  • 8:24 - 8:25
    So now I'm just going to delete it
  • 8:26 - 8:29
    and then I'm gonna add something else.
  • 8:34 - 8:36
    Okay now I want to add another service.
  • 8:37 - 8:38
    Maybe, Proxmox
  • 8:40 - 8:42
    Let's go to add the public hostname
  • 8:43 - 8:44
    Proxmox
  • 8:44 - 8:45
    same thing
  • 8:48 - 8:50
    here's we're going to choose HTTPS instead of HTTP
  • 8:51 - 8:53
    and then the IP
  • 8:54 - 8:58
    as well as the port which is 8...
  • 8:59 - 9:00
    8006
  • 9:04 - 9:07
    and then we go to Additional Settings > TLS
  • 9:08 - 9:11
    and we enable No TLS verify.
  • 9:11 - 9:12
    It will not check certificates.
  • 9:13 - 9:14
    Now let's save.
  • 9:16 - 9:18
    Let's try again now.
  • 9:25 - 9:26
    NIce! Now it works.
  • 9:33 - 9:35
    And we'll disconnect the VPN
  • 9:36 - 9:36
    and refresh
  • 9:37 - 9:38
    and it still works.
  • 9:39 - 9:41
    Okay now before we're finishing the video
  • 9:42 - 9:43
    let's do
  • 9:43 - 9:45
    one last service which is
  • 9:45 - 9:46
    Paperless.
  • 9:46 - 9:50
    Since we already covered this in a previous video,
  • 9:50 - 9:52
    we're going to see how to expose this
  • 9:52 - 9:55
    Why did I choose Paperless because
  • 9:55 - 9:56
    it's a bit tricky to setup
  • 9:57 - 9:58
    it's not as simple as
  • 9:59 - 10:00
    adding the hostname.
  • 10:01 - 10:04
    So, let's see first we just add the hostname of course
  • 10:07 - 10:08
    same thing as always,
  • 10:10 - 10:13
    HTTPS, and then we take the URL
  • 10:17 - 10:19
    which is IP and Port
  • 10:25 - 10:28
    It chooses HTTP not HTTPS
  • 10:29 - 10:30
    Service name
  • 10:31 - 10:34
    So first it's gonna work normally
  • 10:35 - 10:37
    ff I try to access.
  • 10:40 - 10:41
    Alright
  • 10:42 - 10:44
    Uh, but the problem is when you
  • 10:44 - 10:45
    try to login
  • 10:49 - 10:50
    You get this
  • 10:51 - 10:53
    error. CSRF verification failed.
  • 10:53 - 10:54
    Why?
  • 10:54 - 10:56
    We need to change some settings
  • 10:56 - 10:58
    to make it accessible.
  • 10:58 - 11:02
    According to the documentation
  • 11:02 - 11:06
    we need to set this environment variable (PAPERLESS_URL)
  • 11:06 - 11:11
    uh and uh, set it to the domain name
  • 11:11 - 11:12
    we used in Cloudflare.
  • 11:13 - 11:14
    So let's do that
  • 11:15 - 11:18
    go to Paperless > Edit
  • 11:20 - 11:25
    and let's just add it as an environment variable here
  • 11:26 - 11:28
    PAPERLESS_URL
  • 11:29 - 11:32
    set it to paperless.yourdomain
  • 11:36 - 11:40
    make sure to add HTTPS to the beginning
  • 11:42 - 11:44
    and that's it.
  • 11:44 - 11:45
    Update.
  • 11:48 - 11:51
    In case you got stuck in deploying
  • 11:51 - 11:53
    which was the case for me
  • 11:54 - 11:56
    I'm not sure why but the container Paperless
  • 11:57 - 12:00
    just stuck like this for a long time
  • 12:00 - 12:04
    So what I did is stop this instance
  • 12:04 - 12:06
    and create another instance
  • 12:06 - 12:11
    using the already created datasets.
  • 12:11 - 12:14
    So you're not going to lose anything
  • 12:14 - 12:15
    of your files.
  • 12:17 - 12:19
    So let's start another instance
  • 12:21 - 12:23
    Let's call it paperless-cloudflare.
  • 12:26 - 12:29
    We can change password if you want.
  • 12:32 - 12:35
    By the way you can choose any secret key
  • 12:35 - 12:36
    you want. Just want some random stuff
  • 12:36 - 12:38
    You don't need to remember it.
  • 12:43 - 12:45
    Okay, add an email
  • 12:45 - 12:47
    just a fake email.
  • 12:51 - 12:52
    Password.
  • 13:02 - 13:06
    Now we add again environment variable
  • 13:06 - 13:08
    PAPERLESS_URL
  • 13:09 - 13:10
    HTTPS
  • 13:11 - 13:12
    paperless…
  • 13:12 - 13:13
    dot
  • 13:15 - 13:16
    your domain
  • 13:21 - 13:24
    and then we add the other host path
  • 13:28 - 13:30
    Paperless this is the data.
  • 13:31 - 13:32
    let's copy this
  • 13:33 - 13:35
    And now Media
  • 13:40 - 13:42
    and then Consume
  • 13:50 - 13:52
    and Trash
  • 13:58 - 13:59
    this is PostScript
  • 14:06 - 14:09
    Make sure to check "Automatic Permissions".
  • 14:13 - 14:14
    Then we hit install.
  • 14:18 - 14:20
    Let's wait [a] little bit.
  • 14:20 - 14:23
    It works but it takes some time.
  • 14:25 - 14:26
    Okay now it's running.
  • 14:27 - 14:28
    Let's start it.
  • 14:31 - 14:33
    First let's get the IP
  • 14:33 - 14:36
    I mean let's get the port-- IP is the same.
  • 14:37 - 14:38
    Go back to cloudflare
  • 14:39 - 14:40
    Hit it
  • 14:41 - 14:44
    Going to put the new port
  • 14:45 - 14:46
    Save
  • 14:50 - 14:51
    Let's try now
  • 14:55 - 14:58
    Okay, now new password
  • 15:03 - 15:05
    And now it works. We don't got the error
  • 15:05 - 15:07
    the previous error.
  • 15:08 - 15:10
    And as you can see we still have the [same] documents
  • 15:10 - 15:14
    as before we didn't lost anything.
  • 15:15 - 15:17
    We still got all our documents.
  • 15:22 - 15:23
    Open them
  • 15:27 - 15:28
    And uh, everything works fine
  • 15:33 - 15:33
    That's it
  • 15:34 - 15:35
    Basically this is how to
  • 15:36 - 15:39
    expose your services on the cloud
  • 15:43 - 15:44
    To recap:
  • 15:44 - 15:46
    When you want to expose your app,
  • 15:46 - 15:47
    this is how it works.
  • 15:47 - 15:49
    We don't access the app directly
  • 15:49 - 15:53
    but rather you access the cloud server
  • 15:54 - 15:57
    cloudflare server. Cloudflare will make exchanges
  • 15:57 - 15:58
    with your
  • 15:58 - 16:00
    LAN network through Cloudflare
  • 16:00 - 16:01
    and then
  • 16:02 - 16:04
    It will give access to your app.
  • 16:05 - 16:06
    This way you don't
  • 16:06 - 16:08
    access your app directly
  • 16:08 - 16:09
    which means you don't expose your
  • 16:09 - 16:11
    IP and you don't go through the NAT
  • 16:11 - 16:13
    you don't need to open a port
  • 16:13 - 16:16
    but be careful if your habit is insecure
  • 16:16 - 16:19
    and you get hacked. You directly expose
  • 16:19 - 16:20
    all of your homelab
  • 16:20 - 16:22
    It doesn't matter if you use Cloudflare
  • 16:22 - 16:23
    or not
  • 16:23 - 16:25
    Like and Share if you made it this far
  • 16:25 - 16:26
    See you in the next video
Title:
EXPOSE your Homelab to the INTERNET?! (Be Careful)
Description:

more » « less
Video Language:
English
Team:
Captions Requested
Duration:
16:28

English subtitles

Revisions Compare revisions