Hacking and more...
HaCkinG CulT
Lista Forumurilor Pe Tematici
Hacking and more... | Reguli | Inregistrare | Login

POZE HACKING AND MORE...

Nu sunteti logat.
Nou pe simpatie:
beatrice17 pe Simpatie
Femeie
24 ani
Bucuresti
cauta Barbat
24 - 80 ani
Hacking and more... / n00bs / Setting Up SSH Moderat de Shocker
Autor
Mesaj Pagini: 1
epic
User

Inregistrat: acum 17 ani
Postari: 1896


Code:

why ssh: why do we need encryption. 
where: where to get ssh. 
telnet/rsh/rlogin: how ssh replaces these tools. 
ftp: using ftp with ssh or scp instead of ftp. 
fine tuning: getting the best performance out of ssh. 
X11: tunnelling X11 traffic through the secure link. 
keys: keys and key-servers. 
drawbacks: when using ssh is not secure. 
In an emergency:

If you must use a computer without ssh, and you do not have authority to install software on it, then you have these choices: 
Use this Java applet inside Netscape or another Web browser with Java enabled (which is not recommended in general!) and up to date. 
If the applet does not work properly, and you must use the public Internet to connect, then use telnet to connect to athena.dialup.mit.edu and login to your Athena account, followed by ssh to your computer at LNS. The campus network at MIT almost certainly has unauthorized "sniffers," and it is "dirtier" than most public networks. 
Why SSH?
Why do we need encryption?

Almost all computers at LNS are connected to the Internet, all the time. Besides providing ways for us to communicate and collaborate with others all over the world, the Internet also provides a path for intruders from all over the world to try to gain access to our computers for their own purposes. 

Typically an intruder will try to gain access either by exploiting a software bug in order to login without a password, or by gaining access to another related computer and running a "sniffer" program to spy on passwords as they travel over the net. The Computer Services staff try to "patch" over software bugs as soon as they become known, and to detect and stop sniffers before they gather any passwords. But it is everyone's job to keep their passwords secret, and to avoid sending them over the net in plain view of sniffers. Instead, you should use encryption to hide them. 

No matter how they gain access, a successful intruder can cause a lot of damage, by removing important files or by flooding the net with messages in an attempt to disrupt rivals. In the last years, other research labs have suffered large amounts of damage from intruders. At LNS, we see probes from would-be intruders every day. We have to assume that they will try to invade us if we are not careful. 

Even if you think that your computer account is not very important to you, it can still provide an opportunity for intruders to break in and hurt other users. So we should all try to be "good neighbors." 

Many computers at MIT use Kerberos for encryption. For example, if you read your e-mail on Athena, or if you use MIT administrative systems through the net, then you do not transmit any clear text passwords over the net. However none of the LNS computers do Kerberos encryption and thus you should never use telnet to connect to another machine at LNS or outside LNS. Instead please restrict yourself to ssh. 

Some unfriendly person might be interested in your network traffic and start logging all your sessions. Such a session log might look like: 
    9600,9600.#.host.mit.edu:0.0.DISPLAY.host.mit.edu:0.0
    USER.north.....XTERM........Secret
    mail  
    Dear Fawn,
    
    I have some important documents that
    must leave the office secretly.  Could
    you stuff them into your boots?
    
           Ollie
    .

Most unfriendly persons (unless they are special investigators) are not particularly interested in your e-mail conversation but will find your username and password much more noteworthy. Why? Because this means that they get access to another host on which they might obtain root access and install a sniffer which can log all the sessions on your local network as well. 

Most crackers nowadays use this strategy to break into a single host, then set up a sniffer to obtain usernames and passwords for other hosts, so that they can spread over various institutes within a few days. It's the responsibility of every user to avoid unencrypted traffic -- such as from telnet, rsh, rcp, rlogin, ftp, pop3, imap -- to avoid these kinds of network intrusions. 

Here is an example of a sniffed ftp session - username and password are modified. 
    USER ken
    PASS Investig
    CWD logs
    PORT 154,201,54,21,44,5
    NLST telnet.logs
    PORT 154,201,54,21,44,6
    RETR telnet.logs
    QUIT
Where?
Where to get ssh.

Unix users can get the ssh source code from the SSH home page or the Open SSH page. Most likely you won't have to compile the source code yourself: At LNS your Linux workstation will have ssh installed automatically. All Computer Services servers have ssh installed. 

We recommend that Windows users download SecureCRT from the MIT SecureCRT Webpage. SecureCRT has superior VT emulation, and it is available free to MIT users because MIT has a site license. Information about the license and how to install it can be found in the readme file on the MIT Webpage. If you can't download SecureCRT, for instance if you are at home and you are using some ISP other than the MIT Tether service, purchase SecureCRT from Van Dyke Technologies, Inc. Or try the freeware ssh client: SSH Sources+Binaries by Robert O'Callahan ( .edu) as an extension to the free+excellent telnet program Teraterm Pro. 

For Macintosh users, we recommend NiftyTelnet (for ssh1) or MacSSH (for ssh2). Another choice is to buy an SSH client from F-Secure. The product is reasonably priced and works reliably. Some of the vt100 features are not correctly implemented, however. 
telnet/rsh/rlogin
How ssh replaces these tools.

SSH works very much like telnet or rsh/rlogin. You connect to another host typing 
    ssh hostname.domain

or if you use another username on the remote host you use the -l option to specify this username: 
    ssh hostname.domain -l otherusername

