nie mog

Konfiguracja serwerów, usług, itp.
declerc
Posty: 13
Rejestracja: 20 sierpnia 2009, 10:50

nie mogę się zalogować z innego adresu niż moja siec LAN

Post autor: declerc »

Witam.

Dziś zainstalowałem Debiana i chciałbym mieć do niego dostęp z sieci WAN. Ale niestety nie mam. System podstawowy i środowisko graficzne. Na razie graficznego nie używam bo mam problem z grafiką.

Zainstalowałem

ssh
zmienilem troche /sshd_config

Kod: Zaznacz cały

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
AllowUsers MOJA NAZWA UŻYTKOWNIKA

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes

a w ssh_config

Kod: Zaznacz cały

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
     AddressFamily inet
     ConnectTimeout 300
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22

#   Cipher 3des
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
    SendEnv LANG=C
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    NumberOfPasswordPrompts 3
I nadal nie mogę się zalogować z innego adresu niż moja siec LAN.

Proszę o radę.

Wszystko znajduje się za ruterem ale dodane jako DMZ.
mariaczi
Member
Posty: 1343
Rejestracja: 08 lutego 2008, 12:58
Lokalizacja: localhost@śląskie

Post autor: mariaczi »

Najpierw sprawdź z domyślą konfiguracją i DMZ. Jak z DMZ nie zadziała to wyłącz DMZ a przekieruj port na ruterze na maszynę z Debianem.
Awatar użytkownika
timor
Beginner
Posty: 111
Rejestracja: 18 sierpnia 2009, 23:40

Post autor: timor »

Bez przekierowania portów się nie obejdzie.
declerc
Posty: 13
Rejestracja: 20 sierpnia 2009, 10:50

Post autor: declerc »

Przeinstalowałem Debiana bez środowiska graficznego sam podstawowy system + ssh (podstawowa konfiguracja i nadal spoza LAN-u się nie łączę) po przekierowaniu portów też (a np. torrent w Windowsie po przekierowaniu pokazuje wszystko poprawnie).
mariaczi
Member
Posty: 1343
Rejestracja: 08 lutego 2008, 12:58
Lokalizacja: localhost@śląskie

Post autor: mariaczi »

Pokaż wynik polecenia

Kod: Zaznacz cały

netstat -ln | grep :22
declerc
Posty: 13
Rejestracja: 20 sierpnia 2009, 10:50

Post autor: declerc »

netstat daje to:

Kod: Zaznacz cały

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
nmap tez pokazuje port 22 otwarty.

Kod: Zaznacz cały

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
bzyk
Beginner
Posty: 181
Rejestracja: 08 stycznia 2008, 22:00
Lokalizacja: Pszczyna

Post autor: bzyk »

Według mnie źle przekierowałeś porty. Sprawdź uruchamiając tcpdumpa na maszynie z Debianem, po czym spróbuj się zalogować z zewnątrz.

Kod: Zaznacz cały

tcpdump -i eth0 
(zakładam, że masz eth0, jeśli nie, to wpisz poprawny interface) -n port 22.
Awatar użytkownika
timor
Beginner
Posty: 111
Rejestracja: 18 sierpnia 2009, 23:40

Post autor: timor »

Gdybyś dobrze to przekierował to musiałoby działać. Możesz dokładnie opisać jak to zrobiłeś (z jakiego adresu na jaki, jakie porty, etc)?
declerc
Posty: 13
Rejestracja: 20 sierpnia 2009, 10:50

Post autor: declerc »

timor pisze:Gdybyś dobrze to przekierował to musiałoby działać. Możesz dokładnie opisać jak to zrobiłeś (z jakiego adresu na jaki, jakie porty, etc)?
Próbowałem dwóch rzeczy:
  • przekierowanie (ang. forwarding) portu -- wszystko co przyjdzie na 22 port ma iść na adres 192.168.1.2,
  • DMZ -- dodałem komputer o adresie 192.168.1.2 jako strefa DMZ (co odblokowuje wszystkie porty).
Awatar użytkownika
timor
Beginner
Posty: 111
Rejestracja: 18 sierpnia 2009, 23:40

Post autor: timor »

No i źle.

Wszystko co przyjdzie na Twój ZEWNĘTRZNY ADRES na port 22, przekieruje na 192.168.1.2 na port 22. Przecież chcesz żeby z zewnątrz przychodziło - prawda? ;)
ODPOWIEDZ