HTTPS server for Windows and Node.js - node.js

Asking here because I have scoured the web and haven't found a tutorial that is simple enough for me to understand. I am trying to create a local web server with https so that I can access the camera stream from my phone. For my web server I am using Node.js on a windows machine. I am accessing my web server from my phone using my computers local IP address. I don't have a domain name. I'm not trying to make a fully fledged website, just a demo for a hackathon.
I have tried LetsEncrypt but during the setup for win-acme, it asks for stuff like what kind of certificate I want to create and what is the web root, and I'm not sure what to put there (localhost? my ip address?). When I try to follow the instructions on this SO question, I tried the command
New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation "cert:\LocalMachine\My"
but I don't know where the .key and .crt files went. Can anybody provide a simple and easy to understand tutorial on what to do? This is my second time running into this problem and it seems like nobody around me knows how to solve it either.

Related

Apache Webserver - getting security risk error on local network but not on public domain

I have an asp.net core MVC website running with an asp.net core Rest API on the same server. It was a bit tricky to set up the Apache2 configuration, but I finally got it working.
From the outside, everything works perfectly. I can access https://{domain}.com and it works, and I can access https://{domain}.com/api and it works too. I was getting a weird error, the MVC project couldn't find the api project even though I could find it from the outside.
In the same network, I have a linux machine with a GUI so I can browse to the internet from there. I discovered that https://{domain}.com gives a security error, and that is probably why the two projects can't communicate with each other.
In above screenshot ou can see what I get when going to that website. It works fine from a different network.
The server is configured with SSL using LetsEncrypt. The SSL is fine from outside, but apparently not from inside.
Here you can see my apache2 configuration.
My goal is that I can access https://{domain}.com from the internal network, I think that will solve my issue.

When using an online IDE like gitpod, is there a way to remotely access a server?

Im currently working on a Chromebook with admin blocks on everything, including crosh and Linux dev access. I want to start a server using Express and Node.js, which is functional, but when attempting to connect using a different device, I'm stuck. The IP address the server is relaying is instead Gitpods' IP, not my local IP. Any advice or help is appreciated, and if I'm unclear please let me know so I can change the question or body!
have you tried making your server port public from the Remote Explorer tab on Gitpod's VSCODE on your Browser?
You can also check this out: https://www.gitpod.io/docs/config-ports#configure-port-visibility

Unable to host Blazor application

I am unable to get a Blazor app working while hosting the application as an IIS application on my local Windows 10 machine. The app is very simple, with just one page with minimal components - even simpler than the default Blazor app provided.
These are my steps:
Click on publish app
Select Folder, note it's going to ...\bin\Release\net5.0\browser-wasm\publish\
Open IIS, navigate to Default Web Site
Right-click Default Web Site and select Add Application
Select physical path as the path above, and host at www.NAME.com
Click Browse.. to view the app at www.NAME.com on *:80
Page displayed is the welcome page of IIS
Attempted Solution 1: Install URL Rewrite
Attempted Solution 2: Go to Hosts (in System32) and tried adding 127.0.0.1 or 127.0.0.1::80 followed by www.NAME.com
Attempted Solution 3: In index.html, edit the base element to include the link <base href="/NAME/" />
Attempted Solution 4: Instead of adding an application under Default Website in IIS, add it as a website instead
Attempted Solution 5: Gave IIS_IUSRS full permissions to web.config (Image)
None of the attempted solutions worked. I just started using Blazor yesterday and I am very new to this. Am I doing something wrong? Thank you!
Please refer to this tutorial, I think is one of the best tutorial to achieve your goals:
https://blog.medhat.ca/2020/08/deploy-client-side-blazor-web-api-to.html?m=1
Remember that the configuration of the hostname in your hosts file is related to your machine only
So, in order to allow the students to access your IIS published site you need:
Register a hostname in a DNS server that all the computer of the students will use to resolve your machine name. I.e. if your machine should be accessible with www.name.com you need your DNS server resolves this name with your local IP address
To use the https protocol you need a certificate on your local machine, loaded in your IIS configuration, but the same certificate has to be available to every computer of your students.
I think the better and simpler solution is to use your local machine name, probably using your full DNS name, and allows the students to access the site using this name on their browser.
In this case you can use your local development certificate to allow https connection
This certificate is already installed on your machine for development purpose.
Every concept I've described is well documented on the web and here on the SO.

How would I use my domain on my windows server 2012?

I recently started a project of building a server at home and trying to host a website on it. I have almost everything setup and working correctly but only have one issue, I can't figure out how to use my domain with it. I've been searching the internet for a few days and everything I come across isn't very informative on how to do it. I'm very new to hosting my own servers and would love any help. Thanks in advanced.
I should also mention that I'm using Windows Server 2012 R2 and IIS 8. The computer has a static IP as well.
Not sure what you mean by use my domain but I am guessing if you go to the url it is not loading you site? If that is the case, have you registered you bomain with a provider (godaddy, namecheep, etc)? After that make sure your router is forwarding the ports needed to your computer. Lastly make sure that those ports are open on your firewall. Things to help debug issues is can you ping your domain and get your static IP, if not the issue is with your domain registration. If it tries to load the site and doesn't but the IP is good then the issue is between the provider and you computer more than likely.

Using EFS with IIS. How enshure recovery

Hi Im working on a system where the user can store important information on a website.
Using Ws2012, and IIS8
Im using EFS to encrypt the data in normal files.
It need to be secure from the Admin on the server. (at least make it difficult to get the information)
The files need to be en/decryptet in-flight.
It's actually working fine. Just by setting the folder as EFS and then the files saved by IIS are encryptet and the Admin cant get the content.
So far so good.
Problem: But if the IIS is reinstalled, or the server needs to be rebuild/reinstalled then the files are not avalible for the "new" IIS, as the certificate is different.
Normally I can login as a user and backup the EFS certificte, but how do i do this with IIS.
The idea is to have only one Admin (super trusted) to export the certificate and keep it safe. So all the "normal" admins cant get to it.
So after a rebuild of the server the certificate can be reinstalled and the new IIS can access the files Again.
I have looked at several ways to get the certificate, but all explanations / examples uses a local logged in user, and not a "service" user like the IIS uses.
There could be 2 ways:
One is when creating the site, a certificate would be installed for the IIS to use. This way export is not nessesery, and all sites uses the same certificate. But How?
Second way is to export the certificate the IIS uses, but How?
Hopefully this is a simple task, i just can't find it.
Regards
Jesper

Resources