## Reverse DNS for Microsoft/bingbot ip failing

I am seeing heavy traffic from a few microsoft ip addresses and I’m trying to figure out if they are actual bingbot requests. Running the "host" command on the ips failed with the output "Host 189.211.247.52.in-addr.arpa. not found: 3(NXDOMAIN)". Here are some of the ips in question:

1. 51.143.95.48
2. 52.250.62.82
3. 52.250.54.21

The user-agent says it’s bing bot, but I wonder if it’s a scraper that’s using azure services. Is it safe to block these IPs?

## differential geometry – Is it possible to reverse engineer the metric to find the basis vectors of the manifold

For a given surface that has metric components $$g_{munu}$$ is it possible to find it’s basis vectors and more importantly the exact surface that space is on. Since we know that
$$g_{munu} = e_mu cdot e_nu$$

However, for an intrinsic geometry, the transformation that gives it its geometry is given by a general transformation $$x’^mu b_mu = G^mu(x^mu) b_mu$$ if we take the partial derivative with respect to $$x^nu$$ we get that
$$e_nu=partial_nu G^mu(x^mu) b_mu$$
The new space that these intrinsically curved coordinates live in is measured with orthogonal basis vectors $$b_mu$$. This gives us
$$g_{munu}=partial_mu G^alpha(x^mu) b_alpha cdot partial_nu G^beta(x^mu) b_beta$$
$$g_{munu}=partial_mu G^alpha(x^mu) partial_nu G^beta(x^mu) b_alpha cdot b_beta$$
$$g_{munu}=partial_mu G^alpha(x^mu) partial_nu G^beta(x^mu) delta_{alphabeta}$$

With this information is it possible to find the transformation $$G^mu(x^mu)$$ in terms of the metric components?

## ssh tunnel – I can’t connect to reverse SSH from another device

New to all this stuff, sorry if it seems basic. I have a Raspberry Pi creating a reverse SSH tunnel (over the Internet) to another RPi that I use as a server.

Tunnel creation : `ssh -i /home/pi/.ssh/id_rsa -p 45000 -N -R 2500:localhost:22 user@IP -o "ServerAliveInterval 5" -o "ServerAliveCountMax 2" -o "ExitOnForwardFailure yes"`

Server command : `ssh -p 2500 user@localhost`

This works fine, but now I want to do the same with a more “official” server.

So I copied the SSH key to another RPi (to know if it is possible to connect from another device before trying with the server), updated the NAT rules of the router to redirect the tunnel to the second RPi IP, and tried to connect. But it didn’t work. (No firewall set up)

To be clear, with this diagram :

``````A ===========> router <----------- B
but
A ===========> router <-----X----- C
``````

ssh is installed (`which ssh(d)` => `/usr/bin/ssh(d)`), and the service is launched.

Here is the verbose :

``````debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "localhost" port 2500
debug2: ssh_connect_direct
debug1: Connecting to localhost (::1) port 2500.
debug1: connect to address ::1 port 2500: Connection refused
debug1: Connecting to localhost (127.0.0.1) port 2500.
debug1: connect to address 127.0.0.1 port 2500: Connection refused
ssh: connect to host localhost port 2500: Connection refused
``````

/etc/ssh/ssh_config are the same in both RPi.
All the policies from iptables are set to ACCEPT (remote and local).
Logs from remote RPi doesn’t contain any information from connection attempts. (Seems logic as the ssh connection is not even set …)

Already tried to set `-L 0.0.0.0:...` but no results neither. (From this and this ServerFault topics, probably misunderstood the concepts)

Do you have any idea to connect to the tunnel with the second RPi ? Is it even possible without being on the same network ?

## reverse proxy – How to resolve single word domains to different IP:port combinations on local network?

I want to set up a local DNS server on my home network (like Pi-Hole or AdGuard) but add my own entries such that typing just `home` directs to my home assistant instance, `plex` directs to my plex instance, etc.

The problem I am foreseeing is that DNS can only resolve a name to an IP address, not IP:Port combo; and a bunch of my services run from the same machine (same IP). So when I type `home` it will go to `192.168.1.100` which is the right IP but I need to give nginx the right context to know which port to reverse-proxy to. Right now nginx is configured to redirect `home.mydomain.com` to the right port (and likewise for `plex.mydomain.com`, etc)

How do I configure the nginx reverse proxy to match on single word domains? Do i have to add an entirely different entry or can I do something to match on (`home.mydomain.com` OR `home`) in my nginx config?

Alternatively, do DNS have to resolve to an IP address? Or can i somehow configure pi-hole/AdGuard to resolve `home` to `home.mydomain.com`, which is then hairpinned back to my own network and routed by the reverse proxy?

