Konfiguracja zawarta w pliku ssh_conf nie dzia

Konfiguracja serwerów, usług, itp.
debianowiec
Posty: 15
Rejestracja: 23 stycznia 2011, 20:50

Konfiguracja zawarta w pliku ssh_conf nie działa na Debianie

Post autor: debianowiec »

Witam.
Mam skonfigurowany plik ssh_config według tej strony: http://rafal.drezek.info/2008/12/12/zda ... z-openssh/
Mój plik wygląda teraz tak:

Kod: Zaznacz cały

# RD”, a dodatkowo zmienione linie zaznaczone są pogrubieniem.

#    $OpenBSD: sshd_config,v 1.72 2005/07/25 11:59:40 markus Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# 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 change a
# default value.

Port 22 

Protocol 2 
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

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

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no 
StrictModes yes 
MaxAuthTries 6 

RSAAuthentication no
PubkeyAuthentication yes 
AuthorizedKeysFile    .ssh/authorized_keys 

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

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no 

# 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 support for the deprecated ‘gssapi’ authentication
# mechanism to OpenSSH 3.8p1. The newer ‘gssapi-with-mic’ mechanism is included
# in this release. The use of ‘gssapi’ is deprecated due to the presence of
# potential man-in-the-middle attacks, which ‘gssapi-with-mic’ is not susceptible to.
#GSSAPIEnableMITMAttack no

# 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 mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# “PermitRootLogin without-password”. If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10 # RD
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem    sftp    /usr/lib64/ssh/sftp-server

# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL

Przy próbie restartowania ssh poleceniem:

Kod: Zaznacz cały

debian:/home/debian# /etc/init.d/ssh restart
/etc/ssh/ssh_config: line 40: Bad configuration option: PermitRootLogin
/etc/ssh/ssh_config: line 41: Bad configuration option: StrictModes
/etc/ssh/ssh_config: line 42: Bad configuration option: MaxAuthTries
/etc/ssh/ssh_config: line 46: Bad configuration option: AuthorizedKeysFile
/etc/ssh/ssh_config: line 54: Bad configuration option: IgnoreUserKnownHosts
/etc/ssh/ssh_config: line 60: Bad configuration option: PermitEmptyPasswords
/etc/ssh/ssh_config: line 89: Bad configuration option: UsePAM
/etc/ssh/ssh_config: line 93: Bad configuration option: X11Forwarding
/etc/ssh/ssh_config: line 94: Bad configuration option: X11DisplayOffset
/etc/ssh/ssh_config: line 113: Bad configuration option: Subsystem
/etc/ssh/ssh_config: line 116: Bad configuration option: AcceptEnv
/etc/ssh/ssh_config: line 117: Bad configuration option: AcceptEnv
/etc/ssh/ssh_config: line 118: Bad configuration option: AcceptEnv
/etc/ssh/ssh_config: terminating, 13 bad configuration options
debian:/home/debian#
Co robię źle, niby jest napisane, że mam opcje źle skonfigurowane, ale na Fedorze miałem w ten sposób skonfigurowane i żadnych problemów nie miałem, konfiguracja była w porządku. Co Wy sądzicie o tym?
Awatar użytkownika
DaVidoSS
Junior Member
Posty: 875
Rejestracja: 06 marca 2010, 11:26
Lokalizacja: ~/

Post autor: DaVidoSS »

Najpierw uświadom sobie, że do konfiguracji serwera służy plik /etc/ssh/sshd_conf, a nie jak Ty tam próbujesz ssh.conf. Jeśli jednak edytujesz prawidłowy plik to mogę Ci podać prawidłowa konfigurację:

Kod: Zaznacz cały

# Package generated configuration file
# See the sshd(8) manpage for details

# 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

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
debianowiec
Posty: 15
Rejestracja: 23 stycznia 2011, 20:50

Post autor: debianowiec »

Konfigurację mam w pliku /etc/ssh/ssh.config a nie tą co Ty wskazałeś. Jeśli chodzi o Twoją poprawną konfigurację wkleiłem ją w miejsce tamtej i otrzymałem takie komunikaty po próbie restartu usługi ssh:

Kod: Zaznacz cały

