You are not logged in.
Pages: 1
I've configured ssh and can ascess to it from lan, but can't do the same thing from wan. I have my port opened, and theoretically it should work well.
Also I can ascess my server from lan using adress 192.168.1.2:22 and it works well. I've checked if 60000 port is opened and sites says me yes. So, seems like the problem is in my local machine.
(router setup screen: https://ibb.co/59Mhky8)
Here is sshd config:
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
AllowUsers root
# Change to no to disable s/key passwords
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
#AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs serverThe question is: what am I doing wrong?
Last edited by opadfnezig (2021-02-18 16:24:58)
Offline
PasswordAuthentication yes
…
AllowUsers rootSTOP ALL EFFORTS and secure your ssh server first.
Read up https://wiki.archlinux.org/index.php/Security#SSH and sublinks.
Remove the oversized image and come back when done.
Offline
And when you do come back, tell us what you're actually seeing.
Online
is iptables up?
Offline
Remove the oversized image and come back when done.
Removed root from allow users, also set PermitRootLogin to no. You also quoted PasswordAuthentication yes, should I also disable it?
Also removed image).
I thought I will care about security when everything would work, as it's just home server, but ok.
Offline
You also quoted PasswordAuthentication yes, should I also disable it?
Yes.
as it's just home server
When you open it to the WAN, it's everyones server…
Really read up the link.
Coming back to Scimmia: what does actually happen when you try to connect to it?
Offline
You also quoted PasswordAuthentication yes, should I also disable it?
Yes.
as it's just home server
When you open it to the WAN, it's everyones server…
Really read up the link.Coming back to Scimmia: what does actually happen when you try to connect to it?
Yes, somehow I forgot to say the main thing. I'm using putty to connect and it says me Network error: connection refused.
BTW just noticed that I forgot to allow my new user to sudo, so, I need some time to access the server manually XD.
Last edited by opadfnezig (2021-02-18 15:54:37)
Offline
Can you try to access the server w/ openssh (windows 10 does actually provide that)?
Also ideally run
nmap -sV <wan_ip>Offline
I just checked. There were 298 attempts to log in to my "home server" yesterday alone. 2254 since I booted on the 15th. My router blocks all connections from several counties known for bad behavior before they can even reach my computer. This results in the numbers I posted being mostly Europe and the US with the vast majority from other geolocations being blocked before reaching my system.
In other words, set sshd up to require either public keys, multifactor authentication, or both.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Where does port 60000 come into this?
Are you actually attempting to connect from outside your network or are you just trying to use the external IP from inside your LAN?
Offline
- You cannot connect to yourself externally from/to the same IP. Some routers do NAT loopback but it can be very error prone.
- The connection gets refused that means it gets rejected not dropped. Someone picks up the packet (maybe bad port forward). Try tcpdump/wireshark on your server to see if the packets arrive at all. Even better check traffic on your router if possible.
Last edited by Maniaxx (2021-02-18 16:18:25)
sys2064
Offline
He had a screenshot from his router, showing port 60000 being mapped to 22 on one of the local IPs.
(Sorry, I should have told him to to replace the image w/ a link… rather than to remove it)
Offline
...My router blocks all connections from several counties
Not to get this topic off-topic, but is that built into your router itself? I've been trying to find a decent app/service that provides or calculates nftables-compatible IP blocking ranges based on geography but they either produce massive lists, are outdated or too restrictive or they charge too much. If my router could do it by itself, that's a much better solution.
Last edited by twelveeighty (2021-02-18 16:27:20)
Offline
Where does port 60000 come into this?
Are you actually attempting to connect from outside your network or are you just trying to use the external IP from inside your LAN?
Yes, from inside. Didn't know this might be a problem. I'll try to do it from external network, just give me 10 mins to put the server back(I loosed ssh control, so only physical acces left).
Offline
Yes, from inside. Didn't know this might be a problem.
It's a problem if your router doesn't support NAT loopback. The vast majority of consumer routers don't have support.
Offline
Not to get this topic off-topic, but is that built into your router itself? I've been trying to find a decent app/service that provides or calculates nftables-compatible IP blocking ranges based on geography but they either produce massive lists, are outdated or too restrictive or they charge too much. If my router could do it by itself, that's a much better solution.
Yes. It is an Asus router running Merlin Software with the Skynet plugin.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
So, the problem was that I've tried to connect from my own network. I used mobile Internet to connect and it worked.
Thank you very much for the answers, I'm not a big fan of forums, but you are just great(best community I've ever seen).
Also thanks for preventing me from using password auth. I'll read about how to protect my network, and if I have any problems,I will let you know.
Offline
banIP (OpenWrt)
https://forum.openwrt.org/t/banip-support-thread/16985
Indeed not the worst idea to use something like this for publicly accessible services like SSHd.
sys2064
Offline
Pages: 1