I asked this question on (reddit)https://www.reddit.com/r/homelab/comments/jf0ant/local_dns_server_with_nginx_reverse_proxy_how_to/) and was told to use Caddy and SRV Records, but I am extremely confused how that helps me resolve single word DNS calls like `home` to the right IP + port.

This is (possibly) complicated by the fact that I want to do this for many words that resolve to the same IP but different ports. i.e., `plex` should be `192.168.1.100:plexPort`, etc.

## Solution discussion on the best way to reverse a number in Python

First, a note on complexity. Both your implementation and the reference implementation do indeed have O(n) complexity in the number of input digits in the best case, but O(log(n)) in the range of the input number.

This depends, mind you, on the expected range of the input number. For “typical values” below the limit of machine precision, which these days will be $$2^{63}$$ for most people, the contents of the reference implementation’s inner loop will be constant-time. However, Python has automatic support for arbitrary precision, and if that support is used, the reference implementation will end up being super-linear in the worst case.

As for reversal of a negative number, I think it makes less sense to automatically `abs()` than just to `raise`, because – if you interpret the number as a string – negative numbers are non-reversible. I say this knowing that it violates the reference implementation if you interpret it as a specification, but I don’t think the specification makes much sense.

## “Router not found for request”: Configuring nginx reverse proxy so that backend on port 8080 is served to a path on port 80

I run an app called trilium on a VPS
Although I have it working on port 8080, I would like to set it up so that the port 8080 stuff is only on the backend, and going to mydomain.com/trilium presents the page that is currently shown when I go to mydomain.com:8080.

this is my current nginx configuration file for the site:

``````
upstream websocket  {
server 127.0.0.1:8080; #Trilium
}

server {
listen 443 ssl;
include /etc/nginx/includes/ssl.conf;
server_name mydomain.com;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
# Path to the root of your installation
client_max_body_size 0;

location /trilium {
proxy_pass https://websocket;
proxy_http_version 1.1;
}
}

``````

With this setup, going mydomain.com:8080 loads the app start page. But when I go to mydomain.com/trilium, I get a page that says: “{“message”:”Router not found for request /trilium”}”

On the backend, the Trilium app is throwing these errors:

``````Error: Router not found for request /trilium
status: 404
}
``````

I am guessing this is a problem with my nginx configuration, not the app itself. Any help figuring out what that problem is would be wonderful. I am not familiar enough with js to know which of these errors is the original one.

The lines pointed to by the first message:

``````// catch 404 and forward to error handler
app.use((req, res, next) => {
const err = new Error('Router not found for request ' + req.url);
err.status = 404;
next(err);
});
``````

I was thinking to make a minimal example using a simple “hello world” app in Python, but it seems that nginx needs a wsgi server to communicate with nginx, and therefore I am not sure it would even be an analogous example. Help with figuring out what sort of test app would make a good minimal example would be just as welcome as help with the configuration itself.

## reverse proxy – HAProxy : SSL/TLS termination + ports forwarding

I’m writing here, because I use HAProxy as reverse-proxy with SSL/TLS termination, and I don’t know how to configure it to forward HTTPS requests on specific port to the same on my HTTP backend’s servers.

I’m searching to do something like this :

https://www.example.com:PORT —-> http://www-backend:PORT

PORT is a port in a port range between 8000 and 9000 (These ports are open on backend’s servers )

www-backend corresponds to one of my backend’s servers

I already done this with NGINX by the past, but never with HaProxy.

Could you help me ?

This my current HAProxy’s configuration :

``````global
log /dev/log    local0
log /dev/log    local1 notice
chroot /var/lib/haproxy
stats timeout 5s
user haproxy
group haproxy
daemon

tune.ssl.default-dh-param 4096

defaults
log     global

mode    http
option  httplog
option  dontlognull
option forwardfor
option http-server-close
option http_proxy

timeout connect 5000
timeout client  50000
timeout server  50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

stats enable
stats hide-version
stats refresh 5s
stats uri /hastats

#Define http frontend
frontend www-http
bind *:80
default_backend www-backend

# Test URI to see if its a letsencrypt request
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl

#Define https frontend
frontend www-https
bind *:8000-9000 crt /etc/haproxy/certs/example.com.pem
bind *:443 crt /etc/haproxy/certs/example.com.pem
default_backend www-backend

#Define www-backend
backend www-backend
mode http
option http-server-close

balance roundrobin
redirect scheme https if !{ ssl_fc }
server web1 xxx.xxx.xxx.101:80 check
server web2 xxx.xxx.xxx.102:80 check