debian:/home/debian# /etc/init.d/ssh restart
/etc/ssh/ssh_config: line 11: Bad configuration option: HostKey
/etc/ssh/ssh_config: line 12: Bad configuration option: HostKey
/etc/ssh/ssh_config: line 14: Bad configuration option: UsePrivilegeSeparation
/etc/ssh/ssh_config: line 17: Bad configuration option: KeyRegenerationInterval
/etc/ssh/ssh_config: line 18: Bad configuration option: ServerKeyBits
/etc/ssh/ssh_config: line 21: Bad configuration option: SyslogFacility
/etc/ssh/ssh_config: line 25: Bad configuration option: LoginGraceTime
/etc/ssh/ssh_config: line 26: Bad configuration option: PermitRootLogin
/etc/ssh/ssh_config: line 27: Bad configuration option: StrictModes
/etc/ssh/ssh_config: line 34: Bad configuration option: IgnoreRhosts
/etc/ssh/ssh_config: line 43: Bad configuration option: PermitEmptyPasswords
/etc/ssh/ssh_config: line 62: Bad configuration option: X11Forwarding
/etc/ssh/ssh_config: line 63: Bad configuration option: X11DisplayOffset
/etc/ssh/ssh_config: line 64: Bad configuration option: PrintMotd
/etc/ssh/ssh_config: line 65: Bad configuration option: PrintLastLog
/etc/ssh/ssh_config: line 73: Bad configuration option: AcceptEnv
/etc/ssh/ssh_config: line 75: Bad configuration option: Subsystem
/etc/ssh/ssh_config: line 77: Bad configuration option: UsePAM
/etc/ssh/ssh_config: terminating, 18 bad configuration options
debian:/home/debian# 
Sam nie wiem co o tym myśleć, w Fedorze na tej konfiguracji bez problemu wszystko mi działało, a tu nie.
Awatar użytkownika
DaVidoSS
Junior Member
Posty: 875
Rejestracja: 06 marca 2010, 11:26
Lokalizacja: ~/

Post autor: DaVidoSS »

Jak już wspomniałem:

Kod: Zaznacz cały

/etc/ssh/ssh.config
nie jest plikiem konfiguracyjnym serwera ssh w Debianie i takowy w ogóle nie występuje. Weź to pod uwagę a będzie działać jak należy.
Plikiem konfiguracyjnym serwera ssh jest plik

Kod: Zaznacz cały

/etc/ssh/sshd_config 
Plikiem konfiguracyjnym klienta ssh jest plik

Kod: Zaznacz cały

/etc/ssh/ssh_config 
o zawartości:

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 any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
Plik konfiguracyjny serwera ssh jest generowany automatycznie podczas instalacji serwera ssh (openssh-server) dzięki debconf, a raczej jego modułowi - confmodule i jest domyślnie gotowy do pracy.
Edytuje się go celem dostrojenia do własnych zapotrzebowań.
Podobnie plik konfiguracyjny klienta ssh jest dostarczany wraz z zainstalowanym pakietem openssh-client. Również jest gotowy do pracy bez jakiejkolwiek edycji.
fnmirk
Senior Member
Posty: 8321
Rejestracja: 03 grudnia 2007, 06:37

Post autor: fnmirk »

&quot pisze:Konfiguracja pliku ssh_conf
&quot pisze:Witam. Mam skonfigurowany plik ssh_config według tej strony: http://rafal.drezek.info/2008/12/12/zda ... z-openssh/
...
Awatar użytkownika
DaVidoSS
Junior Member
Posty: 875
Rejestracja: 06 marca 2010, 11:26
Lokalizacja: ~/

Post autor: DaVidoSS »

Wybaczcie ale nie rozumiem.
Jeśli kolega niby edytuje plik konfiguracyjny klienta ssh :
debianowiec pisze:Konfigurację mam w pliku /etc/ssh/ssh.config a nie tą co Ty wskazałeś. Jeśli chodzi o Twoją poprawną konfigurację wkleiłem ją w miejsce tamtej i otrzymałem takie komunikaty po próbie restartu usługi ssh:

Kod: Zaznacz cały

