laatste dingen
[linuxnijmegen-ssh.git] / truuk.tex
1 \begin{frame}[fragile]
2 \frametitle{Public key authentication}
3 \pause
4 \begin{block}{Nut}
5 Mogelijk geen wachtwoord en veiliger
6 \end{block}
7 \pause
8 \begin{block}{Command line vlag}
9 \lstinline{ssh -i ~/.ssh/keyfile frobnicator@foobarbaz.com}
10 \end{block}
11 \pause
12 \begin{block}{Config file}
13 \lstinline{IdentityFile ~/.ssh/keyfile}
14 \end{block}
15 \end{frame}
16
17 \begin{frame}[fragile]
18 \frametitle{Public key authentication}
19 \framesubtitle{Genereren van een sleutelpaar}
20 \begin{block}{\$ ssh-keygen}
21 \begin{lstlisting}
22 Generating public/private rsa key pair.
23 Enter file in which to save the key (/home/frobnicator/.ssh/id_rsa):
24 /home/frobnicator/.ssh/github
25 Enter passphrase (empty for no passphrase):
26 Enter same passphrase again:
27 Your identification has been saved in /home/frobnicator/.ssh/github.
28 Your public key has been saved in /home/frobnicator/.ssh/github.pub.
29 The key fingerprint is:
30 92:92:6e:b8:3f:d5:76:e8:1b:73:ed:97:c4:e5:87:ba frobnicator@foobarbaz
31 The key's randomart image is:
32 +--[ RSA 2048]----+
33 | |
34 | |
35 | |
36 | . . .|
37 | o o.S. . + |
38 | o ...+ .. + o|
39 | . o. oo.. .o ..|
40 | o. .+ .. o |
41 | .... .. Eo |
42 +-----------------+
43 \end{lstlisting}
44 \end{block}
45 \end{frame}
46
47 \begin{frame}[fragile]
48 \frametitle{Public key authentication}
49 \framesubtitle{Installeren van een sleutel}
50 \begin{block}{Publieke sleutel: \textasciitilde/.ssh/github.pub}
51 \begin{lstlisting}
52 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBrgcK05XzRRbtmPyXQner5ef8
53 suOAErDvInRDQbl2bjR0PGizL2t5lM9zE+mS0HHigteGLKma1NxVBBeam0CrodJN
54 BcW55x3LR/2fLSujUqcloQNwLUpD5da6eGg9yPo1fEaAOK1ssHGA30o6nmDEZEHy
55 PFgBtPwtDw5TPXPpzslaJx1u7CdeyzqpYsUycxzboy3GBcCsvG4nzD4C9vd0yk5o
56 jlDeECul4mwyg7NuEjltaY89RzrSa8NtqtURyg/JFQW2IVGe+oBXeTL/eQRuo1Nj
57 GhYyPm1VMVM+NvaYQZXxGfLpoDoP2V+deD+gP5DuC8WW4LSGnkHKhDEin0Yl fro
58 Bnicator@foobarbaz
59 \end{lstlisting}
60 \end{block}
61 \pause
62 \begin{block}{Geheime sleutel: \textasciitilde/.ssh/github}
63 \begin{lstlisting}
64 -----BEGIN RSA PRIVATE KEY-----
65 9RnNnrD2DkJBqoX/Aph2wVZg1y/I8t27C7yPR66xUNyHWG4J+k+q7REhA/K4fvjl
66 NNvNtbc4EeNI+NxaaftH1qo6yBIF5yDwuEYKixeconLCeGl9/exdlyMyXbuuTrU9
67 d5DgKnWxgJPHnDjmwqTeX3A5S34m/qJKK67IF9WqedeHxeMKzMZYcZpcsFxdvHk/
68 ...
69 -----END RSA PRIVATE KEY-----
70 \end{lstlisting}
71 \end{block}
72 \pause
73 \begin{block}{Installeren op de server}
74 De inhoud van het publieke bestand moet in
75 \lstinline{~/.ssh/authorized_keys} komen te staan
76 \end{block}
77 \end{frame}
78
79 \begin{frame}[fragile]
80 \frametitle{Public key authentication}
81 \pause
82 \begin{block}{\textasciitilde/.ssh/authorized\_keys}
83 \begin{lstlisting}
84 option1="option1value",option2="option2value"...optionn="optionnvalue" ssh-rsa\
85 AAAB4N.....
86 \end{lstlisting}
87 \end{block}
88 \pause
89 \begin{block}{Merk op}
90 alles in \textasciitilde/.ssh/ moet alleen leesbaar zijn voor de user.
91 \lstinline{chmod 600} dus
92 \end{block}
93 \end{frame}
94
95 \begin{frame}[fragile]
96 \frametitle{Pipen}
97 \pause
98 \begin{block}{Basisvoorbeelden}
99 \begin{enumerate}
100 \item{server$\rightarrow$client}\\
101 \lstinline{ssh frobnicator@foobarbaz.com 'ls -allah /media/cdrom'}
102 \item{client$\rightarrow$server}\\
103 \lstinline{ls -lah /media/cdrom | ssh frobnicator@foobarbaz.com 'cat - > cdrom_client.txt'}
104 \end{enumerate}
105 \end{block}
106 \pause
107 \begin{block}{Praktijk}
108 \begin{enumerate}
109 \pause
110 \item{Backup}\\
111 \lstinline{dd if=/dev/sdb | gzip | ssh frobnicator@foobarbaz.com 'gzip -d | dd of=sdb.img'}
112 \pause
113 \item{Script draaien}\\
114 \lstinline{ssh frobnicator@foobarbaz.com 'bash -s' < script.sh}
115 \pause
116 \item{Liedje afspelen vanaf server op client}\\
117 \lstinline{ssh frobnicator@foobarbaz.com 'cat ~/liedje.flac' | flac -dsc - | aplay}
118 \pause
119 \item{Liedje afspelen op server vanaf client}\\
120 \lstinline{ssh frobnicator@foobarbaz.com 'flac -dsc - | aplay' < ~/liedje.flac}
121 \end{enumerate}
122 \end{block}
123 \end{frame}
124
125
126 \begin{frame}[fragile]
127 \frametitle{X forwarding}
128 \begin{block}{Nut}
129 Grafische programma's draaien op een machine die niet perse binnen
130 handbereik is.
131 \end{block}
132 \pause
133 \begin{block}{Command line vlag}
134 \lstinline{ssh -X frobnicator@foobarbaz.com}
135 \end{block}
136 \pause
137 \begin{block}{Config file}
138 \lstinline{ForwardX11 yes}
139 \end{block}
140 \pause
141 \begin{block}{Caveat}
142 Veiligheid
143 \end{block}
144 \end{frame}
145
146 \begin{frame}
147 \frametitle{Port forwarding}
148 \begin{block}{Nut}
149 Onversleutelde communicatie versleutelen
150 \end{block}
151 \pause
152 \begin{block}{Command line vlag}
153 \lstinline{ssh -L port:host:hostport frobnicator@foobarbaz.com}\\
154 \lstinline{ssh -R port:host:hostport frobnicator@foobarbaz.com}
155 \end{block}
156 \pause
157 \begin{block}{Config file}
158 \lstinline{LocalForward port host:hostport}\\
159 \lstinline{RemoteForward port host:hostport}
160 \end{block}
161 \end{frame}
162
163 \begin{frame}
164 \frametitle{Agent forwarding}
165 \begin{block}{Nut}
166 Je SSH cache meenemen naar een andere server
167 \end{block}
168 \pause
169 \begin{block}{Command line vlag}
170 \lstinline{ssh -A frobnicator@foobarbaz.com}
171 \end{block}
172 \pause
173 \begin{block}{Config file}
174 \lstinline{ForwardAgent yes}
175 \end{block}
176 \end{frame}
177
178 \begin{frame}
179 \frametitle{SOCKS proxy}
180 \begin{block}{Nut}
181 Al je internet verkeer via een \textit{vertrouwde} locatie laten lopen
182 \end{block}
183 \pause
184 \begin{block}{Command line vlag}
185 \lstinline{ssh -D port frobnicator@foobarbaz.com}
186 \end{block}
187 \pause
188 \begin{block}{Config file}
189 \lstinline{DynamicForward port}
190 \end{block}
191 \pause
192 \begin{block}{Instellen in Chromium}
193 \lstinline{chromium --proxy-server="socks5://host:8080" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE host"}
194 \end{block}
195 \end{frame}
196
197 \begin{frame}
198 \frametitle{Instellen in Firefox}
199 Edit - Preferences - Advanced - Network - Settings
200 \includegraphics[width=200px]{./img/firefox_socks.png}
201 \end{frame}
202
203 \begin{frame}[fragile]
204 \frametitle{Compression}
205 \begin{block}{Nut}
206 Snelheid
207 \end{block}
208 \pause
209 \begin{block}{Command line vlag}
210 \lstinline{ssh -C frobnicator@foobarbaz.com}
211 \end{block}
212 \pause
213 \begin{block}{Config file}
214 \lstinline{Compression yes}
215 \end{block}
216 \end{frame}