The first time you connect to this host, ssh recognizes that it has never learnt the public key of this host so far, and it warns you that it does not yet know this host: 
    Host key not found from the list of known hosts.
    Are you sure you want to continue connecting (yes/no)? 

Most people answer this question either with 'no', 'n' or 'y'. In all these cases the connection will be aborted. SSH expects you to answer this question with 'yes' (a three letter word). 

If you are really careful you could ask the system administrator of the remote host to send you the host public key in a PGP-signed message. You could then add this key to your file ~/ssh/known_hosts. You don't have to be THAT careful ... normally. 

If you are used to the password-less rlogin, ssh offers a similar mechanism. You should edit the file ~/.shosts and add the line 
    remotehost remoteuser
to it - pretty much the same way as you would do it in the case of the ~/.rhosts file. (Before you do so, please read the paragraph below about keys and key-servers. You might not need ~/.shosts at all.) 

However you should know that ssh is a little more picky about these kinds of logins. It checks carefully that, if you connect from localhost, that this really is localhost and not happy.cracker.org using a spoofed connection. The ~/.ssh/known_hosts file on the remote host therefore has to contain the public host key of localhost. The easiest way to do that is to connect (still with typing your passwords) from your localhost to remotehost and back again - always using the so called fully qualified hostname, i.e. the host name including the domain name: 
      $ ssh paul.mit.edu
      password: [type your password here]
    Welcome to paul.mit.edu
    
      $ echo 'peter.mit.edu bill' >> ~/.shosts
      $ chmod 600 ~/.shosts
      $ ssh peter.mit.edu
      password: [type your password here]
    Welcome to peter.mit.edu
    
      $ ssh paul
    Welcome to paul.mit.edu

The second connection from peter to paul was indeed possible without typing the password. Please also note that ~/.shosts should not be writable by any other user (chmod 600 ...). 

In case there is anything not working, you should try to use the -v option while connecting. SSH will then explain in detail why a password-less connection fails. 

Rsh also has the option to execute remote commands. So has SSH. If you've setup your ~/.shosts file as described above you can simply type 
    ssh remotehost remotecommand

the same way you would do it with rsh. The only difference is that in case you have not setup your ~/.shosts file, ssh will even prompt you for your password in the case of a remote command execution. This is better than what rsh can do. 
FTP

In general ssh does not support ftp. You can however use ssh's port-forwarding to enable ftp connections to remote hosts. This method involves a little more effort than the usual ftp connection and you might want to consider to avoid ftp and use scp (see below) instead. 

You will first have to establish a port forwarding ssh connection to the host you want to connect to via ftp. This requires of course that this host runs sshd and you have an account on it. For anonymous ftp connections this is usually not the case but anynomous ftp connections to remote hosts usually don't impose a security risk. You establish the portforwarding connection using 
    peter $ ssh paul -L 1234:paul:21
    Welcome to paul.
       
    paul $ # I am just waiting here and keeping the port forwarding connection up

