Ssh: Unterschied zwischen den Versionen

Aus SchnallIchNet
Wechseln zu: Navigation, Suche
(password aendern)
Zeile 1: Zeile 1:
 +
==ssh==
 +
to tear down encryption when e.g. pushing/pulling backups through you own networks<br/>
 +
set the cipher to:
 +
-c blowfish-cbc
 +
 
==ssh-keygen==
 
==ssh-keygen==
 
mit ssh-keygen werden ssh-schluessel erstellt, bearbeitet oder konvertiert.
 
mit ssh-keygen werden ssh-schluessel erstellt, bearbeitet oder konvertiert.

Version vom 9. August 2010, 12:26 Uhr

ssh

to tear down encryption when e.g. pushing/pulling backups through you own networks
set the cipher to:

-c blowfish-cbc

ssh-keygen

mit ssh-keygen werden ssh-schluessel erstellt, bearbeitet oder konvertiert.

password aendern

ssh-keygen -p -f id_rsa

.ssh/authorised_keys

wenn man ein key-based auth verwendet, kann man einem key in dieser datei einen command voranstellen:

command="/usr/bin/AllowedCommand" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQE
A06ssYDmr5eWxbp+piT4vyPBO3qYsk9ZsagAgZ4ygmGQzSZr9yxaZSkUFFXJvkwZuRVPI
U5UITBi3Whvh2y5Ajm91+M5qKwXeakrJ49GlsyuLfzYr7onttfP0cleLQuLLrf5Pxly1g
yaDMN2esPDkngl/XplvaWJQDmQAAQmgMzYig+J+xGHESU9IomUHSZ/oju5xiFVVA+gLMg
6BWPnYDA2zwGLuYZmeRdw+qJN4Mg6jiD5XQPqBVSI+zlcyFbaAz2EVlLEIRmx1nPOtVb/
SdxNr7VEYkted6WDXmm6KYMvnzWtJCe8mdIgNhCKd4pFKniJNUUhtK7GFiaF3/agJyQ==
 root@Nagios

dies bewirkt dass der besitzer des private key ausschliesslich dieses commando ausfuehren kann. aber kein anderes und auch keine shell bekommt...

Siehe auch

SshFS

sshfs -o reconnect -o sshfs_sync [-o IdentityFile=/path/to/.ssh/id_rsa] root@BACKUPHOST:/backups/koblenz /path/to/mountpoint/sshfs-mount

SshTunnel

socks proxy

ssh enables me to simply create an ssh-tunnel which provides a socks proxy.
this is really simple!
ssh protocoll version 2 is needed but should prefered anyway... ;-)

ssh [-f] -N -D[ip:]1080 <username>@my.sshenabled.really.huge.bandwith.connected.host.tld

where:

  • -f run in background, otherwise ssh runs in foreground...
  • -N says sshd not to start any application on destination host
  • -D specifies the port to use on the local host (1080)
    • if you do not specify an IP of your local system, localhost (127.0.0.1) is used...
    • keep in mind, that you need to be root to allocate well-known-ports


.ssh/config:

DynamicForward 127.0.0.1:1080

or

Host proxy
        Hostname 10.21.22.23
        User <user>
        Protocol 2
        DynamicForward 4711

now do:

ssh proxy

and then:

ssh -o ProxyCommand="/usr/bin/nc --proxy 127.0.0.1:4711 --proxy-type socks4 %h %p" ws01.domain.tld -l root


Local forward

der sshclient 10.10.11.254 wird mein zugriff auf den lokalen port 3389 durch den ssh-server 213.221.106.43 auf das zielsystem 192.168.102.50:3389 weitergeleitet.


beispiel:
=========
csteidl@koblenz$
ssh -L 10.10.11.254:3389:192.168.102.50:3389 -f -N root@213.221.106.43

~/.ssh/config:
--------------
LocalForward 10.10.11.254:3389 192.168.102.50:3389


allgemeine syntax:
==================
ssh -L [lokaler_host:]lokaler_port:dst_host:dst_port -f -N user@ssh_host

erklaerung:
===========
beim aufbau eine remotedesktop verbindung an 10.10.11.254:3389 wird dann die 
verbindung von 213.221.106.43 (192.168.102.40) an 192.168.102.50:3389 
weitergeleitet, wobei _nur_ der server 213.221.106.43 verbindung zum server 
192.168.102.50 hat. 

koblenz              ssh_host (NAT)                      ssh_host (real)
10.10.11.254 ---> FW:213.221.106.43:22 ---|1:1 nat|---> 192.168.102.40:22
                                                               |
                                                               |
                                                              3389
                                                               |
                                                               |
                                                               v
                                                          192.168.102.50 (win) 
                                                            dst_host


Remote Forward

der ssh-server 213.221.106.43 kann durch connect auf 127.0.0.1:8000 auf den port 80 des ssh-client 10.10.11.254 zugreifen

ssh -R 127.0.0.1:8000:10.10.11.254:80 213.221.106.43


~/.ssh/config:

RemoteForward 127.0.0.1:8000 10.10.11.254:80