#Define letsencrypt backend
backend letsencrypt-backend
server letsencrypt 127.0.0.1:8080
``````

## apache 2.2 – Unifi Reverse Proxy

Is there a way to put the following ports behind a reverse proxy using apache 2?

• UDP 3478 Port used for STUN.
• TCP 8080 Port used for device and controller communication.
• TCP 8443 Port used for controller GUI/API as seen in a web browser
• TCP 8880 Port used for HTTP portal redirection.
• TCP 8843 Port used for HTTPS portal redirection.
• TCP 6789 Port used for UniFi mobile speed test.

I can successfully get 8443 to work fine, but if I try to proxy any of the other ports my devices lose communication through my proxy, I’ve tried using WS and WSS? Any help would be appreciated! I seen that someone was able to do this with NGINX but I’m not familiar with it.

## Nginx reverse proxy with multiple outgoing ip

I’ve newly configurated Nginx reverse proxy.
My config file looks like this:

``````server {
listen 80;
location / {
proxy_pass htpp://instagram.com ;
}

server {
listen 81;
location / {
}

server {
listen 82;
location / {
}
``````

I would like to add multiple IP addresses to make a connection to Instagram Facebook or etc. address. I’m not familiar with Nginx or Squid proxy.
I want to be much more clear to explain it as much as I can.

I have several IP addresses are and I already added those interfaces to my server; also I would like to use different interfaces/IP addresses with each routing.

``````server {
listen 82;
location / {
proxy_pass htpp://youtube.com ; # I would like to use uniqe addreses for each connection
}

``````

Long story short

Request reach to Nginx server
Nginx listens to port 82 and route with new interface/IP addresses

Request reach to Nginx server
Nginx listens to port 81 and route with new interface/IP addresses

I would like to apply this scenario but I’ve don’t have the know-how to do that.
I’m fully opened to any idea or advice.

## python – Reverse for ‘user_edit’ not found. ‘user_edit’ is not a valid view function or pattern name

I’ve been stuck on this for a while, can’t seem to fix the error. I’ve checked the code a hundred times but obviously there is something I’m missing. I have installed my app also.

I created CRUD operations for User with 3 buttons: Details, Edit and Delete. The second 2 works exactly how it should be, but the first one ‘Details’ gives me this error: NoReverseMatch at /users/details/1
Reverse for ‘user_edit’ not found. ‘user_edit’ is not a valid view function or pattern name.
I’m trying to render user_details function, and I can’t find why gives me user_edit error message.

Can anybody see what I’m missing?

views.py

``````def user_details(request, id=None):
context = {}
context('user') = get_object_or_404(User, id=id)
return render(request, 'userdetails.html', context)

context = {}
if request.method == 'POST':
u = user_form = UserForm(request.POST)
context('user_form') = user_form
if user_form.is_valid():
user_form.save()
return HttpResponseRedirect(reverse('feedback:users'))
else:
else:
user_form = UserForm()
context('user_form') = user_form

def user_edit(request, id=None):
context = {}
user = get_object_or_404(User, id=id)
if request.method == 'POST':
user_form = UserForm(request.POST, instance=user)
context('user_form') = user_form
if user_form.is_valid():
user_form.save()
return HttpResponseRedirect(reverse('feedback:users'))
else:
return render(request, 'useredit.html', context)
else:
user_form = UserForm(instance=user)
context('user_form') = user_form
return render(request, 'useredit.html', context)

def user_delete(request, id=None):
context = {}
return render(request, 'userdelete.html', context)
``````

urls.py

``````path('users/', views.users, name="users"),
path('users/details/<int:id>', views.user_details, name="userdetails"),
path('users/edit/<int:id>', views.user_edit, name="useredit"),
path('users/delete/<int:id>', views.user_delete, name="userdelete"),
``````

users.html (basicaly my index page for the CRUD navigation)

``````{% extends 'main.html' %}

{% block content%}

<h1>Users</h1>
<h2>List of {{title}} </h2>
{% if users %}
<ul>
{% for user in users %}
<li>
{{user.first_name}} &nbsp; {{user.last_name}}
<td class="text-center">
<a class="btn btn-primary float-center" href="{% url 'feedback:userdetails' user.id %}">Details</a>
<a class="btn btn-warning float-center" href="{% url 'feedback:useredit' user.id %}">Edit</a>
<a class="btn btn-danger float-center" href="{% url 'feedback:userdelete' user.id %}">Delete</a>
</td>
</li>
{% endfor %}
</ul>
{% else %}
<p>There is no users available</p>
{% endif %}
{% endblock content %}
``````