Setting up a local.host alias for localhost on windows - node.js

I'm trying to setup everyauth for my node app. Although I've reached a step that I have no idea how to accomplish.
It's asking to setup local.host as an alias for localhost, but it references some linux folders, I'm using windows.
Here's the exact instructions I'm stumped on.
Important - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a localhost alias called local.host. Make sure you set up your /etc/hosts so that 127.0.0.1 is also associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: '127.0.0.1 localhost local.host'
(source here)
How do you accomplish this on windows?

This can be done by editing you hosts file. Open notepad++ (or notepad) as admin. Then hit open, and select C:\Windows\System32\drivers\etc\hosts. You will see:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# ...
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
::1 localhost
And add this line at the end:
127.0.0.1 local.host
Save and you're done

Regarding the answer (Add the entry to your HOSTS file)
This does not work entirely on Windows 10, Windows Server 2019. You CAN PING the new alias (ping local.host), but it you try to use it in windows explorer (\local.host), you get a login prompt that will always fail. Check the EVENT viewer and you will see:
Audit Failure ... A privileged service was called. . . .
C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe
Service Request Information: Privileges: SeTcbPrivilege
I've found no way around this.
So the answer is technically correct, but may not work in all cases.

Related

nameservers update differently with openconnect and openconnect-gnome in ubuntu 18.04

This seems to be a new issue with network-manager-openconect-gnome in Ubuntu 18.04+
I install sudo apt install network-manager-openconnect-gnome to get gnome integration with opeconnect and Cisco AnyConnect Compatible VPN (openconnect)
As an aside (which may actually be relevant) I do this to get *.local addresses to resolve:
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf as per systemd docs
Move dns before mdns4_minimal in /etc/nsswitch.conf
If I connect to the VPN with openconnect through the gnome network manager, VPN addresses (sites for work) do not resolve. Regular sites continue to work as expected.
If I connect to the VPN with openconnect on the command line with sudo openconnect vpn.mycompany.com, VPN addresses (sites for work) do resolve. Regular sites continue to work as expected.
I thought I would check to see if there were any differences between /etc/resolv.conf with each of these VPN connection methods and sure enough, there is one:
openconnect on the command line (working):
##VPNC_GENERATED# -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 10.10.10.10
nameserver 10.10.10.11
search broadband mycompany.com
openconnect gnome integration (not working):
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 192.168.1.1
nameserver 10.10.10.10
nameserver 10.10.10.11
search broadband mycompany.com
If I remove (or comment out) the nameserver 192.168.1.1, which is the difference in content between the working and not working files... everything works as expected. I can resolve addresses within the company and regular sites work as expected.
This does not happen with Fedora. Everything works out of the box. I'm not sure why the network-manager-openconnect-gnome package works differently or if there's a way I can make it work without either
Editing the file by hand.
Using the openconnect tool from the command line and keeping a terminal open running that command.

Linux Mint 19 Local DNS resolution problem

I installed Linux Mint 19 after using Ubuntu for a while,
I a have a local domain with subdomains,
I can ping mydomain.local
but I can't ping or access my subdomains with their names,
my DNS server IP = 10.0.0.4
Here's my /etc/resolv.conf generated with resolvconf:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 10.0.0.4
And here's my /run/systemd/resolve/stub-resolv.conf :
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 10.0.0.4
Please help me.
I found the problem, it was in the file /etc/nsswitch.conf in the line :
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
remark the "dns" is after the "[NOTFOUND=return]" part, so that is why the DNS resolution is not going correctly, so what I have done is moving "dns" before "[NOTFOUND=return]" part, and everything is good now.
I'm no Mint expert, don't know if I can help, but I'll certainly try... It's a bit 'blind leading the blind' in support forums :/
I recently installed Mint 19 but the only DNS issues I've had were caused by systemd's resolver. I have since replaced it with unbound.
I used this guy's instructions and it worked perfectly fine for me. YMMV.
https://blobfolio.com/2017/05/fix-linux-dns-issues-caused-by-systemd-resolved/
tl;dr: With systemd-resolve, LLMNR is used for short name resolution, which doesn't failover to a canonicalised DNS resolution. LLMNR is tried a few times and then it just fails without touching DNS.
I think there's a severe bug in it, TBQH - Others agree. Systemd's resolver behaves in an unexpected and possibly standards-breaking way and has done for 3-4 years.
HTH :D

Setting up DVWA with XAMPP on virtual Ubuntu