debian:/home/debian# /etc/init.d/ssh restart
/etc/ssh/ssh_config: line 11: Bad configuration option: HostKey
/etc/ssh/ssh_config: line 12: Bad configuration option: HostKey
/etc/ssh/ssh_config: line 14: Bad configuration option: UsePrivilegeSeparation
/etc/ssh/ssh_config: line 17: Bad configuration option: KeyRegenerationInterval
/etc/ssh/ssh_config: line 18: Bad configuration option: ServerKeyBits
/etc/ssh/ssh_config: line 21: Bad configuration option: SyslogFacility
/etc/ssh/ssh_config: line 25: Bad configuration option: LoginGraceTime
/etc/ssh/ssh_config: line 26: Bad configuration option: PermitRootLogin
/etc/ssh/ssh_config: line 27: Bad configuration option: StrictModes
/etc/ssh/ssh_config: line 34: Bad configuration option: IgnoreRhosts
/etc/ssh/ssh_config: line 43: Bad configuration option: PermitEmptyPasswords
/etc/ssh/ssh_config: line 62: Bad configuration option: X11Forwarding
/etc/ssh/ssh_config: line 63: Bad configuration option: X11DisplayOffset
/etc/ssh/ssh_config: line 64: Bad configuration option: PrintMotd
/etc/ssh/ssh_config: line 65: Bad configuration option: PrintLastLog
/etc/ssh/ssh_config: line 73: Bad configuration option: AcceptEnv
/etc/ssh/ssh_config: line 75: Bad configuration option: Subsystem
/etc/ssh/ssh_config: line 77: Bad configuration option: UsePAM
/etc/ssh/ssh_config: terminating, 18 bad configuration options
debian:/home/debian# 
Sam nie wiem co o tym myśleć, w Fedorze na tej konfiguracji bez problemu wszystko mi działało, a tu nie.


to po co restartuje serwer ssh?
debianowiec
Posty: 15
Rejestracja: 23 stycznia 2011, 20:50

Post autor: debianowiec »

DaVidoSS pisze:Jak już wspomniałem:

Kod: Zaznacz cały

/etc/ssh/ssh.config
nie jest plikiem konfiguracyjnym serwera ssh w Debianie i takowy w ogóle nie występuje. Weź to pod uwagę a będzie działać jak należy.
Plikiem konfiguracyjnym serwera ssh jest plik

Kod: Zaznacz cały

/etc/ssh/sshd_config 
Plikiem konfiguracyjnym klienta ssh jest plik

Kod: Zaznacz cały

/etc/ssh/ssh_config 
Rozumiem, tylko ja nie mam pliku serwera sshd.config tylko ssh.config

Kod: Zaznacz cały

debian@debian:~$ su
Password: 
debian:/home/debian# cd /etc/ssh
debian:/etc/ssh# dir
moduli    ssh_config  ssh_config~  ssh_config.save
Nie instalowałem ssh, bo domyślnie mam w systemie tą usługę po instalacji Debiana.
Awatar użytkownika
lolleq
Beginner
Posty: 193
Rejestracja: 26 sierpnia 2006, 10:45
Lokalizacja: Zgorzelec -> Szczecin

Post autor: lolleq »

A masz /usr/share/doc/openssh-client/examples/sshd_config? Spróbuj go skopiować do /etc/ssh i w nim ustawić potrzebne parametry, domyślnie są zakomentowane zdaje się...
debianowiec
Posty: 15
Rejestracja: 23 stycznia 2011, 20:50

Post autor: debianowiec »

lolleq pisze:A masz /usr/share/doc/openssh-client/examples/sshd_config? Spróbuj go skopiować do /etc/ssh i w nim ustawić potrzebne parametry, domyślnie są zakomentowane zdaje się...
Nie mam.

Kod: Zaznacz cały

debian@debian:/usr/share/doc/openssh-client$ dir
changelog.Debian.gz  faq.html         README             README.dns
changelog.gz         NEWS.Debian.gz  README.compromised-keys.gz  README.tun.gz
copyright         OVERVIEW.gz     README.Debian.gz
debian@debian:/usr/share/doc/openssh-client$ su
Password: 
debian:/usr/share/doc/openssh-client# aptitude install open-ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Reading task descriptions... Done  
Couldn't find any package whose name or description matched "open-ssh"
Couldn't find any package whose name or description matched "open-ssh"
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Reading task descriptions... Done  

debian:/usr/share/doc/openssh-client# aptitude install ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Reading task descriptions... Done  
No candidate version found for ssh
No candidate version found for ssh
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Writing extended state information... Done
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Reading task descriptions... Done  

debian:/usr/share/doc/openssh-client# 
W ogóle nigdzie w systemie nie mam pliku sshd.config, dziwne żeby po instalacji systemu nie było tego pliku? A jakbyście podali mi pełną konfigurację sshd.config i utworzył sobie sam taki plik w /etc/ssh?
Awatar użytkownika
lolleq
Beginner
Posty: 193
Rejestracja: 26 sierpnia 2006, 10:45
Lokalizacja: Zgorzelec -> Szczecin

Post autor: lolleq »

Weź sobie zainstaluj od nowa bo coś masz napaprane porządnie... oczywiście zadbaj o dostęp do serwera na czas reinstalacji (fizyczny, telnet). Może na początek dpkg-reconfigure, jeśli sytuacja się nie zmieni to aptitude purge a potem install.
ODPOWIEDZ