Share
Embed
Transcript
98 slides
-
Workshop Linux administration Advanced Workshopdag PFZ 13 november 2010 Joshua
Thijssen woensdag 25 april 12 -
http://joind.in/2370 Senior Software Engineer 4worx / Enrise - Amersfoort whoami?
2 woensdag 25 april 12 -
http://joind.in/2370 Senior Software Engineer 4worx / Enrise - Amersfoort whoami?
Development in php, python, perl, C, C++, java, assembly 2 woensdag 25 april 12 -
http://joind.in/2370 Senior Software Engineer 4worx / Enrise - Amersfoort whoami?
Development in php, python, perl, C, C++, java, assembly MySQL DBE, MySQL DBA, LPIC-1, LPIC-2, Zend PHP5, Zend PHP5.3, Certified Ubuntu professional, and a dive instructor. 2 woensdag 25 april 12 -
http://joind.in/2370 Senior Software Engineer 4worx / Enrise - Amersfoort whoami?
Development in php, python, perl, C, C++, java, assembly MySQL DBE, MySQL DBA, LPIC-1, LPIC-2, Zend PHP5, Zend PHP5.3, Certified Ubuntu professional, and a dive instructor. Blog: www.adayinthelifeof.nl Twitter: @jaytaph 2 woensdag 25 april 12 -
http://joind.in/2370 Senior Software Engineer 4worx / Enrise - Amersfoort whoami?
Development in php, python, perl, C, C++, java, assembly MySQL DBE, MySQL DBA, LPIC-1, LPIC-2, Zend PHP5, Zend PHP5.3, Certified Ubuntu professional, and a dive instructor. Blog: www.adayinthelifeof.nl Twitter: @jaytaph “Jack-of-all-trades, master of none” 2 woensdag 25 april 12 -
http://joind.in/2370 virtual machine • start virtualbox • inloggen met •
gebruiker: pfz • wachtwoord: pfz • (alle wachtwoorden overal op de virtual machine zijn pfz) (maar niet verder vertellen) 4 woensdag 25 april 12 -
http://joind.in/2370 Wat gaan we doen? • +- 3 uur hands-on
opdrachten • Ideeen? Problemen? Vraagstukken? Vertel! • Vraag? Vraag! 5 woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) Wat gaan
we doen? woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) • Rsync
/ mirroring Wat gaan we doen? woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) • Rsync
/ mirroring • IPTables Wat gaan we doen? woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) • Rsync
/ mirroring • IPTables • Logical Volume Manager Wat gaan we doen? woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) • Rsync
/ mirroring • IPTables • Logical Volume Manager • ??? Wat gaan we doen? woensdag 25 april 12 -
http://joind.in/2370 6 • Passwordless SSH (and other stuff) • Rsync
/ mirroring • IPTables • Logical Volume Manager • ??? Wat gaan we doen? woensdag 25 april 12 -
http://joind.in/2370 LPIC-1 • work at the command line • perform
maintenance • install & configure 8 woensdag 25 april 12 -
http://joind.in/2370 LPIC-1 What is the man command used for? (informatie
tonen over commando) Which of the following commands can be used to decompress the file foo.gz? (gzip -d foo.gz, gunzip foo.gz) Which of these commands can be used to display one page of output at a time to the screen? (less & more) What command sends the output of cmd1 to the input of cmd2? (cmd1 | cmd2) What command do you use to create swap space? (mkswap) Which command will show how much free disk space is available in the current directory? (df) 9 woensdag 25 april 12 -
http://joind.in/2370 LPIC-2 • Administer small - medium sized network •
plan, implement, maintain mixed network • LAN server (samba) • Gateway (firewall, proxy, mail, news) • Server (webserver, ftp server) • Supervise assistants • Consultancy 10 woensdag 25 april 12 -
http://joind.in/2370 LPIC-2 A system with five separate drives is to
be configured to use RAID and the main requirement is to obtain maximum possible I/O throughput. Which of the following RAID levels will provide the greatest throughput using all five drives? (raid5) A BIND zone file has been updated, however, none of theDNS slaves have picked up the change. What is most likely the problem? (serie nummer niet geupdate) When configuring name-based virtual hosts in Apache, which directive contains the name of the virtual host that is matched to the "Host:" request from the client? (virtualhost) From a Linux client, what command line program can be used to browse Windows shares? (Enter the command only with no path information or parameters) (smbclient?) What file would be edited to change a user procmail recipe? (Please write only the filename without options, paths or arguments.) (.procmailrc) While testing some new settings for syslogd in /etc/testlog.conf none of the changes take effect when the SIGHUP signal is sent to syslogd. What is likely to be the problem? (Errors in config) 11 woensdag 25 april 12 -
http://joind.in/2370 LPIC-3 • installation, management, troubleshooting (very) large networks. •
WAN knowledge • Full environment implementation using samba / LDAP • Write scripts in bash / perl + programming knowledge 12 woensdag 25 april 12 -
http://joind.in/2370 • Wat is het? • Is het veiliger (of
juist niet)? 14 passwordless SSH woensdag 25 april 12 -
http://joind.in/2370 • Wat is het? • Is het veiliger (of
juist niet)? • passphrases? (dus toch een wachtwoord!?) 14 passwordless SSH woensdag 25 april 12 -
http://joind.in/2370 • Copieren ~/.ssh/id_rsa.pub naar server scp ~/.ssh/id_rsa.pub [email protected]:~ •
Toevoegen aan ~/.ssh/authorized_keys 19 woensdag 25 april 12 -
http://joind.in/2370 • Copieren ~/.ssh/id_rsa.pub naar server scp ~/.ssh/id_rsa.pub [email protected]:~ •
Toevoegen aan ~/.ssh/authorized_keys 19 woensdag 25 april 12 -
http://joind.in/2370 • alleen vanaf specifieke IP’s: from=”192.168.1.*, 123.123.123.123” • alleen
specifiek command: command=”...” 20 woensdag 25 april 12 -
http://joind.in/2370 • alleen vanaf specifieke IP’s: from=”192.168.1.*, 123.123.123.123” • alleen
specifiek command: command=”...” • Maak een account aan voor je buur(?man|vrouw), en zorg dat alleen HIJ(/ZIJ) vanaf zijn IP kan inloggen (en jij bij hem). Je mag NIET inloggen in een shell account, en je kunt alleen maar “top” (/ usr/bin/top) zien als je inlogt via ssh. 20 woensdag 25 april 12 -
http://joind.in/2370 • alleen vanaf specifieke IP’s: from=”192.168.1.*, 123.123.123.123” • alleen
specifiek command: command=”...” • Maak een account aan voor je buur(?man|vrouw), en zorg dat alleen HIJ(/ZIJ) vanaf zijn IP kan inloggen (en jij bij hem). Je mag NIET inloggen in een shell account, en je kunt alleen maar “top” (/ usr/bin/top) zien als je inlogt via ssh. 20 woensdag 25 april 12 -
http://joind.in/2370 • visualhostkeys • ssh-agents • agent-forwarding 21 Other neat
stuff woensdag 25 april 12 -
http://joind.in/2370 • visualhostkeys • ssh-agents • agent-forwarding • tunneling 21
Other neat stuff woensdag 25 april 12 -
http://joind.in/2370 • visualhostkeys • ssh-agents • agent-forwarding • tunneling 21
Other neat stuff woensdag 25 april 12 -
http://joind.in/2370 • opslaan van (wachtwoorden) voor identit[y|ies] 23 ssh agents
woensdag 25 april 12 -
http://joind.in/2370 • opslaan van (wachtwoorden) voor identit[y|ies] • veiliger dan
zonder passphrase 23 ssh agents woensdag 25 april 12 -
http://joind.in/2370 • opslaan van (wachtwoorden) voor identit[y|ies] • veiliger dan
zonder passphrase • “ssh-agent bash” (liefst in je profile) 23 ssh agents woensdag 25 april 12 -
http://joind.in/2370 • opslaan van (wachtwoorden) voor identit[y|ies] • veiliger dan
zonder passphrase • “ssh-agent bash” (liefst in je profile) • “ssh-add” 23 ssh agents woensdag 25 april 12 -
http://joind.in/2370 • opslaan van (wachtwoorden) voor identit[y|ies] • veiliger dan
zonder passphrase • “ssh-agent bash” (liefst in je profile) • “ssh-add” 23 ssh agents woensdag 25 april 12 -
http://joind.in/2370 • “secure” tunnel voor van alles • http, socks,
mysql, ftp, mail... • firewalls? ssh it! • “ssh -f user@server -L 12345:127.0.0.1:3306 -N • reverse tunnel: -R 1234:localpc:1234 28 ssh tunneling woensdag 25 april 12 -
http://joind.in/2370 Rsync • local mode • remote mode (remote shell)
30 woensdag 25 april 12 -
http://joind.in/2370 Rsync • local mode • remote mode (remote shell)
• list mode 30 woensdag 25 april 12 -
http://joind.in/2370 Rsync • local mode • remote mode (remote shell)
• list mode • server mode 30 woensdag 25 april 12 -
http://joind.in/2370 Rsync - local • rsync -av /tmp ~ 31
woensdag 25 april 12 -
http://joind.in/2370 Rsync - local • rsync -av /tmp ~ •
rsync -av /tmp/ ~ 31 woensdag 25 april 12 -
http://joind.in/2370 Rsync - local • rsync -av /tmp ~ •
rsync -av /tmp/ ~ • -n == dry-run 31 woensdag 25 april 12 -
http://joind.in/2370 Rsync - local • rsync -av /tmp ~ •
rsync -av /tmp/ ~ • -n == dry-run • Synchroniseert de /tmp directory naar je home directory (~/tmp 31 woensdag 25 april 12 -
http://joind.in/2370 Rsync - remote • rsync -av ~/mystuff jthijssen@backup:. •
rsync -av jthijssen@backup:/mystuff/ ~/restore • Synchroniseert directory naar remote server (of terug) 32 woensdag 25 april 12 -
http://joind.in/2370 Rsync - listings • rsync -av pfz@server: • Laat
listing zien van server 33 woensdag 25 april 12 -
http://joind.in/2370 Rsync - server • rsync --config rsync.conf --daemon •
34 woensdag 25 april 12 -
http://joind.in/2370 remember ssh? 35 ~rsync/rsyncer: #!/bin/sh case "$SSH_ORIGINAL_COMMAND" in *\&*)
echo "Rejected" ;; *\(*) echo "Rejected" ;; *\{*) echo "Rejected" ;; *\;*) echo "Rejected" ;; *\<*) echo "Rejected" ;; *\`*) echo "Rejected" ;; rsync\ --server*) $SSH_ORIGINAL_COMMAND ;; *) echo "Rejected" ;; esac ~rsync/.ssh/authorized_keys: command=”/home/rsync/rsyncer”,from=”sourceip”,no-port-forwarding,no-X11-forwarding,no-pty woensdag 25 april 12 -
http://joind.in/2370 • Hard disk farms • Easy resizing • Snapshots
37 LVM - Logical Volume Manager woensdag 25 april 12 -
http://joind.in/2370 • pvcreate / pvremove / pvscan / pvdisplay /
pvmove • vgcreate / vgremove / vgextend / vgreduce / vgscan / vgdisplay • lvcreate / lvremove / lvextend / lvreduce / lvscan / lvdisplay • mkfs.ext3, fdisk, mkdir, mount, umount 39 LVM - Logical Volume Manager woensdag 25 april 12 -
http://joind.in/2370 1. Creeer volume group “pfzdata” vanaf 2 nieuwe schijven
(sdb en sdc) 2. Creeer 2 “logische” volumes: pfz-code (100MB) pfz-data (de rest) 3. Formatteer beide volumes als ext3 en mount op /pfz-data en /pfz-code 4. Creeer een bestand op pfz-data: dd if=/dev/urandom of=/pfz-data/pfz.dat bs=1024K count=300 5. “vervang” schijf /dev/sdb door /dev/sdd in de volume manager. Zorg dat je logische volume blijft werken (unmount /pfz-data + code eerst!). Gooi schijf / dev/sdb uit de volumegroep. 40 LVM - Logical Volume Manager woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Creeer volume group “pfzdata”
vanaf 2 nieuwe schijven (sdb en sdc) 41 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Creeer 2 “logische” volumes:
pfz-code (100MB) pfz-data (de rest) 42 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Formatteer beide volumes als
ext3 en mount op /pfz-data en /pfz-code 43 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Creeer volume group “pfzdata”
vanaf 2 nieuwe schijven (sdb en sdc) 44 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager “vervang” schijf /dev/sdb door
/dev/sdd in de volume manager. Zorg dat je logische volume blijft werken (unmount /pfz-data + code eerst!). Gooi schijf /dev/sdb uit de volumegroep. 45 woensdag 25 april 12 -
http://joind.in/2370 6. Reduceer de pfz-data naar 100MB. Zorg dat alle
data van /dev/sdd1 verplaatst wordt naar /dev/sdc1 en haal /dev/sdd1 uit de volume groep. Mount /pfz-data daarna opnieuw. 7. Verwijder /pfz-data/pfz.dat en creeer een eigen bestand pfz.info met daarin de text “Hello world” 8. Voeg schijf /dev/sdb1 weer toe aan de pfzdata volumegroep toe. Creeer een nieuwe volumegroep (pfzbackup) en hang daar schijf /dev/sdd1 aan. Maak logische volume pfz-backup (100% van de volumegroep), formateer als ext3 en mount op /pfz-backup. 9. Maak een snapshot van de pfz-data volume op LV pfz-snapshot (is ook 100MB groot). Mount op directory /pfz-snapshot. 10. Tar de snapshot naar /pfz-backups (tar cvzf /pfz-backup/backup-001.tgz /pfz-snapshot). Umount en verwijder de snapshot LV. 11. Verander de text in /pfz-data/pfz.info bestand, maak een nieuwe snapshot en tar de snapshot opnieuw naar /pgz-backups. 46 LVM - Logical Volume Manager woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Reduceer de pfz-data naar
100MB. Zorg dat alle data van /dev/sdd1 verplaatst wordt naar /dev/sdc1 en haal /dev/sdd1 uit de volume groep. Mount /pfz-data daarna opnieuw. 47 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Verwijder /pfz-data/pfz.dat en creeer
een eigen bestand pfz.info met daarin de text “Hello world” 48 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Voeg schijf /dev/sdb1 weer
toe aan de pfzdata volumegroep toe. Creeer een nieuwe volumegroep (pfzbackup) en hang daar schijf /dev/sdd1 aan. Maak logische volume pfz-backup (100% van de volumegroep), formateer als ext3 en mount op /pfz-backup. 49 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Maak een snapshot van
de pfz-data volume op LV pfz-snapshot (is ook 100MB groot). Mount op directory /pfz-snapshot. 50 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Tar de snapshot naar
/pfz-backups (tar cvzf /pfz-backup/backup-001.tgz /pfz-snapshot). Umount en verwijder de snapshot LV. 51 woensdag 25 april 12 -
http://joind.in/2370 LVM - Logical Volume Manager Verander de text in
/pfz-data/pfz.info bestand, maak een nieuwe snapshot en tar de snapshot opnieuw naar /pgz-backups. 52 woensdag 25 april 12 -
http://joind.in/2370 Oh crap, looks like we’re done • Tijd over?
Tips n’ tricks? Wat wil je nog weten? 53 woensdag 25 april 12