git clone http://people.debian.org/~enrico/2008-09/launcher
There are two python scripts in it: index that
indexes your existing .desktop files in a Xapian
database, and query that contains a function to query
the index, and when run with the query keywords as parameters, it
shows the results. You give it a list of terms (and possibly of
currently selected categories), and it gives you:
$ ./query imag
Found: 55 /usr/share/applications/gqview.desktop
Found: 51 /usr/share/applications/gimp.desktop
Found: 48 /usr/share/applications/gpicview.desktop
Found: 46 /usr/share/applications/camorama.desktop
Found: 44 /usr/share/applications/inkscape.desktop
Found: 42 /usr/share/applications/geeqie.desktop
Completion: image
Completion: imagemagick
Completion: images
Tagcloud: 2DGraphics 0.661410884419
Tagcloud: Application 0.489939013302
Tagcloud: Core 0.331070153265
Tagcloud: GTK 0.158799073563
Tagcloud: Graphics 1.0
Tagcloud: Photography 0.426417355406
Tagcloud: RasterGraphics 0.661410884419
Tagcloud: Utility -0.3383614892
Tagcloud: VectorGraphics 0.213729717371
Tagcloud: Video 0.364913248472
Tagcloud: Viewer 0.806009703748
Spellchecked: image
$ ./query word proc
Found: 100 /usr/share/applications/ooo-writer.desktop
Found: 69 /usr/share/applications/efax-gtk.desktop
Completion: word processor
Completion: word processors
Tagcloud: GTK -0.255400677833
Tagcloud: Office 1.0
Spellchecked:
Spellchecked: doc
Now, it's just a matter of putting a GUI on top of it. I am not
going to do it: that is up to you.
A common way to debug a network server is to use 'telnet' or 'nc' to
connect to the server and issue some commands in the protocol to verify
whether everything is working correctly. That obviously only works for
ASCII protocols (as opposed to binary protocols), and it obviously also
only works if you're not using any encryption.
But that doesn't mean you can't test an encrypted protocol in a
similar way, thanks to openssl's s_client:
wouter@country:~$ openssl s_client -host samba.grep.be -port 443
CONNECTED(00000003)
depth=0 /C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
verify return:1
---
Certificate chain
0 s:/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
i:/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDXDCCAsWgAwIBAgIJAITRhiXp+37JMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNV
BAYTAkJFMRAwDgYDVQQIEwdBbnR3ZXJwMREwDwYDVQQHEwhNZWNoZWxlbjEUMBIG
A1UEChMLTml4U3lzIEJWQkExFDASBgNVBAMTC3N2bi5ncmVwLmJlMR0wGwYJKoZI
hvcNAQkBFg53b3V0ZXJAZ3JlcC5iZTAeFw0wNTA1MjEwOTMwMDFaFw0xNTA1MTkw
OTMwMDFaMH0xCzAJBgNVBAYTAkJFMRAwDgYDVQQIEwdBbnR3ZXJwMREwDwYDVQQH
EwhNZWNoZWxlbjEUMBIGA1UEChMLTml4U3lzIEJWQkExFDASBgNVBAMTC3N2bi5n
cmVwLmJlMR0wGwYJKoZIhvcNAQkBFg53b3V0ZXJAZ3JlcC5iZTCBnzANBgkqhkiG
9w0BAQEFAAOBjQAwgYkCgYEAsGTECq0VXyw09Zcg/OBijP1LALMh9InyU0Ebe2HH
NEQ605mfyjAENG8rKxrjOQyZzD25K5Oh56/F+clMNtKAfs6OuA2NygD1/y4w7Gcq
1kXhsM1MOIOBdtXAFi9s9i5ZATAgmDRIzuKZ6c2YJxJfyVbU+Pthr6L1SFftEdfb
L7MCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUtUK7aapBDaCoSFRWTf1wRauCmdowgbAG
A1UdIwSBqDCBpYAUtUK7aapBDaCoSFRWTf1wRauCmdqhgYGkfzB9MQswCQYDVQQG
EwJCRTEQMA4GA1UECBMHQW50d2VycDERMA8GA1UEBxMITWVjaGVsZW4xFDASBgNV
BAoTC05peFN5cyBCVkJBMRQwEgYDVQQDEwtzdm4uZ3JlcC5iZTEdMBsGCSqGSIb3
DQEJARYOd291dGVyQGdyZXAuYmWCCQCE0YYl6ft+yTAMBgNVHRMEBTADAQH/MA0G
CSqGSIb3DQEBBQUAA4GBADGkLc+CWWbfpBpY2+Pmknsz01CK8P5qCX3XBt4OtZLZ
NYKdrqleYq7r7H8PHJbTTiGOv9L56B84QPGwAzGxw/GzblrqR67iIo8e5reGbvXl
s1TFqKyvoXy9LJoGecMwjznAEulw9cYcFz+VuV5xnYPyJMLWk4Bo9WCVKGuAqVdw
-----END CERTIFICATE-----
subject=/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
issuer=/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=svn.grep.be/emailAddress=wouter@grep.be
---
No client certificate CA names sent
---
SSL handshake has read 1428 bytes and written 316 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: 65E69139622D06B9D284AEDFBFC1969FE14E826FAD01FB45E51F1020B4CEA42C
Session-ID-ctx:
Master-Key: 606553D558AF15491FEF6FD1A523E16D2E40A8A005A358DF9A756A21FC05DFAF2C9985ABE109DCD29DD5D77BE6BC5C4F
Key-Arg : None
Start Time: 1222001082
Timeout : 300 (sec)
Verify return code: 18 (self signed certificate)
---
HEAD / HTTP/1.1
Host: svn.grep.be
User-Agent: openssl s_client
Connection: close
HTTP/1.1 404 Not Found
Date: Sun, 21 Sep 2008 12:44:55 GMT
Server: Apache/2.2.3 (Debian) mod_auth_kerb/5.3 DAV/2 SVN/1.4.2 PHP/5.2.0-8+etch11 mod_ssl/2.2.3 OpenSSL/0.9.8c
Connection: close
Content-Type: text/html; charset=iso-8859-1
closed
wouter@country:~$
As you can see, we connect to an HTTPS server, get to see what the
server's certificate looks like, issue some commands, and the server
responds properly. It also works for (some) protocols who work in a
STARTTLS kind of way:
wouter@country:~$ openssl s_client -host samba.grep.be -port 587 -starttls smtp
CONNECTED(00000003)
depth=0 /C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
verify return:1
---
Certificate chain
0 s:/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
i:/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDBDCCAm2gAwIBAgIJAK53w+1YhWocMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
BAYTAkJFMRAwDgYDVQQIEwdBbnR3ZXJwMREwDwYDVQQHEwhNZWNoZWxlbjEUMBIG
A1UEChMLTml4U3lzIEJWQkExFjAUBgNVBAMTDXNhbWJhLmdyZXAuYmUwHhcNMDgw
OTIwMTYyMjI3WhcNMDkwOTIwMTYyMjI3WjBgMQswCQYDVQQGEwJCRTEQMA4GA1UE
CBMHQW50d2VycDERMA8GA1UEBxMITWVjaGVsZW4xFDASBgNVBAoTC05peFN5cyBC
VkJBMRYwFAYDVQQDEw1zYW1iYS5ncmVwLmJlMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQCee+Ibci3atTgoJqUU7cK13oD/E1IV2lKcvdviJBtr4rd1aRWfxcvD
PS00jRXGJ9AAM+EO2iuZv0Z5NFQkcF3Yia0yj6hvjQvlev1OWxaWuvWhRRLV/013
JL8cIrKYrlHqgHow60cgUt7kfSxq9kjkMTWLsGdqlE+Q7eelMN94tQIDAQABo4HF
MIHCMB0GA1UdDgQWBBT9N54b/zoiUNl2GnWYbDf6YeixgTCBkgYDVR0jBIGKMIGH
gBT9N54b/zoiUNl2GnWYbDf6YeixgaFkpGIwYDELMAkGA1UEBhMCQkUxEDAOBgNV
BAgTB0FudHdlcnAxETAPBgNVBAcTCE1lY2hlbGVuMRQwEgYDVQQKEwtOaXhTeXMg
QlZCQTEWMBQGA1UEAxMNc2FtYmEuZ3JlcC5iZYIJAK53w+1YhWocMAwGA1UdEwQF
MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAAnMdbAgLRJ3xWOBlqNjLDzGWAEzOJUHo
5R9ljMFPwt1WdjRy7L96ETdc0AquQsW31AJsDJDf+Ls4zka+++DrVWk4kCOC0FOO
40ar0WUfdOtuusdIFLDfHJgbzp0mBu125VBZ651Db99IX+0BuJLdtb8fz2LOOe8b
eN7obSZTguM=
-----END CERTIFICATE-----
subject=/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
issuer=/C=BE/ST=Antwerp/L=Mechelen/O=NixSys BVBA/CN=samba.grep.be
---
No client certificate CA names sent
---
SSL handshake has read 1707 bytes and written 351 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: 6D28368494A3879054143C7C6B926C9BDCDBA20F1E099BF4BA7E76FCF357FD55
Session-ID-ctx:
Master-Key: B246EA50357EAA6C335B50B67AE8CE41635EBCA6EFF7EFCE082225C4EFF5CFBB2E50C07D8320E0EFCBFABDCDF8A9A851
Key-Arg : None
Start Time: 1222000892
Timeout : 300 (sec)
Verify return code: 18 (self signed certificate)
---
250 HELP
quit
221 samba.grep.be closing connection
closed
wouter@country:~$
OpenSSL here connects to the server, issues a proper EHLO command,
does STARTTLS, and then gives me the same data as it did for the HTTPS
connection.
Isn't that nice.
$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAXSee the man pages for init(8), kill(1), and especially signal(7) for more info on this topic. Syndicated from Craig Sanders' Errata: Tech Notes and Miscellaneous Thoughts Introduction to Linux Signals 101
When I write text documents (using LaTeX or Docbook), I like to wrap lines, as it makes them easier to edit (less things moving on the screen), and allow to have easy-to-read diffs.
However, I always hesitate before rewrapping paragraphs (using vim’s gqap): this mean that I will add noise to my git history. So I only do that from time to time, making “rewrapping-only commits”. But that sucks, since in the meantime, I sometimes make a lot of changes, and my lines grow long again. Of course, I could rewrap my paragraphs before each commit, but if I simply add a word to a paragraph, it might cause all the lines to be rewrapped.
So I what I would need is some kind of “text normalizer” that will:
\begin tabular l l \hline x & y \\ 1 & 2 \\\hline \end tabularor
\begin figure \centerline \includegraphics fig \caption Cool stuff \label coolstuff \end figure(vim does rewrap those examples.)
I'm pleased my home state of Queensland (which bills itself as the Smart
State) has finally decided to start
fluoridating its water, a move the rest of the country made back in the
1960's and 1970's.
Hardly surprising I guess, when the No campaign for a referendum on daylight
saving involved a fear of the curtains
fading from that extra hour of sunlight...
I remember when I was little, my Mum used to give me fluoride tablets.
Dentists to this day, who have known I've grown up in Brisbane, have
remarked how they can tell by my teeth that I've had fluoride as a kid.
Apparently ones teeth are noticeably different (for the better) if fluoride
has been involved.
Today I got fed up of writing yet another GQueue and
idle function to perform tasks incrementally in the background, with all
of the bookkeeping that needs to be done. So, I wrote
taku_idle_queue_add.
Using it is simple, create a GQueue and then call
taku_idle_queue_add, passing the queue and a callback function.
When the queue has items in it, the callback gets called. Easy! Just
remember not to return FALSE from the callback unless you are
sure the queue will never be used again.
I'd appreciate anyone who knows GSource programming in detail to
review the
code. Maybe I should even try and get this into Glib?
NP: Cliqhop IDM, Soma.fm
Required? It just makes you suffer more. You know up front that they'll accuse you of ducking the question when they ask for a schedule and you give one contingent on specific preconditions. You know ahead of time that they'll change the specifications at the last minute. You no ahead of time that if you object to changes without revised budget and schedule that they'll say you're no a team player. You know ahead of time that they'll blame you even though they signed off on the schedule being contingent on no changes. You know ahead of time that there will be nothing that you can do about any of these. So what does your precognition buy you other than an ulcer or perhaps a coronary?
apt-get install openssh-server
Then you can login with:
$ ssh efossnet@proxy.dream.edu.et
To verify the host key fingerprint of a machine:
$ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
Note: you need to verify it before logging in!
More information at http://www.securityfocus.com/infocus/1806
Example ssh usages
To log in:
$ ssh efossnet@proxy
To run a command in the remote computer:
$ ssh efossnet@proxy "cat /etc/hosts"
To copy a file to the remote computer:
$ scp Desktop/july-18.tar.gz efossnet@proxy:
To copy a file from the remote computer:
$ scp efossnet@proxy:july-18.tar.gz /tmp/
Beware of brute-force login attempts
Warning about SSH: there are people who run automated scans for ssh servers and
try to login using commonly used easy passwords.
If you have an SSH server on the network, use strong passwords, or if you can
it's even better to disable password authentication: in
/etc/ssh/sshd_config, add:
PasswordAuthentication no
To log in using public/private keys:
ssh-keygen -t rsa
ssh-copy-id -i .ssh/id_rsa.pub efossnet@proxy
1153294204.912 887 192.168.0.200 TCP_MISS/503 1441 GET http://www.google.com.et/search? - NONE/- text/html
That "/503" is one of the HTTP error codes.
Explanation of the error codes:
apt-get install mailx
echo ciao mail efossnet@localhost
To configure a workstation not to do any mail delivery locally and send all
mail produced locally to smtp.dream.edu.et:
apt-get install squirrelmail (on a working apache
setup).
To setup mailing lists: apt-get install mailman, then follow the
instructions in /usr/share/doc.
Mail server issues we encountered
When a mail is sent to efossnet@localhost, the system tries to send it to
efossnet@yoseph.org
Investigation:
rm ~efossnet/.forward
Apache
To add a new website:
cd /etc/apache2/sites-availablesudo cp default coursesudo vi course:
ServerName directive with the address of your server:
ServerName course.dream.edu.et/usr/share/doc and you want to use a different document
root.sudo a2ensite coursesudo /etc/init.d/apache2 reloadu (in command mode)
Redo: ^R (in command mode)
You can undo and redo multiple times.
To recover a lost password for root or for the ubuntu admin user
Boot with a live CD, mount the system on the hard disk (the live CD usually
does it automatically), then edit the file /etc/shadow, removing the
password:
enrico:$1$3AJfasjJFHa234dfh230:13343:0:99999:7:::
becomes:
enrico::13343:0:99999:7:::
You can edit the file because, in the live CD system, you can always become
root.
After you do this, reboot the system: you can log in without password, and set
yourself a new password using the command passwd.
Installing packages not on the CDs
To get a package for installing when offline:
apt-get --print-uris install dnsmasqapt-get --download-only install dnsmasq will download the
package for you in /var/cache/apt/archives.
You can install various previously downloaded debian packages with:
dpkg -i *.deb
Backups
There are various ways:
dump (for ext2/ext3 file systems)
or xfsdump (for xfs file systems).
Makes a low-level dump of the file system.
It must be used for every different partition.
It makes the most exact backup possible, including inode numbers.
It can do full and incremental backups.
To see the type of the filesystems, use 'mount' with no parameters.
To restore: restore or xfsrestore.tar
Filesystem independent.
It can work accross partitions.
It correctly backups permissions and hard links.
It can do full and incremental backups.
Example:
tar lzcpf backup.tar.gz /home /var /etc /usr/local
tar lzcpf root.tar.gz /
To restore:
tar zxpf backup.tar.gz
faubackup
Filesystem independent.
Uses hard drive as backup storage.
Always incremental.
It cannot do compression.
Unchanged files in new backups are just links to old backups, and do not
occupy space.
Any old backup can be deleted at any time without compromising the others.
It can be used to provided a "yesterday's files" service to users (both
locally and exported as a read-only samba share...).
To restore, just copy the files from the backup area.amanda
apt-get install amanda-client amanda-server
It is a network backup system.
It can do full and incremental backups.
You can have a backup server which handles the storage and various backup
clients that send the files to backup to the server.
It takes some studying to set up.
To restore: it has its own tool.dpkg --get-selections > pkglist
debconf-get-selections > pkgconfig
To restore:
dpkg --set-selections < list
debconf-set-selections < pkgconfig
apt-get dselect-upgrade
If you do this, they you only need to backup /etc, /home,
/usr/local, /var.mysqldump name-of-database gzip > name-of-database.dump.gz
To restore:
zcat name-of-database.dump.gz mysql
crontab -e
As root: add a file in one of the /etc/cron.* directories.
In cron. hourly,daily,weekly,monthly you put scripts.
In the other directories you put crontab files (man 5 crontab).
If the system is turned off during normal maintainance hours, you can do two
things:
$ at 17:40
echo "Please tell Enrico that the lesson is finished" mail efossnet@dream.edu.et
^D
When and how to automate
rkhunter, chkrootkitchecksecuritydebsecantiger^C: interrupt (sends SIGTERM)^\: interrupt (send SIGQUIT)^D: end of input^S: stop scrolling^Q: resume scrolling^Q.
Problems we had today with postfix
efossnet@dream.edu.et is accepted only if sent locally.
Reason:
$ host -t mx dream.edu.et
Host dream.edu.et not found: 3(NXDOMAIN)
Solution: tell dnsmasq to handle a MX record also for dream.edu.et:
mx-host=dream.edu.et,smtp.dream.edu.et,50apt-get --print-uris doesn't print the URIs if the package is in the
local cache, and there seems to be no way to have it do it./etc/apache2/sites-available/default, is the NameVirtualHost *
directive appropriate there? It gets in the way when using 'default' as a
template for new sites.
Otherwise, one can add a new (disabled) site that can be used as a template
for new sites instead of default.crontab -e are not that easy to read.apt-get install openssh-serverThen you can login with:
$ ssh efossnet@proxy.dream.edu.etTo verify the host key fingerprint of a machine:
$ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pubNote: you need to verify it before logging in! More information at http://www.securityfocus.com/infocus/1806 Example ssh usages:
Warning about SSH: there are people who run automated scans for ssh servers and try to login using commonly used easy passwords. If you have an SSH server on the network, use strong passwords, or if you can it's even better to disable password authentication: in /etc/ssh/sshd_config, add:
To log in:
$ ssh efossnet@proxyTo run a command in the remote computer:
$ ssh efossnet@proxy "cat /etc/hosts"To copy a file to the remote computer:
$ scp Desktop/july-18.tar.gz efossnet@proxy:To copy a file from the remote computer:
$ scp efossnet@proxy:july-18.tar.gz /tmp/
PasswordAuthentication noTo log in using public/private keys:
If you use ssh often, read these:
Create your key:
ssh-keygen -t rsaCopy your public key to the machine where you want to log in:
ssh-copy-id -i .ssh/id_rsa.pub efossnet@proxyNow you can ssh using your RSA key
ssl does not work. Reason: squid tries to directly connect to the ssl server, but the AAU network wants us to go through their proxy. Ideal solution: none. There is no way to tell squid to use a parent proxy for SSL connections. Solution: update the documentation for the Dream university users telling to setup a different proxy for SSL connections. Longer term solution: get the AAU network admins to enable outgoing SSL connections from the Dream university proxy. Other things that can be done:
- report a bug on squid reporting the need and requesting the feature
- download squid source code and implement the feature ourselves, then submit the patch to the squid people
Browsing normal pages returns an error of 'Connection refused'. In the logs, the line is:
1153294204.912 887 192.168.0.200 TCP_MISS/503 1441 GET http://www.google.com.et/search? - NONE/- text/htmlThat "/503" is one of the HTTP error codes. Explanation of the error codes:Reason: the other proxy is refusing connections from our proxy. Solution: none so far. Will need to get in touch with the admins of the other proxy to try to find out why it refuses connection to our proxy, and how we can fix the problem.
Quick way to send test mails:
- The mail name is the name of the mail server you're setting up (TODO: need more details on what's it used for)
- The smarthost is the name of the mail server that will relay mail for you.
apt-get install mailx echo ciao mail efossnet@localhostTo configure a workstation not to do any mail delivery locally and send all mail produced locally to smtp.dream.edu.et:
To setup a webmail: apt-get install squirrelmail (on a working apache setup). To setup mailing lists: apt-get install mailman, then follow the instructions in /usr/share/doc. Mail server issues we encountered:
- install postfix choosing "Satellite system"
- put smtp.dream.edu.et as a smarthost.
When a mail is sent to efossnet@localhost, the system tries to send it to efossnet@yoseph.org
Cause: the user efossnet had forgotten that he or she had setup a .forward file in the home directory. Solution:
- Investigation:
- "yoseph.org" does not appear anywhere in /etc or /var/spool/postfix
- postfix configuration has been reloaded
- postfix logs show that the mail has been 'forwarded'
rm ~efossnet/.forward
cd /etc/apache2/sites-available
sudo cp default course
sudo vi course:
Remove the first line
Add a ServerName directive with the address of your server:
ServerName course.dream.edu.etCustomize the rest as needed: you at least want to remove the support for browsing /usr/share/doc and you want to use a different document root.
sudo a2ensite course
sudo /etc/init.d/apache2 reload
enrico:$1$3AJfasjJFHa234dfh230:13343:0:99999:7:::becomes:
enrico::13343:0:99999:7:::You can edit the file because, in the live CD system, you can always become root. After you do this, reboot the system: you can log in without password, and set yourself a new password using the command passwd.
Otherwise, apt-get --download-only install dnsmasq will download the package for you in /var/cache/apt/archives. You can install various previously downloaded debian packages with:
- apt-get --print-uris install dnsmasq
- Manually download the packages at the URLs that it gives you
dpkg -i *.deb
Some data requires exporting before backing it up:
dump (for ext2/ext3 file systems) or xfsdump (for xfs file systems). Makes a low-level dump of the file system. It must be used for every different partition. It makes the most exact backup possible, including inode numbers. It can do full and incremental backups. To see the type of the filesystems, use 'mount' with no parameters. To restore: restore or xfsrestore.
tar Filesystem independent. It can work accross partitions. It correctly backups permissions and hard links. It can do full and incremental backups. Example:
tar lzcpf backup.tar.gz /home /var /etc /usr/local tar lzcpf root.tar.gz /To restore:tar zxpf backup.tar.gzfaubackup Filesystem independent. Uses hard drive as backup storage. Always incremental. It cannot do compression. Unchanged files in new backups are just links to old backups, and do not occupy space. Any old backup can be deleted at any time without compromising the others. It can be used to provided a "yesterday's files" service to users (both locally and exported as a read-only samba share...). To restore, just copy the files from the backup area.
amanda apt-get install amanda-client amanda-server It is a network backup system. It can do full and incremental backups. You can have a backup server which handles the storage and various backup clients that send the files to backup to the server. It takes some studying to set up. To restore: it has its own tool.
You can schedule these dumps to be made one hour before the time you make backups.
To save the list of installed packages and the answer to configuration questions:
dpkg --get-selections > pkglist debconf-get-selections > pkgconfigTo restore:dpkg --set-selections < list debconf-set-selections < pkgconfig apt-get dselect-upgradeIf you do this, they you only need to backup /etc, /home, /usr/local, /var.To save the contents of a MySQL database:
mysqldump name-of-database gzip > name-of-database.dump.gzTo restore:zcat name-of-database.dump.gz mysql
crontab -eAs root: add a file in one of the /etc/cron.* directories. In cron. hourly,daily,weekly,monthly you put scripts. In the other directories you put crontab files (man 5 crontab). If the system is turned off during normal maintainance hours, you can do two things:
For scheduling one-shot tasks, use at(1):
- Change /etc/crontab to use different maintanance hours
- Install anacron (it's installed by default in ubuntu)
$ at 17:40 echo "Please tell Enrico that the lesson is finished" mail efossnet@dream.edu.et ^D
Start at step 1 and go to 2 or 3 if/when you actually need it. (credits to sto@debian.org: he's the one from which I heard it for the first time, said so well).
- First, you manage to do it yourself
- Then, you document it
- Then, you automate it
- rkhunter, chkrootkit
- checksecurity
- debsecan
- tiger
Therefore, if the terminal looks like it got stuck, try hitting ^Q.
- ^C: interrupt (sends SIGTERM)
- ^\: interrupt (send SIGQUIT)
- ^D: end of input
- ^S: stop scrolling
- ^Q: resume scrolling
Problems found yesterday and today:
Problem: mail to efossnet@dream.edu.et is accepted only if sent locally. Reason:
$ host -t mx dream.edu.et Host dream.edu.et not found: 3(NXDOMAIN)Solution: tell dnsmasq to handle a MX record also for dream.edu.et:mx-host=dream.edu.et,smtp.dream.edu.et,50The problem not solved with the previous solution. Reason: postfix was making complaints which mentioned localhost as a domain name. Solution: fixed by changing 'myhostname' in main.cf to something different than localhost. Note: solved by luck. Investigate why this happened.
there is no way to tell squid to use another proxy for SSL connections: it only does them directly
if you want to configure evolution to get mail from /var/mail/user, you need to explicitly enter the path. It would be trivially easier if evolution presented a good default, since it's easy to compute. It would also be useful if below the "Path" entry there were some text telling what path is being requested: the mail spool? the evolution mail storage?
In Evolution: IMAP or IMAPv4r1? What is the difference? Why should I care?
apt-get --print-uris doesn't print the URIs if the package is in the local cache, and there seems to be no way to have it do it.
in /etc/apache2/sites-available/default, is the NameVirtualHost * directive appropriate there? It gets in the way when using 'default' as a template for new sites. Otherwise, one can add a new (disabled) site that can be used as a template for new sites instead of default.
the default comments put by crontab -e are not that easy to read.
apt-get install samba samba-doc smbclientTo get the Samba Web Administration Tool:
apt-get install swat netkit-inetdThe configuration is in /etc/samba:
One could use swat at http://localhost:901/ but it does not work easily on Ubuntu. To see what is shared:
- One [global] section with the general settings
- One section per share
smbclient -L localhostTo access a share:
smbclient //localhost/name-of-the-shareTo add a new user:
sudo smbpasswd -a usernameTo change the password of a user:
sudo smbpasswd usernameTo test accessing a share as a user:
smbclient //localhost/web -U yaredDocumentation:
man smb.confTo force the user or group used to access a share:
force user = enrico force group = www-dataTo set the unix permissions for every created file:
# For files create mask = 0664 # For directories directory mask = 0775Example share configuration for a webspace:
mkdir /var/www/public chgrp www-data /var/www/public chmod 0775 /var/www/publicThen, in /etc/samba/smb.conf:
[web] comment = Webspace path = /var/www writable = yes public = no force group = www-data create mask = 0664 directory mask = 0775Example share configuration for a read only directory where only a limited group of people can write:
[documents] comment = Documents path = /home/enrico/Desktop/documents force user = enrico public = yes writable = no write list = enrico, yared
apt-get install cupsysConfiguration:
Example IPP URIs:
On the web (not enabled in Ubuntu):
http://localhost:631/On the desktop:
System/Administration/Printing
ipp://server[:port]/printers/queue http://server:631/printers/queue ipp://server[:port]/...For example:
ipp://server/printers/laserjet"This printer uri scheme can be used to contact local or remote print services to address a particular queue on the named host in the uri. The "ipp" uri scheme is specified in the Internet Print Protocol specifications and is actually much more free form that listed above. All Solaris and CUPS based print queues will be accessed using the formats listed above. Access to print queues on other IPP based print servers requires use of the server supported ipp uri format. Generally, it will be one of the formats listed above."
apt-get install ldap-utils slapdThe configuration is in /etc/ldap. To access a ldap server:
apt-get install gqVarious LDAP HOWTOs:
- http://bachue.com/svnwiki/ldap-intro
- http://minkirri.apana.org.au/~abo/projects/ldap-auth/LdapAuthentication.txt
- http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html
- http://www.mami.net/univr/tng-ldap/howto/
- http://www.ofb.net/~jheiss/krbldap/howto.html
- http://bachue.com/svnwiki/linux%20ldap%20howto
Grub trick to have a memory checker:
- arrows
- move around
- enter
- enters a section
- l
- goes back
- u
- goes up one node
- q
- quit
- /
- search
apt-get install memtest86+
Add this to /boot/grub/menu.lst:
title Memory test root (hd0,5) kernel /boot/memtest86+.bin
man iptables # Only allow in input the network packets # that are going to the web server iptables -P INPUT DROP iptables -A INPUT --protocol tcp --destination port 80 -j ACCEPT # To reset the input chain as the default iptables -F INPUT iptables -P INPUT ACCEPTSome links:
- http://www.linuxguruz.com/iptables/howto/iptables-HOWTO.html
- NAT = Network Address Translation http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO.html
apt-get install squidThe configuration is in /etc/squid/squid.conf. To allow the local network to use the proxy:
# Add this before "http_access deny all" acl our_networks src 10.4.15.0/24 http_access allow our_networksTo use a parent proxy:
cache_peer proxy.aau.edu.et parent 8080 0 proxy-only no-queryPay attention because /var/spool/squid will grow as the cache is used. The maximum cache size is set in the directive cache_dir. Information about squid access control is at http://www.squid-cache.org/Doc/FAQ/FAQ-10.html To check that the configuration has no syntactic errors: squid -k parse. To match urls:
acl forbiddensites url_regex [-i] regexpFor info about regular expressions:
man regexExample filtering by regular expression:
acl skype url_regex -i [^A-Za-z]skype[^A-Za-z] http_access deny skypeTransparent proxy setup: http://www.tldp.org/HOWTO/TransparentProxy.html
- swat does not run on Ubuntu because Ubuntu does not have inetd
- swat does not allow root login on Ubuntu because root does not have a password
- smbpasswd -a does not seem to update the timestamp of /var/lib/samba/passwd.tdb
- cups web admin does not work on Ubuntu
- LDAP is still not so intuitive to set up
Next.