Here 1234 is an arbitrary local port to which you later connect and 21 is the ftp port number of remotehost. Then you can start an ftp session in another window: 
    peter $ ftp localhost 1234
    Connected to localhost.
    220 paul FTP server (Some UNIX Version x.y) ready.
    Name (localhost:bill): bill
    331 Password required for bill.
    Password: [type bill's password on paul here]
    230 User bill logged in.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> passive
    Passive mode on.
    ftp> 

Don't get confused by all these different hostnames. The user bill on peter connects to the ftp server on localhost's (this is peter's) port 1234. Due to the port forwarding (-L 1234:paul:21) above this port is forwarded via the encrypted ssh channel to paul's port 21 - the ftp control port. This is why the local ftp client answeres Connected to localhost whereas the remote ftp server says 220 paul FTP server (Some UNIX Version x.y) ready. You will then be prompted for a username and password. These should correspond to your account on paul, the remote host. Before doing anything else you will have to enable passive mode in the ftp client using the passive command. This will make sure that the connections from the ftp-data port (20) will reach your ftp client. 
Using scp instead of ftp.

Copying files with ssh is done using the program SCP. It works similar to rcp: 
    scp localfile remotehost:/remotedir
    scp localfile remotehost:
    scp -r localdir remotehost:/remotedir
    scp remotehost:remotefile localfile
    ...

If you have setup your ~/.shosts file you will not be asked for a password during these operations. More details can be found in the man page for scp. 
Fine tuning
Getting the best performance out of ssh.

Encryption does require CPU time to encrypt and decrypt the data. Therefore ssh connections and scp file-transfers are usually a little slower than unencrypted connections. SSH offers different kinds of encryption, so called Ciphers which have different levels of security and CPU requirements. The ssh README.CIPHERS file compares these different options: 
    BLOWFISH
    ========
    
    Bruce Schneier's block cipher that was designed to be a fast and free
    alternative to existing encryption algorithms. It is unpatented and
    license-free. SSH version uses a 128-bit key for Blowfish (the
    algorithm allows anything from 32 to 448 bits).
    
    Performance on a pentium machine is about 88% of "none" encryption.
    
    You can disable it by giving the --without-blowfish option to
    configure. It is ON by default.
    
    [...]
    
    IDEA
    ====
    
    A 128-bit block cipher. Faster than 3DES, but slower than Arcfour and
    Blowfish. The IDEA algorithm is patented in many countries, and the
    patent holder disallows commercial use (their definition of
    commercial use include connections from one corporation to another
    corporation).
    
    Performance on a pentium machine is about 64% of "none" encryption.
    
    You can disable IDEA by giving the --without-idea option to configure. 
    It is ON by default.
    
    [...]
    
    3DES
    ====
    
    Three-key triple-DES (effective key length of about 112 bits) in inner
    CBC-mode. This is the default fall back cipher that is used if the
    client asks for a cipher that isn't supported by the server.
    
    RSA private key files are encrypted by 3DES by default. (Some older
    versions encrypted private key files with IDEA, and such key files may
    still be around.)
    
    Performance on a pentium machine is about 45% of "none" encryption.
    
    You cannot disable it, because it is the mandatory cipher.
    [...]

SSH and SCP accept commandline options to specify the cipher preferred in the connection. The default cipher is IDEA and therefore you might consider to use 'blowfish' as your default as it is much faster. SSH has a user configuration file in ~/.ssh/config. The format of this file is described in the ssh man page. 

To enable 'blowfish' for all your connections your ~/.ssh/config file would read like this: 
    Host *
      Cipher blowfish

SSH also allows to compress the network traffic. This is a very interesting option if you either use ssh over a modem line or to a (very) remote host. However compressing takes again a few more CPU cycles so you should balance the network speed against your cpu speed. You might change your ~/.ssh/config to 
    Host *.mit.edu
      Cipher blowfish
    
    Host *
      Compression yes
      Cipher blowfish

Some other interesting options for your config file would be: 
ForwardAgent yes
to pass authorization information over the encrypted link (see below). 
ForwardX11 yes
to forward X11 traffic over the encrypted link (see below). 
RhostsRSAAuthentication yes
To enable the use of ~/.shosts files. 
RSAAuthentication yes To enable the use of authorizing rsa key pairs (see below). 
FallBackToRsh no To disable an accidental use of rsh if the user requested a ssh connection. Ssh falls back to rsh by default if the remote host does not understand the ssh protocol. 
X11
Tunneling X11 data through the secure link.

Starting a graphic session on a remote host usually involves setting the DISPLAY environment variable on the remote host to myhost:0.0 and allowing the remote host in some way to access the display on myhost. 

(1) This can be done using the command (strongly deprecated) 
    xhost + 

which unfortunately still many people do. This command enables access for every computer on the Internet. Access means, for example: 
Anyone can download your screen content and see what you are doing. 
Anyone can get every single keystroke you do and filter out sequences like telnet remotehost and the next two lines. 

(2) A little better but by far not optimal is to select a specific host to which one grants access using 
    xhost +remotehost

This still means one has to trust every (potential) user on remotehost that (s)he will not start keyboard sniffers or download your screen image. 

The MIT magic cookie is a much better solution - however difficult to use for most users. You find information on this method in the man page to xauth. 
    xauth extract - $DISPLAY | 
        ssh remotehost xauth merge -

It grants permission based on a cryptographic cookie - the X11 traffic itself is still unencrypted and can be sniffed by an unfriendly person. 

(3) The final solution to these problem however is ssh. If you enable X11 forwarding and you ssh to a remote host, ssh will set the DISPLAY environment variable to something like DISPLAY=remotehost:11.0. All X11 applications which you start on remotehost will connect to the X11 port remotehost:11.0. SSH will then forward all X11 traffic to your local display using the encrypted link between the hosts. 
      $ ssh paul
    Welcome to paul.
    
      $ echo $DISPLAY
    paul:12.0
      $ xlsclients
    peter  /usr/bin/X11/xterm 
      $

The only possible form of attack would be that someone with access to your remote account could gain access to your display using the encrypted link. This is however a much smaller threat than in the xhost/xauth case. 
Keys
Keys and key-servers or how to type better passwords less frequently.

ssh not only allows password based authentication but also allows authentication via RSA key pairs. 

The advantage of this authentication technique is 
you can protect your logins with passwords longer than 8 characters. 
you can setup your system in a way that you have to authenticate only once per session and then have password-less access to all systems you have enabled for this service. 

To setup ssh this way you will first have to generate a RSA key pair. 
    ssh-keygen

does this for you. ssh-keygen will prompt you for a password which will protect your key-pair against misuse by others who might be able to steal the private part of the key-pair from your system. You should enter a (long) password there. Leaving it empty is strongly discouraged. 

You will then have two new files in ~/.ssh/ 
identity - your secret private key, 
identity.pub - your public key. 

The contents of identity.pub (it is one LONG line) should be appended (as ONE long line) to the file ~/.ssh/authorized_keys on the remote host. 

If you now connect to such a remote host, ssh will first prompt you for the pass-phrase of your RSA key. If this one is correct you can login without typing your normal password. 
      $ ssh paul
    Enter pass-phrase for RSA key ' ': [Type your pass-phrase here]
    Welcome to paul

      $

So far this does not help us to type the pass phrases less frequently. Another ssh program named ssh-agent helps us to store and forward authentication information to hosts we want to connect to. 

You should start ssh-agent when you login to your workstation, preferably in your ~/.xsession file. Put the two lines: 
    eval `ssh-agent`
    ssh-add 
into it before you start up the window manager, and the line: 
    eval `ssh-agent -k`
at the end. After your normal login you will be then asked for you ssh pass-phrase. Some people complain about this procedure that they have to enter their password twice. But - no - the second time is NOT your password but your much-longer-than-8-character pass-phrase. And yes - so far there is no xdm support for pass-phrases. So you have to type a password AND a pass-phrase. 

The good thing about this is that ssh-agent will store your identity and pass it along to every host you connect to. So you'll have to type your long pass-phrase only once per session. 

If you've setup your ssh enviroment this way using RSA key-pairs this also means that your ~/.shosts file is now obsolete. In fact as pass-phrase protected RSA keys provide higher security than the account/host based form of ~/.shosts you should probably deinstall your ~/.shosts files again. Otherwise an attacker who breaks into one of your accounts has automaticly access to all of your machines. 
Drawbacks
When using ssh is not secure.

SSH provides you with all the tools that make your Internet life a lot safer and even gives you some extra comfort with it. The downside is that you are still expected to protect yourself and understand that ssh does not protect you from making mistakes when protecting your data and account information. 
The Mixed Environment

Here is a nice session captured by a cracker on one of MIT's systems that shows the problem is great detail: 
    nyc-ny.ix.netcom.com => SOMEHOST.MIT.EDU [23]
    #'vt100!bill
    Secret
    ssh someotherhost -l bill
    @Secret
    inc
    mailfrom
    cd Mail
    ls
    exit
    exit

hosts, usernames and passwords are modified. The user came in from his Internet Service Provider to the machine somehost via telnet and started a ssh session to his host someotherhost. The intruder captured the insecure telnet session and gets all ssh passwords in clear text. If the first connection had been a ssh connection, there would have been no chance to capture the passwords. 

As long as users use both ssh and unencrypted logins there is no password security. The cracker might capture the password on your only unencrypted connection (this might just be a ftp connect to your system) and then he can happily use ssh, your username and password. 

Please note that it is however ok to use mixed encryption environments: You can login to an athena.dialup server using kerberized telnet (e.g. in HostExplorer) and then run savely 
    add crypto
    ssh someotherhost 
Insecure remote hosts

When you connect to a remote host which is insecure, namely it is likely that crackers or other unfriendly persons have access to root or your account on this machine you should disable 
X11 forwarding to this host (see the description of ~/.ssh/config above). 
Authorization forwarding to this host. 

The unfriendly person might otherwise get access to either your X11 display or to all your hosts which trust your identity stored in the ssh-key-server. 
Too short or No pass-phrase

Should a cracker gain access to your account he usually cannot use the ssh keys stored in your ~/.ssh/identity file unless you specify short, obvious or no pass-phrases with this identities. 

Once a cracker has access to your identity he can connect to all hosts which trust your identity so choosing a good, long pass-phrase for your key is important. 

Questions? Comments? Mail us! 
Credits: Patrick Decowski for many useful corrections and additions.



_______________________________________
:< 4 8 15 16 23 42 *execute*
TOATA LUMEA ESTE INVITATA PE NOUL FORUM!

pus acum 17 ani
   
Y2K`
Elite Member

Din: 666
Inregistrat: acum 17 ani
Postari: 970
mc epic aveam nevoie :P

pus acum 17 ani
   
Parazitu_2009
Grand Master

Inregistrat: acum 17 ani
Postari: 305
sper sa va traduc eu asta pana maine....banuiesc k sunt unii care nu prea stiu engleza...asa k...:D
Edit:oups!aku am gasit traducerea:D sry guys,credeam ca am pus`o...in fine..poftiti:

de ce avem nevoie de criptare
de unde sa iei ssh.
telnet/rsh/rlogin: cum inlocuieste ssh aceste instrumente.
ftp: folosind ftp cu ssh sau scp in loc de ftp.
fine tuning: facand rost de cea mai buna performanta in afara de ssh.
x11: construind traficul x11 prin link`ul de siguranta.
keys: keys si key-servers.
drawbacks: cand folosesti ssh nu este in siguranta.
intr`o urgenta:
daca trebuie sa folosesti un computer fara ssh, si nu ai autoritatea de a instala un software pe el, atunci ai aceste alegeri:
foloseste acest java applet in Netscape sau in alt Web Browser cu java enabled ( care nu este folosit in general)si trecut de data.
daca applet nu merge asa cum trebuie, si trebuie sa folosesti Internet public pentru a te conecta, atunci foloseste telnet pentru a te conecta la athena.dialup.mit.edu si logheaza`te la contul tau athena, urmat de ssh la computer`ul tau la LNS. reteaua campus la MIT aproape ca are neautorizat "sniffers", si este "dirtier" ca reteaua publica.
de ce ssh?
de ce avem nevoie de encryption?

Aproape toate computerele LNS sunt conectate la internet, toate in acelasi timp. In afara de a improviza cai pentru ca noi sa comunicam si sa colaboram cu altii din intreaga lume, Internet`ul furnizeaza de asemenea o parte pentru intrusii din intreaga lume care incearca sa castige acces la computerele noastre pentru propriile rezultate.

tipic, un intrus va incerca sa castige acces chiar daca exploreaza un software bug in ordine, sa se logheze cu o parola, sau prin a incerca sa castige acces la alt calculator si sa porneasca un program "sniffer" pentru a spiona parole atata timp cat umbla pe internet. Serviciile computer`ului personal incearca sa bandajeze peste software bugs atata timp cat devin cunoscuti, si sa detecteze si sa opreasca sniffer inainte de a capata vreo parola. Dar este treaba fiecaruia de a-si tine parolele secrete, si sa ocoleasca sa le trimita pe net in vazul sniffer`ilor. mai degraba, ar trebui sa folosesti criptarea pentru a le ascunde.

nu conteaza cum castiga accesul, un intrus de succes poate sa faca multe distrugeri, stergand fisiere importante sau flodand netul cu mesaje in asteptarea de a distruge rivalitati. in ultimul an, alte cautari facute in laboratoare au avut parte de multe distrugeri facute de intrusi. la LNS, vedem probe de la presupusi intrusi zi de zi.trebuie sa avem grija pentru ca ei vor incerca sa ne invadeze.

Chiar daca consideri ca, contul computer`ului tau nu este foarte important pentru tine, poate sa fie o oportunitate pentru intrusi de a intra si sa distruga alti useri. asa ca toti ar trebui sa fim "vecini buni".

multe computer MIT folosesc Kerberos ca encryption. de exemplu, daca iti citesti mail`ul pe athena, sau daca folosesti sistemul administrativ MIT prin net, atunci nu transmiti nici o parola clara prin net. oricum, nici un computer LNS foloseste encryption Kerberos si totusi sa nu folosesti niciodata telnet pentru a te conecta la alt mecanism LNS sau in afara de LNS. mai degraba te rog limiteaza-te la ssh.

unele persoane neprietenoase ar putea fi interesate in reteaua de trafic si sa porneasca logging`ul la toate sesiunile tale.

    9600,9600.#.host.mit.edu:0.0.DISPLAY.host.mit.edu:0.0
     USER.north.....XTERM.....Secret
     mail E-mail
     Draga Fawn,

     Am niste documente importante care trebuie sa paraseasca oficiul in secret. poti sa le transferi?
              Ollie

multe persoane neprietenoase(in afara de investigatori speciali) nu sunt interesati in mod deosebit in conversatiile tale, dar vor gasi id`ul si parola ta mult mai remarcabil. de ce? pentru ca asta inseamna ca primesc acces la alta gazda de la care pot obtine acces la radacina si pot instala un sniffer care poate loga toate sesiunile din reteaua ta locala.

majoritatea cracker`ilor din zilele noastre folosesc aceasta strategie pentru a intra intr`o singura gazda, apoi seteaza un sniffer pentru a obtine useri si parole pentru alte gazde, pentru a putea imprastia peste institutii variate in cateva zile. este responsabilitatea fiecarui user sa ocoleasca traficul necriptat -- cum ar fi de la telnet, rsh, rcp, rlogin, ftp, pop3, imap -- pentru a evita acest gen de instrusi.

aici este un exemplu de sesiune ftp sniffer - user`ul si parola sunt modificate.
     USER ken
     PASS Investing
     CWD logs
     PORT 154,201,54,21,44,5
     NLST telnet.logs
     PORT 154,201,54,21,44,6
     RETR telnet.logs
     QUIT
unde?
de unde sa iei ssh.
userii unix pot face rost de codul sursei ssh de la pagina SSH.de cele mai multe ori, nu trbuie sa faci codul sursei singur: la LNS, Linux workstation va avea ssh instalat automat. Toate serviciile serverului au ssh instalat.

Recomand ca utilizatorii de Windows sa downloadeze SecureCRT de pe pagina web MIT SecureCRT.SecureCRT au intreceri superioare VT, si este disponibil gratis pentru userii MIT, pentru ca MIT are un site autorizat. informatii despre autorizatie si cum sa o instalezi poate fi gasita in fisierul Readmw  pe pe pagina web MIT.Daca nu poti sa downloadezi SecureCRT, de exemplu daca esti acasa si daca folosesti niste ISP altele decat serviciile MIT Tether, ia SecureCRT de la Tehnologiile Van Dyke, inc. sau incearca clientul freeware ssh: SSH Sources+Binaries de Robert O`Callahan E`mail, ca extensie  a programului excelent telnet, Teraterm Pro.

Pentru userii Macintosh, recomandam NiftyTelnet (pentru ssh1) sau MacSSH (pentru ssh2). Alta alegere este sa cumperi un client SSH de la F-Secure.Produsul are un pret rezonabil si lucreaza cu incredere.Unele aparente ale vt100 nu sunt corect aplicate.

telnet/rsh/rlogin
Cum inlocuieste SSH aceste instrumente.

SSH lucreaza foarte mult ca telnet sau rsh/rlogin. te conectezi la alta gazda scriind:
     ssh hostname.domain

sau daca folosesti alt nume de user pe o gazda izolata, foloseti optiunea -l pentru a specifica acest user:
     ssh hostname.domain -l otherusername

Prima oara cand te conectezi la aceasta gazda, ssh recunoaste ca nu a invatat niciodata cheia publica a acestei gazde pana acum, si te avertizeaza ca nu cunoaste inca aceasta gazda:
    Cheia gazda nu a fost gasita in lista de gazde cunoscute.
    Esti sigur ca vrei sa continui (da/nu)?

Majoritatea oamanilor raspund de obicei "nu".in toate aceste cazuri, conectarea va fi abordata. SSH se asteapta ca tu sa raspunzi la aceasta intreabre cu "da".

Daca ai grija cu adevarat poti sa rogi administratorul sistemului sa-ti trimita cheia publica a gazdei intr-un mesaj semnat PGP. apoi poti sa adaugi cheia  la fisierul tau ~/ssh/known_hosts.Nu trebuie sa fii atat de atent...normal...

Daca esti obisnuit cu password-less rlogin, ssh ofera un mecanism asemanator. ar trebui sa editezi fisierul ~/.shosts si sa adaugi linia
     remotehost remoteuser
la acesta - aproape la fel ca ce ai facut in cazul fisierului ~/.rhosts. (Inainte de a face asa, te rog sa citesti paragraful de mai jos despre key si key-server.S-ar putea sa nu-ti trebuie ~/.shosts).

oricum, ar trebui sa stii ca ssh este mai pretentios la aceste feluri de logare. Cerceteaza cu atentie astea, daca te conectezi de la localhost, daca este cu adevarat localhost si nu happy.crecker.org si nu o  conectare inselatoare. Fisierul ~/.ssh/known_hosts de pe remote host trebuie sa contina cheia publica a gazdei a localhost. Cel mai simplu mod de a face asta este sa te conectezi (tot prin tiparirea parolei) de la localhost la remotehost si inapoi din nou - intotdeauna folosind asa numitul hostname calificat
din plin, i.e host name sa includa domeniul:
    E-mail $ ssh paul.mit.edu
    E-mail password: [scrie parola ta aici]
    Welcome to paul.mit.edu
   
    E-mail $ echo 'peter.mit.edu bill' >> ~/.shosts
    E-mail $ chmod 600 ~/.shosts
    E-mail $ ssh peter.mit.edu
    E-mail password: [scrie parola ta aici]
    Welcome to peter.mit.edu
   
    E-mail $ ssh paul
    Welcome to paul.mit.edu
     
A doua conectare de la peter la paul a fost intr`adevar posibila fara a scrie parola. noteaza-ti de asemenea ca ~/.shosts nu ar trebui sa fie scris de alti useri (chmod 600...).

In caz ca exista ceva care nu lucreaza, ar trebui sa incerci sa folosesti optiunea -v in timp ce te conectezi. SSH va explica atunci de ce o conectare password-less esueaza.

RSH are de asemenea optiunea de a executa comenzi separate.La fel si SSH. daca ti-ai setat fisierul ~/.shosts cum era scris mai sus, poti sa mai scrii doar atat:
     ssh remotehost remotecommand.

Acelasi lucru vei face si cu RSH. singura diferenta este, in caz ca nu ti-ai setat fisierul ~/.shosts, SSH te va ajuta cu parola in cazul unei executii a unei comenzi de separare. Asta e mai bine decat ce face RSH.

FTP
in general, SSH nu suporta FTP. poti sa folosesti oricum SSH`s port-forwarding pentru a inlatura conectarile ftp pentru a indeparta gazdele. aceasta metoda implica mai mult efort decat conectarea obisnuita ftp si probabil vei vrea sa ocolesti ftp si sa folosesti scp in loc.

mai intai trebuie sa stabilesti un port pentru conectarea ssh la gazda la care vrei sa conectezi cere, bineinteles,  ca gazda sa porneasca sshd si sa ai un cont pe el. pentru conectarile anonime ftp, acesta nu este de obicei un caz, dar aceste conectari de indepartare a gazdelor de obicei nu impun un risc de securitate. tu stabilesti port forwarding-ul conectarii folosind:
    peter $ ssh paul -L 1234:paul:21
    Welcome to paul.

    paul $ # Astept aici si pastrez conectarea port forwarding cat mai ridicata.

aici 1234 este un port local arbitrar la care te conectezi mai tarziu si 21 este port number pentru ftp al remotehost. apoi poti sa incepi o sesiune ftp intr-o alta fereastra.
       peter $ ftp localhost 1234
    Connected to localhost.
    220 paul FTP server (Some UNIX Version x.y) ready.
    Name (localhost:bill): bill
    331 Password required for bill.
    Password: [type bill's password on paul here]
    230 User bill logged in.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> passive
    Passive mode on.
    ftp>
     
nu fii confuz de la toate aceste hostnames. user-ul bill de la peter se conecteaza la serverul ftp pe port local 1234 (acesta este al lui peter). potrivit cu port forwarding (-L 1234:paul:21) deasupra acestui port este inaintat canalul ssh-ul criptat la portul lui paul 21 - portul de control ftp. de aceea clientii ftp raspund Conectat la localhost unde serverul separat spune 220 paul ftp server.atunci vei fi ajutat de username si de parola. acestea ar trebui sa corespunda cu contul tau de la paul, remote host.inainte de a face altceva, va trebui sa ingadui  moduri pasive al clientului ftp folosind comanda pasiva. aceasta va fi sigura ca conectarea ftp-data port (20) va ajunge la clientul ftp.
folosind scp in loc de ftp.

daca copiezi fisierele cu ssh, nu mai trebuie sa lucrezi cu programul SCP.lucreaza asemanator cu rcp:
    scp localfile remotehost:/remotedir
    scp localfile remotehost:
    scp -r localdir remotehost:/remotedir
    scp remotehost:remotefile localfile
    ...

daca ai setarile la fisierul tau ~/.shosts nu ti se va cere o parola pe durata operarii. mai multe detalii poti gasi pe pagina principala  pentru scp.

criptarea cere timp CPU pentru criptarea si decriptarea datelor. de aici, conectarile ssh si fisierele de transfer scp sunt de obicei un pic mai incete decat conectarile necriptate. SSH ofera diferite feluri de criptare, numite Ciphers care au nivele diferite de securitate si solicitarile CPU. fisierul ssh.readme.ciphers compara aceste optiuni diferite:
     BLOWFISH
     ========

Bruce Schneier a blocat codul secret care a fost facut pentru a fi o alternativa rapida si gratuita a algoritmilor existente in criptare. este o autorizare gratuita. versiunea SSH foloseste 128 byt key pentru blowfish (algoritmul permite orice de la 32 la 448 bits).

performanta unei masini pentium este de aproape 88% a unei "none" criptari.

    poti sa-l dezasamblezi fara sa dai optiunea blowfish de configurare. este pornit de nereprezentare.

     [...]

     3DES
     ====

cheia 3 triplu-DES(cheia efectiva de aproape 112bits) in modul ascuns CBC. asta este absenta codului secret care este folosita daca clientii cer un cod secret care nu este sustinut de server.
cheia fisierului privateste criptata de 3DES din default.
performanta unei masini pentium este de aproape 45% din "none" criptare.
nu o poti dezasambla,pentru ca este un cod secret obligatoriu.
     [...]

SSH si SCP accepta optiunile commandline pentru a specifica codul secret preferat in conectare. codul default este IDEA si de acolo ai putea sa consideri sa folosesti "blowfish" ca default pentru ca este mai rapid. SSH are un fisier de configurare a userilor in ~/.ssh/config. formatul acestui fisier este descris in pagina de inceput a ssh.

pentru a ingadui "blowfish" pentru toate conectarile tale, fisierul ~/.ssh/config se va citi asa:
     Host *
       Cipher blowfish

SSH iti permite de asemenea sa presezi traficul de internet. aceasta este o optiune foarte interesanta daca folosesti ssh peste o linie de modem sau pe remote host. oricum, presarea ia din nou ceva mai multe CPU cycles, asa ca ar trebui sa balansezi viteza retelei de net impotriva vitezei CPU. poate ai vrea sa schimbi ~/.ssh.config cu
     Host *.mit.edu
      Cipher blowfish
   
    Host *
      Compression yes
      Cipher blowfish

alte optiuni interesante pentru pentru configurarea fisierului ar fi:
ForwardAgent da, pentru a pasa informatii autorizate peste link`ul criptat.
ForwardX11, pentru a inainta traficul X11 peste link`ul criptat.
RhostsRSAAuthentication da, pentru a permite folosirea fisierului ~/.shosts.
RSAAuthentication da, pentru a permite folosirea perechilor de chei autorizate RSA.
FallBackToRsh nu, pt ca nu permite o folosire accidentala a rsh daca user`ul cere o conectare ssh. SSH trece la rsh prin absenta, daca remote host nu intelege protocolul ssh.
X11
Cautand date X11 prin link`ul de siguranta.

pornind o sesiune de grafice pe o remote host de obicei implica setarile variabile ale display`ului de pe remote hostla myhost:0.0 si permite remote host in unele feluri sa acceseze display`ul de pe myhost.

(1) aceasta poate fi facuta folosind comanda:
      xhost +

pe care, din  nefericire, multi o fac.aceasta comanda permite accesul pentru fiecare computer de pe internet. acces inseamna, de exemplu: oricine poate sa downloadeze continutul desktop`ului tau si sa vada ce faci. oricine poate sa-ti ia singura keysroke pe care o faci si sa scoata secvente ca telnet remotehost si urmatoarele doua randuri.

(2) mai bine este, dar nu extraordinar, sa selectezi o gazda specifica care garanteaza acces, folosind:
      xhost + remotehost

asta inseamna ca unul tre sa crada in fiecare (potential) user de pe remotehost ca nu va porni sniffer`ul tastaturii sau ca va downloada imaginea desktop`ului tau.

MIT magic cookie este o solutie si mai buna - oarecum dificil de folosit pentru majoritatea user`ilor. gasesti informatii despre aceasta metoda in prima pagina despre xauth
     xauth extract - $DISPLAY |
        ssh remotehost xauth merge -

garanteaza permisiunea bazata pe un criptografic cookie - traficul X11 este inca necriptat si poate fi spart de o persona neprietenoasa.

(3) solutia finala a acestei probleme este totusi ssh. daca permiti inaintarea X11 si ssh la un remote host, ssh va seta display`ul  la ceva de genul: DISPLAY=remotehost:11.0.
toate aplicatiile X11 pe care le pornesti de la remotehost se vor conecta la prtul remotehost: 11.0. SSH va porni apoi tot traficul X11 la display`ul local folosind link`ul criptat intre gazde.
    E-mail $ ssh paul
    Welcome to paul.
   
    E-mail $ echo $DISPLAY
    paul:12.0
    E-mail $ xlsclients
    peter  /usr/bin/X11/xterm
    E-mail $

singura forma posibila de atatc ar fi ca cineva cu acces la contul tau sa poata castiga acces la display`ul tau folosind link`ul criptat. asta este oricum un mod mult mai mic in cazul xhost/xauth.

keys
keys si key-servers cum sa scrii parole bune frecvent.
ssh nu permite doar parole bazate pe autentificare, dar permite de asemenea autentificarea perechilor RSA key.
avantajul acestor tehnici de autentificare este ca poti proteja logarea ta cu parole mai mari de 8caractere.
iti poti seta sistemulintr-un fel in care poti sa autentifici doar o data pe sesiune si apoi vei avea acces password-less la toate sistemele pe care le-ai ingaduit pentru aceste servicii.

pentru a seta SSH in acest fel, trebuie mai intai sa generezi o pereche RSA key.
     ssh-keygen

face asta pentru tine. ssh-keygen te va ajuta cu o parola care va proteja key-pair impotriva celor care vor sa fure partea privata a key-pair de la sistemul tau. sa il lasi gol este total descurajator.

vei avea apoi doua noi fisiere in ~/.ssh/:
identity - cheia ta secreta privata;
identity.pub - cheia ta publica.

continutul identity.pub(este o linie lunga) ar trbui atasata (ca o linie lunga) la fisierul ~/.ssh/authorized_keys de pe remote host.

daca acum te conectezi la un remote host, ssh te va ajuta la pass-phrase de la RSA key.daca aceasta este corecta, poti sa te loghezi fara sa-ti scrii parola normala.
    E-mail $ ssh paul
    Enter pass-phrase for RSA key E-mail': [ scrie pass-phrase aici ]
    Welcome to paul

    E-mail $

pana acum, asta nu ne ajuta sa scriem pass phrases mai putin frecvent. alt program ssh, numit ssh-agent ne ajuta sa pastram si sa inaintam informatii d autentificare la gazde la care vrem sa ne conectam.

ar trebui sa pornesti ssh-agent cand te loghezi de la reteaua ta de lucru, preferabil in fisierul tau ~/.xsession. pune randurile astea doua:
    eval `ssh-agent`
    ssh-add
in el, inainte a porni window manager, si randul:
    eval `ssh-agent-k`
la sfarsit. dupa logarea ta obisnuita vei fi apoi intrebat de ssh pass-phrase. unii oameni se planga de aceasta procedura ca trebuie sa scrie parola de doua ori. dar - nu - a doua oara nu este parola ta dar este mai lunga de 8 caractere. si da - pana acum nu a fost xdm-support pentru pass-phrases. deci trebuie sa scrii o parola si o pass-phrase.

lucrul bun in legatura cu asta este ca ssh-agent iti va pastra identitatea si o va da fiecarei gazde la care te conectezi. deci va trbui sa scrii lunga ta pass-phrase o data pe sesiune.

daca setezi mediul ssh asa, folosind RSA key-pairs, asta inseamna de asemenea ca fisierul tau ~/.shosts este acum invechit. de fapt, pass-phrase protejata de RSA keys furnizeaza o securitate ridicata decat forma gazdei bazata pe ~/.shosts, ar trbui totusi sa dezinstalezi fisierul ~/.shosts din  nou. altfel, un atacant care intra pe unul din conturile tale are acces automat la toate masinile tale.
Drawbacks
cand folosesti ssh nu esti in siguranta.

ssh iti furnizeaza cu toate instrumentele care iti face viata de internet mai sigura si care iti ofera extra confort.partea proasta este ca te astepti sa te protejezi si sa intelegi ca ssh nu te ptotejeaza sa nu faci greseli cand iti aperi datele si informatiile contului.
Mixed Environment

aici este o sesiune draguta capturata de un crackerpe unul din sistemele MIT care arata problema in detalii:
    nyc-ny.ix.netcom.com => SOMEHOST.MIT.EDU [23]
    #'vt100!bill
    Secret
    ssh someotherhost -l bill
    @Secret
    inc
    mailfrom
    cd Mail
    ls
    exit
    exit

gazdele, userii si parolele sunt modificate. userul vine de serviciul de internet la masina unei gazde telnet si incepe o sesiune ssh la alta gazda. intrusul captureaza sesiunea nesigura telnet si face rost de toate parolele ssh  in text clar. daca prima conectare ar fo fost una ssh, nu ar fi existat nici o sansa sa captureze parola.

atata timp cat userii folosesc amblele ssh si logari necriptate, nu este nici o securitate de parola. cracker`ul poate sa captureze parola de oe singura ta conectare necriptata(asta ar putea fi o conectare ftp la sistemul tau) si apoi poate sa foloseasca fericit ssh, userul tau si parola.

te rog noteaza-ti ca este oricum ok sa amesteci criptarile: poti sa te loghezi la un server athena.dialup folosind kerberized telnet si apoi sa mergi mai departe in siguranta.
   add crypto
   ssh someotherhost
insecure remote host

cand te conectezi la o remote host care este nesigur, este placut ca cracker`ii sau alte persoane neprietenoase sa aiba acces la contul tau asa ca ar trbui sa dezasamblezi masina ta.
X11 inainteaza la aceasta gazda (vezi descrierea ~/.ssh config mai sus).
autorizarea inainteaza la aceasta gazda.

persoanele neprietenoase ar putea altfel sa aiba acces fie la display`ul X11 sau la toate gazdele  in care ti-ai incredintat identitatea pastrata in ssh-key-server.

ar trebui un cracker sa castige acces la contul tau, dar nu poate sa sa foloseasca ssh keys pastrate in fisierul ~/.ssh/identity decat daca tu specifici scurte, evidente sau pass-phrases cu aceste identitati.

din moment ce un cracker are acces la identitatea ta nu se poate conecta la toate gazdele care cred in identitatea ta, asa ca alege o buna si lunga parola.

intrebari? comentarii? trimite mail
credit: Patrick Decowski

Modificat de Parazitu_2009 (acum 17 ani)


_______________________________________

Omul care nu are nimic de pierdut e cel mai greu de invins.

pus acum 17 ani
   
Pagini: 1  

Mergi la