- DAS – Directly Attached Stprage
- SAN – Storage area Network
- NAS – Network Attached Storage
Category: Linux
Faster File Copy Using Tar and SSH
tar -cf – myfile | ssh target_host “cd /target_dir; tar -xf -“
ID kaardiga autentimine Apache2 veebiserveriga
- Eelduseks on juba toimiv SSL sait (HTTPS)
loo eraldi kataloog /etc/httpd/conf/id/
cd /etc/httpd/conf/id/
wget http://www.sk.ee/files/JUUR-SK.PEM.cer
wget http://www.sk.ee/files/ESTEID-SK.PEM.cer
wget http://www.sk.ee/files/ESTEID-SK%202007.PEM.cer
Pane kõik 3 juursertifikaati kokku ühte faili, et veebiserveril oleks lihtsam neid lugeda:
sudo cat JUUR-SK.PEM.cer ESTEID-SK.PEM.cer ESTEID-SK\ 2007.PEM.cer > juur.crt
Lae alla kehtetute sertifikaatide nimekiri:
wget http://www.sk.ee/crls/esteid/esteid.crl
wget http://www.sk.ee/crls/esteid/esteid2007.crl
wget http://www.sk.ee/crls/juur/crl.crl
Kuna allalaetavad tühistusnimekirjad on apache jaoks loetamatul kujul, siis on vaja need konverteerida PEM formaati:
openssl crl -in esteid.crl -out esteid.crl -inform DER
openssl crl -in esteid2007.crl -out esteid2007.crl -inform DER
openssl crl -in crl.crl -out crl.crl -inform DER
Apache dokumentatsioonis nõutakse ka räsi-linkide loomist. Genereerime need käsuga:
n="0";for f in `ls *.crl`;do ln -s $f `openssl crl -hash -noout -in $f`.r$n ;let n=n+1;done
Lisa apache konfiguratsioonifaili, SSL virtuaalsaidi osasse, read:
SSLCACertificateFile /etc/httpd/conf/id/juur.crt
SSLCARevocationPath /etc/httpd/conf/id/crl
Lisa SSL virtuaalsaidi sektsioonide juurde järgmine directory sektsioon:
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig Options
Order allow,deny
allow from all
Kataloogi, mida soovid kaitsta loo .htaccess. Juhul kui kogu virtuali soovid kaitsta, siis võib ka virtuali config faili lisada:
SSLVerifyClient require
SSLVerifyDepth 2
Kui nüüd kõik kenasti läks, siis apache restart
kui tahta, et server sertifikaatide andmed muutujatesse kannaks (et need oleks skriptides kasutatavad), võiks lisada .htaccess faili midagi sellist:
Files ~ "\.(cgi|shtml|php)$"\
SSLOptions +StdEnvVars +ExportCertData
Files
- http://id.ee/?id=10736
- http://wiki.itcollege.ee/index.php/ID_kaardiga_autentimine_Apache2_veebiserveriga
- http://www.colleduc.ee/id.html
memcache hints
[21:43:31 root@arendus drupal]# telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set margusja_nimi 0 0 8
Margusja
STORED
get margusja_nimi
VALUE margusja_nimi 0 8
Margusja
END
set margusja_vanus 0 0 2
37
STORED
get margusja_nimi
VALUE margusja_nimi 0 8
Margusja
END
get margusja_vanus
VALUE margusja_vanus 0 2
37
END
tcpdump hints
- tcpdump -s 65535 -i any port 11211 -w memcache.log
Shell scripting hints
Condition hints:
- -b file = True if the file exists and is block special file.
- -c file = True if the file exists and is character special file.
- -d file = True if the file exists and is a directory.
- -e file = True if the file exists.
- -f file = True if the file exists and is a regular file
- -g file = True if the file exists and the set-group-id bit is set.
- -k file = True if the files’ “sticky” bit is set.
- -L file = True if the file exists and is a symbolic link.
- -p file = True if the file exists and is a named pipe.
- -r file = True if the file exists and is readable.
- -s file = True if the file exists and its size is greater than zero.
- -s file = True if the file exists and is a socket.
- -t fd = True if the file descriptor is opened on a terminal.
- -u file = True if the file exists and its set-user-id bit is set.
- -w file = True if the file exists and is writable.
- -x file = True if the file exists and is executable.
- -O file = True if the file exists and is owned by the effective user id.
- -G file = True if the file exists and is owned by the effective group id. file1
- –nt file2 = True if file1 is newer, by modification date, than file2. file1 ot file2 = True if file1 is older than file2. file1 ef file2 = True if file1 and file2 have the same device and inode numbers.
- -z string = True if the length of the string is 0.
- -n string = True if the length of the string is non-zero.
- string1 = string2 = True if the strings are equal.
- string1 != string2 = True if the strings are not equal.
- !expr = True if the expr evaluates to false.
- expr1 –a expr2 = True if both expr1 and expr2 are true.
- expr1 –o expr2 = True is either expr1 or expr2 is true.
wget hints
- use wget as a crawler – wget -r -np -p -k http://www.example.com
screen hints
- Alusame uut sessiooni koos screeni nimetamisega – screen -S nimi
- olemasolevad sessioonid – screen -ls
- loobume olemasolevast aknast – CTRL+a+K
- suleme olemasoleva sessiooni – CTRL+a+d
- Kuvame listi olemasolevatest akentest akna alla ribale – CTRL+a+w
- Kuvame listi olemasolevatest akentest – CTRL+a+”
- Nimetame aktiivse akna – CTRL+a+A
- Aktiivse akna info – CTRL+a+i
Margusja testib
test sisu
—
Tervitades, Margus (Margusja) Roo
+372 51 48 780
http://margus.roo.ee
msn: margusja@kodila.ee
skype: margusja
A simple python webserver
[Thu Nov 04 22:24:04 margusja@IRack sudo python -m SimpleHTTPServer 80
Password:
Serving HTTP on 0.0.0.0 port 80 ...
192.168.1.67 - - [04/Nov/2010 22:26:50] "GET / HTTP/1.1" 200 -
192.168.1.67 - - [04/Nov/2010 22:26:51] code 404, message File not found
192.168.1.67 - - [04/Nov/2010 22:26:51] "GET /favicon.ico HTTP/1.1" 404 -
192.168.1.67 - - [04/Nov/2010 22:27:06] "GET /Pictures/ HTTP/1.1" 200 -
192.168.1.67 - - [04/Nov/2010 22:27:09] "GET /Pictures/1hacker.jpg HTTP/1.1" 200 -
192.168.1.67 - - [04/Nov/2010 22:28:13] "GET /Pictures/icon_defaultUser.png HTTP/1.1" 200 -
192.168.1.67 - - [04/Nov/2010 22:28:18] "GET /Pictures/IMG_0001.MOV HTTP/1.1" 200 -