I've followed several sets of instructions, including an online recorded lecture, that show just copying the dvwa folder to /opt/lampp/htdocs and visiting localhost/dvwa in the browser with Xampp services started. I've attempted this, but this is the screen I get (instead of the DVWA page prompting me to log in and set up the database).
What could the problem be? Has anyone run into this before? I've reattempted the instructions on this virtual computer and on my windows 10 host over the past few days and cannot get past this, even the slightest bit of advice would be incredibly appreciated.
Allow the usage of custom virtual hosts
By default, xampp in ubuntu won't use the httpd-vhosts.conf file (the location of the virtual hosts), therefore we need to indicate that this file will be included during the runtime of apache. Open with your favorite code editor the httpd.conf file located tipically in /opt/lampp/etc or just execute the following command in your terminal to open a simple editor:
sudo gedit /opt/lampp/etc/httpd.conf
Now locate yourself in (about) the line 487 where you probably will find the following lines:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
As you can see, the Include statement that includes the httpd-vhosts.conf file is commented. Proceed to modify the line uncommenting that line:
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
And you're ready to configure your custom vhost.
Create a custom domain in the hosts file of your system
You need to create a custom domain where our apache virtual host will point to. This domain will be normally an ip (127.0.0.xx based) and a custom name.
To start, edit the hosts file located in /etc using your favorite code editor, or just by executing the following command in the terminal:
sudo gedit /etc/hosts
And proceed to add your custom host. In this example, our ip will be 127.0.0.3 and the domain myawesomeproject. So finally, our hosts file will look like:
Save the file, and now the domain myawesomeproject is an alias for the local address 127.0.0.5.
Create your first virtual host
Tipically, you need to create the virtual host in the httpd-vhosts.conf file located in /opt/lampp/etc/extra. Use your favorite editor to edit that file or just execute the following command to edit it in a terminal:
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
And create your own virtual host in this file. As shown in our custom domain in the vhost file of the system, the port that we are going to use is 127.0.0.5, therefore our virtual host will be:
<VirtualHost 127.0.0.5:80>
DocumentRoot "/opt/lampp/htdocs/my-first-project"
DirectoryIndex index.php
Options All
AllowOverride All
Require all granted
The deep and custom configuration of your VirtualHost is up to you. Save the file, and you're ready to test it.
Test your virtual host
To test it, in the folder /opt/lampp/htdocs/my-first-project, create a simple PHP file
(index.php) that will contain the following PHP code:
Start apache, mysql (entire XAMPP) using the following command (or whatever the way you start apache and the other required services):
sudo /opt/lampp/lampp start
Navigate in your favorite browser to http://myawesomeproject/ or http://127.0.0.5/ and you should get as output "Hello World" in the browser.

noVNC Multiple Localhost Servers

Ive got 4 dev VMs for four projects (all VMware Player VMs w/ubuntu 15.04 host) where each is running VNC (ports 5900, 5901, 5902, 5903) respectively.
I downloaded noVNC and saved to /var/www/html (my apache2 server on same host). Based on the ReadMe I then ran on my terminal
./utils/launch.sh --vnc localhost:5900
I received a missing websockify error, so downloaded it and placed it into the util folder. I then ran the same command and it worked! The terminal told me to Navigate to a url and sure enough I could control my VM.
However -- I'm wondering how can I use noVnc to access all 4 VM's? Is there some simple way to extend the port to a range like in iptables or firewalld?
./utils/launch.sh --vnc localhost:5900-5903
Okay, Ill answer for myself here in case it helps someone in the future...
First, create a token file where each line has a nickname, ip address, and port.
I created a file named token.list where each line looks like:
localhostnickname1: localhost:5900
localhostnickname2: localhost:5901
...
Then I use my terminal to go into the websockify folder so I can see the run file. I issue it the command:
./run --web /path/to/noVNC --target-config /path/to/token.list localhost:6080
Finally, I open my web browser and go to :
http://localhost:6080/vnc_auto.html?path=?token=localhostnickname1
Where localhost1 is the nickname of my first server on the first line of token.list
This link was my reference. If you want to serve this outside of localhost -- change the parameter localhost:8060 from localhost to an IP

Need help to change postgresql port on CentOS 7

I just installed the postgresql (as it says on postgresql), server is running like charm, no problem at all.
I just tried(want) to change the default port (5432) to (9898).
First I just tried to do it by postgresql.conf file under /var/lib/pgsql/data/postgresql.conf.
I just remove the comment for port related line, and change it as port=9898, but there is a comment saying overriding port here doesn't change anything for RHEL and deriven guys, it also says try to override the port config by service config file(cannot find it, where is it?).
I also change the postmaster.opts too (doesn't work the same).
Finally! how may I change the Postgresql 9.2.7 port number on CentOS 7?
Finally I found it, the service file is /lib/systemd/system/postgresql.service, I just change the following line.
Environment=PGPORT=9898
stop the service as
service postgresql stop
then reload the daemon services using this
systemctl daemon-reload
Finally start the postgresql using
service postgresql start
Now it's working like charm :D
Login to psql. Try
show config_file ;
That is the file you should change. Did you restart the server after changing the port?
You can also try the file under /etc/rc.d/init.d for PostgreSQL if it is running as a service.
From /lib/systemd/system/postgresql.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql.service",
# containing
# .include /lib/systemd/system/postgresql.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# For example, if you want to change the server's port number to 5433,
# create a file named "/etc/systemd/system/postgresql.service" containing:
# .include /lib/systemd/system/postgresql.service
# [Service]
# Environment=PGPORT=5433
# This will override the setting appearing below.
I think it is better to follow the steps above.
I am using Amazon EC2 instance with Amazon Linux AMI release ( A kind of CentOS it seems). I needed to change PGPORT variable in /etc/init.d/postgresql file and restart the postgresql service using 'service postgresql restart'. And it works!!
PGPORT=some_new_port # /etc/init.d/postgresql

Resources