Search Results: "Enrico Zini"

19 September 2006

Jos Parrella: BSP Venezuela: Afterparty

Last saturday around 2100 (UTC-0400) some people started joining the #debian-ve IRC channel at OFTC, in order to participate on the very first Venezuelan Bugsquashing Party. We had a lot of people interested not only in squashing but also developing for Debian and other topics. Some DD’s were around, specially An bal Monsalve Salazar (anibal) who has been very helpful on testing and uploading packages. Both me and Jos Luis Rivas (ghostbar) made a couple of NMU’s (in his case, xfe and divine; in mine, sdr and orca), fixing six RC bugs. Jos Luis is like 17 or 18 years old and has proven to be a very energetic Debian collaborator. Other maintainers from Debian Venezuela (actually, we’re eleven persons as of last week) were around but couldn’t make a NMU at the time of the event. Others weren’t even present. It was a very small BSP indeed, but we learned lots of things and hopefully our work will help improving the quality in Debian a little bit. It also settles our desires as a group to improve our knowledge and work together to improve the Project without disrupting the overall ecosystem. By the way, the Venezuelan Debconf is definitely going to happen between October 17th. and 21st. Hopefully we’ll have Benjamin Mako Hill, Enrico Zini, Alvaro Lopez Ortega (OMG! Cherokee!) and Randal Schwartz sharing a nice time with people from all parts of Venezuela and the rest of South America. Some local Debian maintainers will set up some nice workshops and demonstrations, ranging from Xen and LTSP in Debian to QA and the local GNU/Linux distribution projects. This local Debconf is part of a larger event, the World Forum on Free Knowledge, which some people at Debian Venezuela help to make. Returning to the BSP topic, I was looking out at a couple of bugs out there, but I lack the hardware and the experience to handle them. One of this is #333915 and other orca bugs, and other one is #385078 regarding a Debconf script in xserver-xorg. The morning before the BTS I was testing the MBONE tools with a friend of mine, and we were quite unhappy by the fact that sdr was almost unusable (passing the mouse cursor over some buttons resulted in annoying notices). So, if you use sdr, please test the last NMU I sent, which fixes two bugs. Just for reference, the webpage where I keep my Debian-related work is here. The case where I learned most was #386938, regarding xserver’s FTBFS in s390. Events like BSP are a great way to motivate people to participate in the Project: while trying to learn anything about this bug I ended reading documentation from IBM, asking advice from someone with an S/390, sending a couple of emails to debian-s390@lists.d.o, browsing at a DD patch in upstream, looking at buildd logs, searching the Web for opcodes lists… usually trying to explain how all this pieces join in a sane way (most times; well, some times, well, seldomly) is quite difficult for someone who tries to promote Debian, but technical events like the BSP provide a really accurate way to see how things work in and around Debian.

10 September 2006

Petr Rockai: weekend with family

So i have travelled to Slovakia again, for a weekend this time. I have been painting window frames. Since i have a new iPod (4G nano, black, yummy), i could also listen to music (Tristania, In Flames, Kamelot). The last time, it was somewhat of a patience exercise, but this time... I guess i got better at painting and maybe i have become more patient, too :). It was pretty enjoyable, more than i would have thought a work like that could be. And i am sure the music helps, too. (The next day) And to continue the last blog... There, i have concluded that hardship was important factor in becoming better: And apart from hardship... Problem is, hardship alone, if it stays the same, is not enough to make people change. It is the change from contentment to unhappiness, that drives people forward. Because in that change, one starts to change, and hardship together with dynamics helps a lot. Static, unchanging hardship will only do little to change a person. One can get used to it, like to anything else. Like to contentment. So an initial change can start a cascade. Like for me, breakup caused a domino effect. The change alone brought a lot of hardship with it, and i had to change to accomodate to it. And the change in me provoked more changes and so on. I have learned many new things, or, things i have learned before but went unnoticed took my notice. And in light of such things, i had to change again, because i knew i couldn't be happy any other way. A human being is as good as dead, when captured in a period of stagnation, in an unchanging moment that lasts. Only through change, through dynamics of life, we are alive. A man that does not change is a statue, a dead piece of matter, only useful as a memento. And that was what i have become, and now the statue is again starting to move, to breathe, to live. Because there is just no perfection that one could capture in a moment. No matter how perfect a moment, if frozen, the perfection decays, the little cracks are noticed. That is why trying to freeze time is futile, trying to preserve. One cannot enter the same stream twice. Life is a constant change, and this constant change is its only manifestation. Take the change away and you take the life away. The past is important. The past is what resulted into present, and present is what makes future. Every moment, in a succession of moments, is important. But without the moment before and the moment after, the moment does not mean anything. The moment is void, without predecessor and successor. We move in time, and the motion is what becomes important, not the points we moved through. They are only important in the relation to our trajectory, not in isolation. And so is the direction which we take, the vector of our motion, and the shifts in direction. There is no eternity, only the eternity of its own absence. Immortality and death are the same, the very same notion. Because every time we change, there is a little death and a little birth. And immortality is only possible in staticness. Immortality is a point in time, without motion. And without motion, there is no life to be. And same goes for relationships. Make a relationship immortal and you make it die. Relationship needs a possibility of death to live. Like humans, like every living being. Without death, there is no life. The transition from being into non-being is essential, because it is the precondition to change. As i have already described, every change is a death followed by rebirth, but the entity reborn is not the one that has died. And therefore, without the ability to die, there is no ability to change. And death, the conventional death, as we know it, is just a death without rebirth. Something dies, and there is nothing more to take its place. But... The death makes others change. And therefore, the one who dies definitively, is again reborn, as part of those others that have died, but haven't died, but are reborn. And the one definitely dead enters those new, reborn creatures, as a little fraction of them. And the cycle of life is closed, and the change can perpetuate itself. Every day, i die a thousand times. But there are deaths that are important and deaths that go unnoticed. And most of the important ones are only noticed in retrospect, by a being that resulted, after many hours, or days, or weeks or even longer. And many more deaths. We only exist through our succession, because only what is born from us remembers what we were. And the very moment we are born, we die again, and a new being remembers. The memory lives on, but the beings are already dead. And the memory changes as well, because memory itself does not mean anything, only the being possesing it can give it meaning. And every successive being that we become gives it a slightly different meaning. And so the delicate, complex dynamics of individual life are established. Not only the living being changes itself, but the memories of the previous beings change. There is certain gravity toward stagnation, because often the changes are only very slight, and the being remembers his predecessors that were fairly happy and tries to remain so. Because the bigger the change, the bigger risk. And therefore all beings are susceptible to stagnation, to the stasis cell of past success. Because past success is one's own enemy, even if it is something that is a precondition to one's own being. So we need to learn to live with our past success, but to not try to revive it. The effort to bring back past is a wasted, contraproductive effort. It seems so, it is almost natural, that if there was happiness in the past, restoring the same past will bring the same happiness. But there, that is not true, in the light of previous paragraphs. The trap is so obvious, that description is probably redundant, but let me do it once again anyway, maybe because i have fallen in it so many times already. Yes, the trap is in the stagnation, in absence of new things. Because even if one cannot restore the original condition no matter how much he tries, one can, and that is for sure, replicate it very closely. And that way lies a trap, a temporary (or even permanent) thermal death of stagnation. (Later that day, outside, on a nearby hill) And now, like before, there's nothing more to stand between me and myself. I sit in the grass, alone. My being alone complements me, in a way. There are waves in the grass, as air moves. Music is playing, apart from the few houses i can see downhill, my only connection with the rest of people. And this what belongs to me, this paper, this pen. This book by Italo Calvino that Enrico Zini has given me. If on a winter's night a traveller. But it is late summer. I can see vineyard in distance, on a slope different from mine. I call this slope mine because i am the one sitting there. And the time to collect the grapes is close. And here, next to me, an apple tree, with red apples on it. And a white butterfly in the distance, beating the air with its light, small wings. And i blow away a tiny spider who has lost its way on my trousers. I feel being part of all this around me, and still so foreign. And the butterfly appears again, but it may be a different one. The sun shines behind my back, alhtough i sit in shade of a tree. And neither the sun nor the tree are my enemies, or my friends. But still, i feel sympathy for both of them, one gives me light and warmth and the other shields me from too much of it. And the setting, the scenery soothes my senses, my mind, my feelings. Here, i am close to the loving mother of us, living beings, the nature. Here she is tender and forgiving and caresses my hair and it feels good. And these feelings, i would love to pass on, to other people, so they, too, could feel well. But i see that this is not quite possible. Although these lines will hopefully give something to someone, they probably can't carry what i feel. And i would bring someone with myself here, so they could feel it with me. But presence of other person would spoil it, it would be something else then. Maybe beautiful in a way, different from this one, maybe very pleasant. I love people, and when i see them happy, it fills me with gladness. (And in the evening, on a train...) And here i am, moving with speed, from one place to another. The speed, sound of loud music in my ears, the landscape drifting away. I could say i was happy, happy in the sense of change, everything changing around me, sun setting behind distant horizon, the train moving through the country. The semaphore lights. In the headphones, heavy guitar riffs competing with the roaring of the train. Cold air blowing in my face, flowing in my hair. And now in another train, sitting in a compartment with stranger, a girl, trying to guess who she could be, from her dress, from what she is reading, from cues. Who she could become. What she means to me, a passing stranger on the path of life. I have been reading the Calvino book till now, but i thought i could write down my thoughts before they perish, like they do. It is fairly silent now here, even while we are on a train. The engine and the outside are muffled, the window and the door are closed. We are in a strange kind of privacy with this girl, neither knowing anything about the other. I, writing this text here, she reading some sort of magazine. Looking up from what we do at occasions. The train is accelerating now, and the sounds are more intense. It is a bit shaky, too. My hearing is still lightly impaired from the loud music from the previous train. We arrived to a station. Short stop, then another long motion. Always toward Brno, toward my flat, toward the night and tomorrow. The girl is reading a horse races program. Here, i intrude her privacy and write that here. I hope she wouldn't mind. I don't have a name other than "the girl" for her, since all the words we exchanged was me asking whether i can sit down in the compartment and her answer. And i suppose i won't say anything and she won't, neither. Maybe a goodbye. And now, we share a sort of almost intimacy. Two lone people in a compartment, tired and waiting to arrive somewhere. An invisible bond between us, doesn't mean anything, just that element at random brought us there together, for a short moment. Chances are, we won't ever meet again. And still, she is almost falling asleep, with her feet up, like if i were a trustworthy friend of old. And i feel sympathy for that, i feel honoured by a trust given by a complete stranger. She seems comfortable, feeling safe. And it feels good to have that trust, it feels important. It nearly gives warm fuzzies. (To be continued, further...)

3 September 2006

Enrico Zini: article-on-linux-com

DCG mentioned on Linux.com A friend of mine pointed me to the Debian Community Guidelines being mentioned in a linux.com article. "[Mako] hopes that Garrett's resignation will give the Debian community an added impetus to adapt its own code of conduct, like the one proposed by Enrico Zini." I'm very happy to see the DCG geting mentioned, although I don't think that it makes sense to 'adopt' such a document. what I'd like for it is to be mentioned as a suggested read, and linked from here and there. So today it happened, and I'm happy :)

29 August 2006

Enrico Zini: random-thoughts

Random thoughts Model Builder How are you tonight?
  1. What are the packages?
< mrvn> Sesse: cvs help commit You know you definitely are bored when you set up your own newsgroup with a hammer Bringing about the intention: which future? Should a DPL have a moustache? Brilliant. ...the solution to all problems. the point is that from Redhat Linux NT you need to forward to a GUI in order to mount a microprocessor it's about time Kindly start doing something useful and quit ignoring the policy, please let's be reasonable. Let's not drag this into another flame war!

26 August 2006

Enrico Zini: evaluating-languages

Evaluating programming languages for playing with Debtags Since having workable bindings for the C++ Debtags libraries seems to be still a bit in the future, I'm planning to build a bit of native infrastructure in some higher level language. First step is seeing what language I could start playing with. The problem At the most basic level, in Debtags we have a number of packages, each of which have a set of tags. The way I usually save tags is a file with the format:
package1, package2: tag1, tag2, tag3
package3: tag1, tag2
That is, every line has a list of packages with the same tags, and the list of their tags. Since any script I'm going to write has to at least be able to parse the data into something like a package -> tags hash, then print it out. Let's see how perl, python and ruby perform. Tests C++ The reference point for the experiment will be the C++ implementation, tagcoll:
$ time tagcoll copy package-tags > /dev/null
real    0m0.421s
user    0m0.412s
sys     0m0.000s
Perl First attempt is with Perl, creating the script that parses into a hash of package => set of tags and prints the result. There are set modules for Perl on CPAN, but I have none handy at the moment. However, since they are implemented using hashes, I can approximate them by using a hash. Note that I also want to have a different copy of the tag set for every package, so that I can manipulate them in the future without unwanted side effects. Here is the code:
#!/usr/bin/perl -w
use strict;
my %db;
# Read the tag database
while (<>)
 
    chop();
    my ($pkgs, $tags) = split(': ');
    # Create the tagset using keys of a hash
    my %tags = map   $_ => undef   split(', ', $tags);
    for my $p (split(', ', $pkgs))
     
        # Make a copy of the tagset
        $db $p  =  %tags ;
     
 
# Write the tag database
while (my ($pkg, $tags) = each %db)
 
    print $pkg, join(', ', keys %$tags), "\n";
 
Here is the running time:
$ time ./parse.pl package-tags > /dev/null
real    0m0.448s
user    0m0.436s
sys     0m0.008s
Not so bad, comparable with tagcoll. Python Then comes Python. I'm not much of a Python fancier, but I'm rather attracted by the new set native type introduced with Python 2.4, which seems to have most of what I need nice and done. Here is the script:
#!/usr/bin/python
import sys
input = sys.stdin
if len(sys.argv) > 1:
    input = open(sys.argv[1],"r")
# Read the tag database
db =  
for line in input:
    # Is there a way to remove the last character of a line that does not
    # make a copy of the entire line?
    line = line.rstrip("\n")
    pkgs, tags = line.split(": ")
    # Create the tag set using the native set
    tags = set(tags.split(", "))
    for p in pkgs.split(", "):
        db[p] = tags.copy()
# Write the tag database
for pkg, tags in db.items():
    # Using % here seems awkward to me, but if I use calls to
    # sys.stdout.write it becomes a bit slower
    print "%s:" % (pkg), ", ".join(tags)
Here is the running time:
$ time ./parse.py  package-tags  > /dev/null
real    0m0.418s
user    0m0.376s
sys     0m0.036s
I'm pleased, very pleased. Using the native set seems to be not only handy, but efficient. Ruby Finally, Ruby. I like to use Ruby. In this case, however, it lacks a native set implementation, although it has a set module which is implemented using a hash. Here is the script:
#!/usr/bin/ruby
require 'set'
infile = ARGV[0] ? File.new(ARGV[0]) : $stdin
# Read the tag database
db =  
infile.each_line do  line 
    line.chop()
    pkgs, tags = line.split(": ")
    # Create the set using the Set module
    tags = Set.new(tags.split(", "))
    pkgs.split(", ").each do  p 
        # Is this a copy or a reference?  I need to find out.
        db[p] = tags
    end
end
# Write the tag database
db.each do  key, tags 
    # Ouch, Set does not do join by itself
    print key, ": ", tags.to_a.join(", ")
end
Here is the running time:
$ time ./parse.rb package-tags > /dev/null
real    0m1.637s
user    0m1.572s
sys     0m0.052s
I hope I got something wrong in the script, but I can't see what. Results As much as I don't fancy Python, it looks like it's currently the best choice for playing around with Debtags. I hope the native sets will bring me joy. If in the future I'll be asked "how come you chose Python for this Debtags thing?", I can point to this page.

25 August 2006

Enrico Zini: tagging-intro-notes

Introductory notes about tagging A group of nice Swiss researchers are doing some research on Debian, and as part of their research they are about to tag around 400 libraries using Debtags. They feel that being able to distinguish projects by categories will help us to improve their analysis of component (library) reuse. They asked me if I had useful Debtags information for them besides the website and the Debconf5 paper, so I did some research and I share it here. The list archives have various useful posts: Also, the vocabulary itself has short and long comments for each tag, and the long comments sometimes have useful instructions. In order to contribute properly reviewed tags, I suggested to start by posting tag patches on the mailing list: after we discussed some of them and we trust each others, I'll be happy to give commit access to the svn repository. To create a tag patch, one can use tagcoll:
svn cat svn://svn.debian.org/debtags/tagdb/tags > tags
cp tags tags.edited
[...edit tags.edited...]
tagcoll diff tags tags.edited
Note that there are probably many new tags in the not-yet-revied database, so one may want to proceed this way:
  1. svn cat svn://svn.debian.org/debtags/tagdb/tags > tags
  2. remove from tags all the lines corresponding to the packages you're not interested in
  3. wget http://debtags.alioth.debian.org/tags/tags-current.gz
  4. remove from tags-current all the lines corresponding to the packages you're not interested in
  5. tagcoll diff tags tags-current > changes
  6. edit changes removing those changes that make no sense you can review the edits you made to the changes patch this way: svn cat svn://svn.debian.org/debtags/tagdb/tags tagcoll --patch-from=changes.orig > tmp1 svn cat svn://svn.debian.org/debtags/tagdb/tags tagcoll --patch-from=changes.edited > tmp2 tagcoll diff tmp1 tmp2
  7. apply the reviewed patch to the svn repository: svn cat svn://svn.debian.org/debtags/tagdb/tags tagcoll --patch-from=changes copy > tags-patched
  8. work from there
Everyone is of course free to use the list for any questions.

23 August 2006

Erich Schubert: Stepping beyond tag clouds

Tag clouds [en.wikipedia.org] are a current must-have for web 2.0 applications. Examples can be found for bookmarks, blog entries, photos, music or books. Tag clouds are hip, because they're a dynamic feature and show the "Zeitgeist" [wikipedia]. They given an overview on the users ("California" in flickr) or on current hot topics ("Israel", "Lebanon" in technorati). However, tag clouds also have severe limitations. First of all, they're arbitrarily ordered. Usually alphabetic, so there is no content relationship among the entires. Secondly, they only show an excerpt, since there are usually much more tags than fit on the screen. Thirdly, they're atomic information, whereas relations as used e.g. in RDF [wikipedia] can convey much more complex information. I'm trying to push tag clouds to a next level. They're a gimmick right now, but maybe we can make them to a powerful navigation tool? Together with Enrico Zini I've just created my first tag cloud (I've skipped making a tag cloud for my blog...). Well, it quickly evolved beyond a tag cloud. You could maybe call it a tag sky. Or tag forest. I'm not using my blog or something like this for the tag cloud. That would be quite boring, I'm not doing real tagging on it. Instead I'm using software tags. The Debtags project, led by Enrico and I, has been working on software tags for some years now during our spare time. We have about 600 tags in a dozen of facets, and 15000 software packages (I don't have the number ready how many of that are somewhat tagged already). Well, the tagging efforts are still far from complete, thats why we're currently working on an AI to assist tagging efforts, too. We generated two different renderings of the tag clouds for you: one separated cloud per facet, and all folded into one big cloud. Oh, and actually click on one of the tags, it will take you to a more complex tag-based navigation tool and a tagger. So what makes these different from the usual tag clouds you see everywhere (apart from the sheer size, sorry about that. Maybe we'll add buttons next to hide/show tags with low occurrence numbers)? Well, the tags next to each other aren't completely unrelated any more, since they are (in both renderings) grouped by their facet. This makes it easier to locate something - go through the red facets first, then look at the tags in the group. I'm thinking about a second step, which would involve dynamic expanding details in the tag cloud, or hiding them, finally transforming the tag cloud into a true navigation utility beyond a "single click filter". In my final diploma thesis, one of the topics to work on suggested by my professor is doing "tag clouds" (i.e. weighted lists) for relations. The prototype will likely be integrated with the IkeWiki semantic wiki. I don't have a clear vision of how the "relation cloud" will work or look like, but I havn't started with my tesis yet anyway. I currently imagine up to three clouds (corresponding to the empty places in the relation) that will dynamically adopt to the choices already made by the user. Some zooming will probably be needed, too. Another use of tag clouds would be a visualization of the AI - the weights could be chosen by how sure the AI is about this tag; the cloud would then describe the AIs rating of a software package description. If you have some ideas, good links, relevant papers or other feedback, just send me an email to erich@debian.org. Thank you.

22 August 2006

Enrico Zini: debtags-tagcloud

Debtags tag clouds Erich Schubert has been popping up my gaim today with the idea of making a Debtags tag cloud. Indeed, it was missing, so we made it. Firstly, I added a new feature to tagcoll and generated the tag statistics. Then, Erich created a python script to generate the tagcloud, on which we then hacked a bit together. Finally, we came up with two tag maps: one nicely organised by facets, and one folded in a big cloud. Look at the cloud: this is what Debian is made of. Cool ideas come out, like making subclouds given a tag selection. It's just a simple matter of programming, so they say. Would they fit in the back of the Etch CD/DVD case?

4 August 2006

Enrico Zini: addis-tasks-and-skills

Addis course Tasks & Skills questions

31 July 2006

Enrico Zini: tenth-day-in-addis

Tenth day in Addis Procedure to check if all the services of Dream University are up and running If a machine blocks pings, use arping instead.
  1. Test DHCP:
    $ sudo ifdown eth0
    $ sudo ifup eth0
    $ ifconfig
    
  2. Test the DNS:
    # See if the DNS machine is on
    # The network
    $ ping -n 192.168.0.1
    # See if the DNS resolves names
    $ host www.dream.edu.et
    
  3. Test the gateway:
    # Ping the gateway
    $ ping gateway
    # Ping an outside host
    $ ping -n 10.4.15.6
    
  4. Test the proxy:
    # Ping the proxy
    $ ping proxy
    # Open a web page and see if it displays
    # See if it caches
    http_proxy=http://proxy.dream.edu.et:3030/ wget -S -O/dev/null http://www.enricozini.org  2>&1   grep X-Cache
    
  5. Test the mail server:
    $ ping smtp
    $ nmap smtp -p 25  grep 25/tcp
    $ if nmap gateway -p 25  grep 25/tcp   grep -q open ; then echo "It works"; fi
    $ send a mail and see if you receive it
    
To do more advanced network and service monitoring, try nagios: New useful tools seen today
wget - The non-interactive network downloader.
Special devices Example uses:
wget -O/dev/null http://www.example.org
dd if=/dev/zero of=testdisk bs=1M count=50
mke2fs testdisk
sudo mount -o loop testdisk  /mnt
Tiny little commands Example uses: Some more shell syntax Some people run commands ignoring the standard error: command 2> /dev/null this causes unexpected error messages to go unnoticed: please do not do it. What to check if a machine is very slow More VIM command mode Command mode allows to perform various text editing functions. You work by performing operations on selected blocks of text. Some common operations: Some common blocks: Examples: The best way to learn more vim is always to run vimtutor. Installing squirrelmail To install squirrelmail:
  1. apt-get install squirrelmail
  2. /usr/sbin/squirrelmail-config and configure IMAP and SMTP. In our case, since we use IMAPS, the IMAP server is imap.dream.edu.et, port 993, secure IMAP enabled and SMTP is smtp.dream.edu.et.
  3. Read /usr/share/doc/squirrelmail/README.Debian.gz (with zless) for how to proceed with setup. A short summary:
    • link /etc/squirrelmail/apache.conf into the apache conf.d directory
    • customise /etc/squirrelmail/apache.conf for example setting up the virtual hosts, or running it only on SSL
To have different virtual hosts over HTTPS, you need to have a different IP for every virtual host: name based virtual hosts do not work on HTTPS. You can configure multiple IP addresses on the same computer: use network interfaces named: eth0:1, eth0:2, eth0:3... These are called interface aliases. You cannot setup interface aliases using the graphical network configuration and you need to add them in /etc/network/interfaces:
    iface eth0:1 inet static
          address 192.168.0.201
          netmask 255.255.255.0
          gateway 192.168.0.3
    auto eth0:1
This is the trick commonly used to put different virtual HTTPS hosts on the same computer. Links squid documentation: Shell programming: Performance analysis: Setting up mail services:

Enrico Zini: ninth-day-in-addis

Ninth day in Addis SSH To enable remote logins with ssh 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:
  1. Create your key:
    ssh-keygen -t rsa
    
  2. Copy your public key to the machine where you want to log in:
    ssh-copy-id -i .ssh/id_rsa.pub efossnet@proxy
    
  3. Now you can ssh using your RSA key
If you use ssh often, read these: proxy Problems we had today with the proxy: 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: 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/html
That "/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. postfix on smtp.dream.edu.et Basic information is at http://www.postfix.org/basic.html. Difference between mail name and smarthost: Quick way to send test mails:
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:
  1. install postfix choosing "Satellite system"
  2. put smtp.dream.edu.et as a smarthost.
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 When a mail is sent to efossnet@localhost, the system tries to send it to efossnet@yoseph.org Investigation: Cause: the user efossnet had forgotten that he or she had setup a .forward file in the home directory. Solution:
 rm ~efossnet/.forward
Apache To add a new website:
  1. cd /etc/apache2/sites-available
  2. sudo cp default course
  3. sudo vi course:
    1. Remove the first line
    2. Add a ServerName directive with the address of your server: ServerName course.dream.edu.et
    3. Customize 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.
  4. sudo a2ensite course
  5. sudo /etc/init.d/apache2 reload
More VIM Undo: u (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:
  1. apt-get --print-uris install dnsmasq
  2. Manually download the packages at the URLs that it gives you
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:
dpkg -i *.deb
Backups There are various ways: Some data requires exporting before backing it up: You can schedule these dumps to be made one hour before the time you make backups. Scheduling tasks As a user:
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:
  1. Change /etc/crontab to use different maintanance hours
  2. Install anacron (it's installed by default in ubuntu)
For scheduling one-shot tasks, use at(1):
$ at 17:40
echo "Please tell Enrico that the lesson is finished"   mail efossnet@dream.edu.et
^D
When and how to automate
  1. First, you manage to do it yourself
  2. Then, you document it
  3. Then, you automate it
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). Interesting programs to schedule during maintanance Important keys to know in a Unix terminal These are special keys that work on Unix terminals: Therefore, if the terminal looks like it got stuck, try hitting ^Q. Problems we had today with postfix Problems found yesterday and today

27 July 2006

Enrico Zini: Tenth day in Addis

Procedure to check if all the services of Dream University are up and running If a machine blocks pings, use arping instead.
  1. Test DHCP:

    $ sudo ifdown eth0
    $ sudo ifup eth0
    $ ifconfig
    
  2. Test the DNS:

    # See if the DNS machine is on
    # The network
    $ ping -n 192.168.0.1
    # See if the DNS resolves names
    $ host www.dream.edu.et
    
  3. Test the gateway:

    # Ping the gateway
    $ ping gateway
    # Ping an outside host
    $ ping -n 10.4.15.6
    
  4. Test the proxy:

    # Ping the proxy
    $ ping proxy
    # Open a web page and see if it displays
    # See if it caches
    http_proxy=http://proxy.dream.edu.et:3030/ wget -S -O/dev/null http://www.enricozini.org  2>&1   grep X-Cache
    
  5. Test the mail server:

    $ ping smtp
    $ nmap smtp -p 25  grep 25/tcp
    $ if nmap gateway -p 25  grep 25/tcp   grep -q open ; then echo "It works"; fi
    $ send a mail and see if you receive it
    
To do more advanced network and service monitoring, try nagios:
New useful tools seen today:
wget - The non-interactive network downloader.
Special devices:
  • /dev/null:
    • On read, there is no data.
    • On write, discards data.
  • /dev/zero:
    • On read, reads an infininte amount of zero bits.
    • On write, discards data.
  • /dev/random, /dev/urandom
    • On read, reads random bits.
    • On write, discards data.
    • Difference: /dev/random is cryptographically secure, but it can hang waiting for system events
Example uses:
wget -O/dev/null http://www.example.org
dd if=/dev/zero of=testdisk bs=1M count=50
mke2fs testdisk
sudo mount -o loop testdisk  /mnt
Tiny little commands:
  • true - do nothing, successfully
  • false - do nothing, unsuccessfully
  • yes - output a string repeatedly until killed
Example uses:
while /bin/true; do echo ciao; done
Using /bin/false as a shell
yes   boring-tool-that-asks-lots-of-silly-questions
Some more shell syntax:
  • 2>&1 Redirects the standard error in the standard output
  • 2> Redirects the standard error instead of the standard output
Some people run commands ignoring the standard error:
command 2> /dev/null
This causes unexpected error messages to go unnoticed: please do not do it. What to check if a machine is very slow:
  • See if the ram is full:

    $ free
    
    If it is, you see what are the fattest programs using top, pressing M to sort by memory usage.
  • See if there are lots of programs competing for CPU:

    $ top
    
  • Check if you have I/O bottlenecks:

    $ vmstat
    
    (but I don't know how to read it)
  • For a desktop on older hardware, you can try xubuntu instead of ubuntu

More VIM command mode Command mode allows to perform various text editing functions. You work by performing operations on selected blocks of text. Some common operations:
  • y: copy ("yank")
  • p: paste
  • P: paste before
  • d: cut ("delete")
  • c: change
  • i: insert
  • a: append
  • .: repeat last operation
Some common blocks:
  • w: word
  • : paragraph
  • left and right arrow: one character left or right
  • up and down arrow: this line and the one on top or below
  • f letter: from the cursor until the given letter
  • v: selection
  • V: line selection
  • ^V: block selection
Examples:
  • yw: copy word
  • dw: cut word
  • yy: copy line
  • dd: cut line
  • V (select lines) y: copy a selection of lines
  • V (select lines) d: cut a selection of lines
  • p: paste
The best way to learn more vim is always to run vimtutor.
Installing squirrelmail To install squirrelmail:
  1. apt-get install squirrelmail

  2. /usr/sbin/squirrelmail-config and configure IMAP and SMTP. In our case, since we use IMAPS, the IMAP server is imap.dream.edu.et, port 993, secure IMAP enabled and SMTP is smtp.dream.edu.et.

  3. Read /usr/share/doc/squirrelmail/README.Debian.gz (with zless) for how to proceed with setup. A short summary:

    • link /etc/squirrelmail/apache.conf into the apache conf.d directory
    • customise /etc/squirrelmail/apache.conf for example setting up the virtual hosts, or running it only on SSL
To have different virtual hosts over HTTPS, you need to have a different IP for every virtual host: name based virtual hosts do not work on HTTPS. You can configure multiple IP addresses on the same computer: use network interfaces named: eth0:1, eth0:2, eth0:3... These are called interface aliases. You cannot setup interface aliases using the graphical network configuration and you need to add them in /etc/network/interfaces:
iface eth0:1 inet static
      address 192.168.0.201
      netmask 255.255.255.0
      gateway 192.168.0.3
auto eth0:1
This is the trick commonly used to put different virtual HTTPS hosts on the same computer.

Enrico Zini: Ninth day in Addis

SSH To enable remote logins with ssh:
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/
    
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:
  1. Create your key:

    ssh-keygen -t rsa
    
  2. Copy your public key to the machine where you want to log in:

    ssh-copy-id -i .ssh/id_rsa.pub efossnet@proxy
    
  3. Now you can ssh using your RSA key

If you use ssh often, read these:
proxy Problems we had today with the proxy:
  • 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/html
    
    That "/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.
postfix on smtp.dream.edu.et http://www.postfix.org/basic.html Difference between mail name and smarthost:
  • 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.
Quick way to send test mails:
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:
  1. install postfix choosing "Satellite system"
  2. put smtp.dream.edu.et as a smarthost.
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:
  • When a mail is sent to efossnet@localhost, the system tries to send it to efossnet@yoseph.org

    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'
    Cause: the user efossnet had forgotten that he or she had setup a .forward file in the home directory. Solution:
    rm ~efossnet/.forward
    
Apache To add a new website:
  1. cd /etc/apache2/sites-available

  2. sudo cp default course

  3. sudo vi course:

    1. Remove the first line

    2. Add a ServerName directive with the address of your server:

      ServerName course.dream.edu.et
      
    3. Customize 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.

  4. sudo a2ensite course

  5. sudo /etc/init.d/apache2 reload

More VIM Undo: u (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:
  1. apt-get --print-uris install dnsmasq
  2. Manually download the packages at the URLs that it gives you
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:
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.

Some data requires exporting before backing it up:
  • To save the list of installed packages and the answer to configuration questions:

    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.
  • To save the contents of a MySQL database:

    mysqldump name-of-database   gzip > name-of-database.dump.gz
    
    To restore:
    zcat name-of-database.dump.gz   mysql
    
You can schedule these dumps to be made one hour before the time you make backups.
Scheduling tasks As a user:
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:
  1. Change /etc/crontab to use different maintanance hours
  2. Install anacron (it's installed by default in ubuntu)
For scheduling one-shot tasks, use at(1):
$ at 17:40
echo "Please tell Enrico that the lesson is finished"   mail efossnet@dream.edu.et
^D
When and how to automate
  1. First, you manage to do it yourself
  2. Then, you document it
  3. Then, you automate it
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).
Interesting programs to schedule during maintanance
  • rkhunter, chkrootkit
  • checksecurity
  • debsecan
  • tiger
Important keys to know in a Unix terminal These are special keys that work on Unix terminals:
  • ^C: interrupt (sends SIGTERM)
  • ^\: interrupt (send SIGQUIT)
  • ^D: end of input
  • ^S: stop scrolling
  • ^Q: resume scrolling
Therefore, if the terminal looks like it got stuck, try hitting ^Q.
Problems we had today with postfix
  • 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,50
    
  • The 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.

Problems found yesterday and today:
  • 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.

26 July 2006

Enrico Zini: Eight day in Addis

Useful things to keep in mind when setting up a service:
  • always take note of what you do
  • make yourself always able to explain to another person what you did
  • keep a copy of the configuration files before changing them, so that you can see what you changed
  • be always able to move the service to another computer
  • make sure that it works after reboot
Example use of vim block selection:
ESC
exits insert mode.
^V
starts block selection. Move the arrows to form a rectangle.
c
change. Type the new content for the line.
ESC
gets out of insert mode, and the change will happen in all the lines.
To change network configuration with config files, edit:
/etc/network/interfaces
To also setup DNS in /etc/network/interfaces, use dns-search and dns-nameservers (for this to work, you need to have the package resolvconf):
dns-search dream.edu.et
dns-nameservers 192.168.0.1 192.168.0.2
To make a router that connects to the internet on demand using a modem:
apt-get install diald
To see the path of network packets:
mtr 4.2.2.2
Basic NAT script:
OUT=eth2
IN=eth0
modprobe iptable_nat
iptables -t nat -A POSTROUTING -o $OUT -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
What happens at system startup:
  1. the BIOS loads and runs the boot loader
  2. the boot loader loads the kernel and the inintrd ramdisk and runs the kernel
  3. the kernel runs the script 'init' in the initrd ramdisk
  4. the script 'init' mounts the root directory
  5. the script 'init' runs the command /sbin/init in the new root directory
  6. 'init' starts the system with the configuration in /etc/inittab
To install a new startup script:
sudo ln -s /usr/local/sbin/firewall /etc/init.d
sudo update-rc.d firewall defaults 16 75
Normally you can just do:
sudo update-rc.d [servicename] defaults
To have a look at the start and stop order numbers, look at /etc/rc2.d for other start scripts and /etc/rc0.d for other stop scripts To test a proxy, low level way:
$ telnet proxy 8080
Trying 192.168.0.6...
Connected to proxy.dream.edu.et.
Escape character is '^]'.
GET http://www.google.com HTTP/1.0 [press enter twice]

24 July 2006

Bdale Garbee: Fear Not!

During the key signing at LCA 2005, I promised to sign all the keys from that event before I left Australia... and I actually got it done... at 05:30 on the morning of our departure! And since then, I've been doing a good job of signing keys as I trade credentials. The problem is that I have several zip-loc bags full of key credentials covering the time period from the 2003 edition of LCA until the start of the 2005 edition. I'm not quite sure why, but tonight I got the itch to get on with signing them... so some of you are likely to already be surprised, or be surprised soon, to find signed keys in your inbox. Patience may still be required, though, as it's going to take a while to get completely caught up! Enjoy... and if you have credentials for me that you haven't acted on, how about joining me in getting caught up! Thanks to nudging from Enrico Zini, my current favorite tool of choice for key signing is caff. Much easier for everyone involved than cabot, and accomplishes about the same objectives.

18 July 2006

Enrico Zini: Fifth day in Addis

Setting up a mail server
Background Some terminology:
MTA
Mail Transport Agent
MUA
Mail User Agent
MDA
Mail Delivery Agent
SMTP
Simple Mail Transfer Protocol
MX
Mail eXchange
POP
Post Office Protocol
IMAP
Internet Message Access Protocol
With SMTP you connect to a server and send two things: envelope and message. The envelope looks like this:
MAIL FROM: <enrico@enricozini.org>
RCPT TO: <rms@fsf.org>
RCPT TO: <linus@linux.org>
The message looks like this:
From: <enrico@enricozini.org>
To: <rms@fsf.org>
Cc: <linus@linux.org>
Message-ID: <1234567@enricozini.org>
Subject: Test mail
Hi Richard,
this is a test mail.  I'm also writing
Linus to show how to send to more people.
Cheers,
Enrico
There is no authentication. There is no encryption. Two usual types of access control:
  1. Outbound e-mail is normally only accepted from an internal network
  2. Inbound e-mail is normally accepted from anywhere
The DNS is used to find the SMTP server to use to send a message:
$ host -t MX yahoo.com
yahoo.com MX 10 smtp1.yahoo.com
yahoo.com MX 20 smtp2.yahoo.com
yahoo.com MX 20 smtp3.yahoo.com
The process of sending an E-Mail:
  1. Enrico writes an E-Mail:

    From: Enrico Zini <enrico@enricozini.org>
    To: Richard Stallman <rms@fsf.org>
    Subject: Hello from Addis
    Hi Richard,
    Addis is a wonderful city, even if
    it rains a lot.
    Bye,  Enrico
    
  2. Enrico's MUA connects to the SMTP server (for example, port 25 of smtp.aau.edu.et):

    HELO enricozini.org
    200 OK Hello enricozini.org
    MAIL FROM: <enrico@enricozini.org>
    200 OK Mail from enrico@enricozini.org
    RCPT TO: <rms@fsf.org>
    
    Here, the SMTP server performs relay control: "do we relay mail to rms@fsf.org?":
    • Outbound e-mail is normally only accepted from an internal network
    • Inbound e-mail is normally accepted from anywhere
    A target address could be refused:
    413 ERR I don't relay for rms@fsf.org
    
    In this case, the destination is not local but the recipient is accepted because I'm inside the local network:
    200 OK Destination rms@fsf.org
    DATA
    200 OK Please send message body
    From: Enrico Zini <enrico@enricozini.org>
    To: Richard Stallman <rms@fsf.org>
    Subject: Hello from Addis
    Date: Mon, 17 Jul 2006 09:49:45 +0300
    Message-ID: <124372643@enricozini.org>
    Hi Richard,
    Addis is a wonderful city, even if
    it rains a lot.
    Bye,  Enrico
    .
    200 OK Message accepted
    QUIT
    200 OK Bye.
    
  3. The SMTP server needs to find out where to send the message, using the DNS:

    $ host -t MX fsf.org
    fsf.org MX 10 mail.fsf.org
    fsf.org MX 20 mail.gnu.org
    
  4. So the SMTP server tries the first one and connects to port 25 of mail.fsf.org:

    HELO smtp.aau.edu.et
    200 OK Hello smtp.aau.edu.et
    MAIL FROM: <enrico@enricozini.org>
    200 OK Mail from enrico@enricozini.org
    RCPT TO: <rms@fsf.org>
    
    The destination is accepted because it's for a local user:
    200 OK Destination rms@fsf.org
    DATA
    200 OK Please send message body
    From: Enrico Zini <enrico@enricozini.org>
    To: Richard Stallman <rms@fsf.org>
    Subject: Hello from Addis
    Date: Mon, 17 Jul 2006 09:49:45 +0300
    Message-ID: <124372643@enricozini.org>
    Received: by mail.aau.edu.et
      on Mon, 17 Jul 2006 09:55:53 +0300
      from 10.4.15.158
    Hi Richard,
    Addis is a wonderful city, even if
    it rains a lot.
    Bye,  Enrico
    .
    200 OK Message accepted
    QUIT
    200 OK Bye.
    
  5. Now, mail.fsf.org will invoke a MDA to write the mail in Richard Stallman's mailbox.

Example of problems with mail handling:
  • Accepting inbound connections:
    • Malicious input:
      • logic errors
      • buffer overflows
      • DoS (Denial Of Service) attacks
      • Connection floods
  • Performing outbound connections:
    • Programming errors:
      • Flooding of connections
  • Performing routing:
    • Unauthorised relays
    • Mail loops
  • Writing to the local hard drive:
    • Filling up the hard drive
    • Writing to the wrong files
  • Writing to the local hard drive as root:
    • In case of error or attack, any file in the system can potentially be compromised
RFC-822 is the original standard for E-mail. RFCs are standard Internet documents. Have a look at RFC documents released the 1st of April.
postfix Common setup: "Internet site with smarthost". More difficult to maintain: "Internet site". A smarthost is a machine that will relay e-mail for you. Questions asked with "Internet site with smarthost":
  • Mail name: aau.edu.et (name used to publicly identify the mail server)
  • Smarthost name: smtp.telecom.net.et (SMTP server that will relay our e-mail)
To test a mail server:
$ telnet localhost 25
HELO me
MAIL FROM: <a@b.c>
RCPT TO: <mail@of.a.local.user>
DATA
hi
.
QUIT
By default, you find locally delivered mail in /var/mail/username. Postfix configuration files:
/etc/postfix/master.cf
configures how all the postfix components run together (man 5 master)
/etc/postfix/main.cf
Main postfix configuration (man 5 postconf)
To rewrite addresses:
  1. In /etc/postfix/main.cf:

    canonical_maps = hash:/etc/postfix/canonical
    
  2. Then in /etc/postfix/canonical you can add the rewrite rules, like:

    enrico   enrico@enricozini.org
    
  3. When /etc/postfix/canonical is modified you need to regenerate the index:

    sudo postmap canonical
    
    (same is when you change the alias file: sudo postalias /etc/aliases)
(see file:///usr/share/doc/postfix/html/ADDRESS_REWRITING_README.html) Manipulating the message queue:
mailq - List the mail queue.
Example:
mailq
postqueue - Postfix queue control
Examples:
# Like mailq
postqueue -p
# Tries to send every message in the queue
postqueue -f
# Tries to send every message in the queue for that site
postqueue -s site
postsuper - Postfix superintendent
Examples:
# Deletes one message
sudo postsuper -d 7C4D2EC0F5D
# Deletes all messages held in the queue for later delivery
sudo postsuper -d ALL deferred
Different mail queues in postfix:
incoming
mail who just entered the system
active
mail to be delivered
deferred
mail to be delivered later because there were problems
hold
mail that should not be delivered until released from hold
Mail logs are in:
/var/log/mail.log
/var/log/mail.err
/var/log/mail.info
/var/log/mail.warn
Mail delivery Mailbox formats:
  • mbox: single file, mail separated by "From " lines
  • maildir: one directory per folder, one file per mail
  • mh: similar to maildir, but not really used
Alternate MDA: procmail: allows to filter mail automatically into different folders. Mail forwarding with ~/.forward: allows to redirect mail to a different address: just put the address you want to send to in the file ~/.forward.
POP or IMAP server Installation:
apt-get install dovecot
Configuration is in:
/etc/dovecot/dovecot.conf
The main thing that is needed is to enable the mail protocols you want:
protocols = imaps
Server monitoring To make all sorts of graphs:
apt-get install munin munin-node
Example: http://munin.ping.uio.no To compute more statistics:
  • anteater
  • isoqlog
  • mailgraph
Monitor system logs: logcheck:
  • sends you mail with abnormal log lines
  • It's important to customize what is normal and you do it with regular expressions
Filtering viruses and spam clamav - Virus scanner Virus scanning:
  • Postfix gives the mail to clamav that scans it and gives it back if it's clean.
  • Strategies for infected mail:
    • silently delete it
    • refuse the mail and send a notification to the sender
    • refuse the mail and send a notification to the receiver
    • quarantine the e-mail
    • refuse delivery with a SMTP error
    • deliver with an extra header that says that it's a virus
spamassassin - Spam filter Spam scanning:
  • Postfix gives the mail to spamd that scans it and gives it back with some spam information.
  • Strategies for spam mail:
    • silently delete it
    • refuse the mail and send a notification to the sender
    • refuse the mail and send a notification to the receiver
    • quarantine the e-mail
    • refuse delivery with a SMTP error
    • deliver with an extra header that says that it's spam
  • New techniques:
    • greylisting: when you receive a mail from a host you've never seen before, refuse it with a temporary error, and accept it the second time (after some time delay). Spammers normally don't retry, and implementing retry would increase their cost of sending e-mail.
    • crossassassin: if more than some amount of your users receive a mail with the same message ID, throw it away. Sending mails with different headers would increase the cost of sending e-mail.
Man pages and sections Man pages are divided in sections:
  • man man shows all the sections of the manpages
  • man 5 postconf shows the postconf manpage in the "configuration file" section
  • Normally manpages are referred as manpage(section) (e.g. postconf(5) )

Enrico Zini: Fifth day in Addis

Samba To get samba:
apt-get install samba samba-doc smbclient
To get the Samba Web Administration Tool:
apt-get install swat netkit-inetd
The configuration is in /etc/samba:
  • One [global] section with the general settings
  • One section per share
One could use swat at http://localhost:901/ but it does not work easily on Ubuntu. To see what is shared:
smbclient -L localhost
To access a share:
smbclient //localhost/name-of-the-share
To add a new user:
sudo smbpasswd -a username
To change the password of a user:
sudo smbpasswd username
To test accessing a share as a user:
smbclient //localhost/web -U yared
Documentation:
man smb.conf
To force the user or group used to access a share:
force user = enrico
force group = www-data
To set the unix permissions for every created file:
# For files
create mask = 0664
# For directories
directory mask = 0775
Example share configuration for a webspace:
mkdir /var/www/public
chgrp www-data /var/www/public
chmod 0775 /var/www/public
Then, in /etc/samba/smb.conf:
[web]
   comment = Webspace
   path = /var/www
   writable = yes
   public = no
   force group = www-data
   create mask = 0664
   directory mask = 0775
Example 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
Print server (CUPS) Installation:
apt-get install cupsys
Configuration:
  • On the web (not enabled in Ubuntu):

    http://localhost:631/
    
  • On the desktop:

    System/Administration/Printing
    
Example IPP URIs:
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."
GRUB The configuration file is in /boot/grub/menu.lst. The documentation can be accessed as info grub after installing the package grub-doc. Quick list of keys for info:
arrows
move around
enter
enters a section
l
goes back
u
goes up one node
q
quit
/
search
Grub trick to have a memory checker:
  1. apt-get install memtest86+

  2. Add this to /boot/grub/menu.lst:

    title Memory test
        root (hd0,5)
        kernel /boot/memtest86+.bin
    
Firewall With iptables:
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 ACCEPT
Some links:
Squid Installation:
apt-get install squid
The 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_networks
To use a parent proxy:
cache_peer proxy.aau.edu.et     parent    8080  0  proxy-only no-query
Pay 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] regexp
For info about regular expressions:
man regex
Example filtering by regular expression:
acl skype url_regex -i [^A-Za-z]skype[^A-Za-z]
http_access deny skype
Transparent proxy setup: http://www.tldp.org/HOWTO/TransparentProxy.html
Problems found today Hiccups of the day:
  • 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

Enrico Zini: Fourth day in Addis

Unix file permissions:
drwxr-xr-x   2 root root    38 2006-07-14
 
+- Is a directory
drwxr-xr-x   2 root root    38 2006-07-14
 ---
   
  +- User permissions (u)
drwxr-xr-x   2 root root    38 2006-07-14
    ---
      
     +- Group permissions (g)
drwxr-xr-x   2 root root    38 2006-07-14
       ---
         
        +- Permissions for others (o)
drwxr-xr-x   2 root root    38 2006-07-14
               ----
                 
                +- Owner user
drwxr-xr-x   2 root root    38 2006-07-14
                    ----
                      
        Owner group -+
Other bits:
  • 4000 Set user ID:
    • For executable files: run as the user who owns the file, instead of the user who runs the file
    • For directories: I think it's not used
  • 2000 Set group ID:
    • For executable files: run as the group who owns the file, instead of the group of the user who runs the file
    • For directories: when a file is created inside the directory, it belongs to the group of the directory instead of the default group of the user who created the file
  • 1000 Sticky bit:
    • For files: I think it's not used anymore
    • For directories: only the owner of a file can delete or rename the file
The executable bit for directories means "can access the files in the directory". If a directory is readable but not executable, then I can see the list of files (with ls) but I cannot access the files. To access a file, all the directories of its path up to / need to be executable. Commands to manipulate permissions:
  • chown - change file owner and group
  • chgrp - change group ownership
  • chmod - change file access permissions
  • sudo adduser enrico www-data adds the user enrico to the group www-data.
Example setup for a website for students:
# Create the group 'students'
mkdir /var/www/students
chgrp students /var/www/students
chmod 2775 /var/www/students
# If you don't want other users to read the files of the students:
chmod 2770 /var/www/students
adduser www-data students
 (this way the web server can read the
  pages)
# when you add a user to a group, it does not affect running processes:
 - users need to log out and in again
 - servers need to be restarted
Apache:
  • To install apache2 without a graphical interface:

    apt-cache search apache2   less
    sudo apt-get install apache2
    
  • By default, /var/www is where is the static website.

  • By default, ~/public_html is the personal webspace for every user, accessible as: http://localhost/~user

  • By default, /usr/lib/cgi-bin contains scripts that are executed when someone browses http://website/cgi-bin/script

  • By default, apache reads the server name from the DNS. If we don't have a name in the DNS and we want to use the IP, we need to set:

    ServerName 10.4.15.158
    
    in /etc/apache/apache2.conf (set it to your IP address)
  • To access the Apache manual: http://localhost/doc/apache2-doc/manual/

  • http://localhost/doc/apache2-doc/manual/mod/mod_access.html The access control module

  • http://localhost/doc/apache2-doc/manual/mod/mod_auth.html The user authentication module

  • To edit a user password file, use:

    htpasswd - Manage user files for basic authentication
    
  • Example .htaccess file to password protect a directory:

    AuthUserFile /etc/apache2/students
    AuthType Basic
    AuthName "Students"
    Require valid-user
    
  • Information about .htaccess is in http://localhost/doc/apache2-doc/manual/howto/htaccess.html

  • If you need to tell apache to listen on different ports, add a Listen directive to /etc/apache2/ports.conf. Then you can use:

    <VirtualHost www.training.aau.edu.et:9000>
    [...]
    </VirtualHost>
    
  • To setup an HTTPS website:

    • Documentation is in http://localhost/doc/apache2-doc/manual/ssl/

    • How to create a certificate: http://www.tc.umn.edu/~brams006/selfsign.html

    • Create a certificate:

      /usr/sbin/apache2-ssl-certificate -days 365
      
    • Create a virtual host on port 443:

      <VirtualHost www.training.aau.edu.et:443>
      [...]
      </VirtualHost>
      
    • Enable SSL in the VirtualHost:

      SSLEngine On
      SSLCertificateFile /etc/apache2/ssl/apache.pem
      
    • Enable listening on the HTTPS port (/etc/apache2/ports.conf):

      Listen 443
      
Apache troubleshooting:
  • check that there are no errors in the configuration file:

    apache2ctl configtest
    
    This it is always a good thing to do before restarting or reloading apache.
  • read logs in /var/log/apache2/

  • if you made a change but you don't see it on the web, it can be that you have the old page in the cache of the browser: try reloading a few times.

To install PHP
  • apt-get install libapache2-module-php5

  • then by default, every file .php is executed as php code

  • Small but useful test php file:

    <? phpinfo() ?>
    
To install MySQL
  • apt-get install mysql-client mysql-server

  • for administration run mysql as root:

    • Create a database with:

      create database students
      
  • Give a user access to the database:

    # Without password
    grant all on students.* to enrico;
    # With password
    grant all on students.* to enrico identified by "SECRET";
    
  • More information can be found at http://www-css.fnal.gov/dsg/external/freeware/mysqlAdmin.html

To use MySQL from PHP:
apt-get install php5-mysqli php5-mysql
Problems found today:
  • the apache2 manual in /usr/share/doc/manual can only be viewed using apache because it uses MultiView. So you need to have a working apache to read how to have a working apache.
  • chmod does not have examples in the manpage.

Enrico Zini: Third day in Addis

Believe it or not, a network that fails often is the best thing to have when you are teaching network troubleshooting. Various tools useful for networking:
  • ifconfig - configure a network interface

  • dnsmasq - Simple DNS and DHCP server

  • host - DNS lookup utility

  • route - show / manipulate the IP routing table

  • arping - send ARP REQUEST to a neighbour host

  • mii-tool - view, manipulate media-independent interface status (IOW, see if the cable works)

  • nmap - Network exploration tool and security / port scanner Examples:

    # Look at what machines are active in the local network:
    nmap -sP 10.5.15.0/24
    # Look at what ports are open in a machine:
    nmap 10.5.15.26
    
  • tcpdump - dump traffic on a network It can be used to see if there is traffic, and to detect traffic that shouldn't be there.

Useful tip:
# Convert a unix timestamp to a readable date
date -d @1152841341
What happens when you browse a web page:
  1. type the address www.google.com in the browser
  2. the browser needs the IP address of the web server:
  1. look for the DNS address in /etc/resolv.conf (/etc/resolv.conf is created automatically by the DHCP client)
  2. try all the DNS servers in /etc/resolv.conf until one gives you the IP address of www.google.com
  3. take the first address that comes from the DNS (in our case was 64.233.167.104)
  1. figure out how to connect to 64.233.167.104:
  1. consult the routing table to see if it's in the local network:
  1. if it's in the local network, then look for the MAC address (using ARP - Address Resolution Protocol)
  2. if it'd not in the local network, then send through the gateway (again using ARP to find the MAC address of the gateway)
  1. Send out the HTTP request to the local web server or through the gateway, using the Ethernet physical protocol, and the MAC address to refer to the other machine.
Troubleshooting network problems:
  1. See if the network driver works:
  1. With ifconfig, see if you see the HWaddr:. If you do not see it, then the linux driver for the network card is not working. Unfortunately there's no exact way to say that it works perfectly
  1. See if you have an IP address with ifconfig. If you find out that you need to rerun DHCP (for example, if the network cable was disconnected when the system started), then you can do it either by deactivating/reactivating the Ethernet interface using System/Administration/Networking or, on a terminal, running:

    # ifdown eth0
    # ifup eth0
    
    If you don't get an IP, try to see if the DHCP server is reachable by running:
    $ arping -D [address of DHCP server]
    
  2. See if the local physical network works:

  1. With sudo mii-tool, see if the cable link is ok. If it's not, then it's a problem in the cable or the plugs, or simply the device at the other end of the cable is turned off.
  2. Try arping or ping -n on a machine in the local network (like the gateway) to see if the local network works.
  1. See if the DNS works:
  1. Find out the DNS address:

    cat /etc/resolv.conf
    
  2. If it's local, arping it

  3. If it's not local, ping -n it

  4. Try to resolve a famous name using that DNS:

    $ host [name] [IP address of the DNS]
    
  5. Try to resolve the name of the machine you're trying to connect. If you can resolve a famous name but not the name you need, then it's likely a problem with their DNS.

  1. If you use a proxy, see if the proxy is reachable: check if the proxy name resolves to an IP, if you can ping it, if you can telnet to the proxy address and port:

    $ telnet [proxy address] [proxy port]
    
    you quit telnet with ^]quit.
  2. If you can connect directly to the web server, try to see if it answers:

    $ telnet [address] 80
    
    If you are connected, you can confirm that it's a web server:
    GET / HTTP/1.0 (then Enter twice)
    
    If it's a web server, it should give you something like a webpage or an HTTP redirect.
When you try to setup a service and it doesn't work:
  1. check that it's running:

    $ ps aux   grep dnsmasq
    
  2. check that it's listening on the right port:

    $ sudo netstat -lp
    
  3. check that it's listening from the outside:

    $ nmap [hostname]
    
  4. check for messages in /var/log/daemon.log or /var/log/syslog

  5. check that the configuration is correct and reload or restart the server to make sure it's running with the right configuration:

    # /etc/init.d/dnsmasq restart
    
dnsmasq:
By default: works as a DNS server that serves the data in /etc/hosts. By default: uses /etc/resolv.conf to find addresses of other DNS to use when a name is not found in /etc/hosts. To enable the DHCP server, uncomment:
dhcp-range=192.168.0.50,192.168.0.150,12h
in /etc/dnsmasq.conf and set it to the range of addresses you want to serve. Pay attention to never put two DHCP servers on the same local network, or they will interfere with each others. To test if the DHCP server is working, use dhcping (not installed by default on Ubuntu). To communicate other information like DNS, gateway and netmask to the clients, use this piece of dnsmasq.conf:
# For reference, the common options are:
# subnet mask - 1
# default router - 3
# DNS server - 6
# broadcast address - 28
dhcp-option=1,255.255.255.0
dhcp-option=3,192.168.0.1
dhcp-option=6,192.168.0.1
dhcp-option=28,192.168.0.255
Problems found today:
  • changing the name of the local machine in /etc/hosts breaks sudo, and without sudo it's impossible to edit the file. The only way to fix this is a reboot in recovery mode.
  • dhclient -n -w is different than dhclient -nw
Quick start examples with tar:
# Create an archive
tar zcvf nmap.tar.gz *.deb
# Extract an archive
tar zxvf nmap.tar.gz
# Look at the contents of an archive
tar ztvf nmap.tar.gz
Quick & dirty way to send a file between two computers without web server, e-mail, shared disk space or any other infrastructure:
# To send
nc -l -p 12345 -q 1 < nmap.tar.gz
# To receive
nc 10.5.15.123 12345 > nmap.tar.gz
# To repeat the send command 20 times
for i in  seq 1 20 ; do nc -l -p 12345 -q 1 < nmap.tar.gz ; done

13 July 2006

Enrico Zini: First pratical lesson

Notes after today's training session. Small index of most used shell commands:
  • ls - list directory contents
  • cp - copy files and directories
  • mv - move (rename) files
  • rm - remove files or directories
  • find - search for files in a directory hierarchy
  • cat - concatenate files and print on the standard output
  • more - file perusal filter for crt viewing
  • less - opposite of more (quit with 'q')
  • cd - Change the current directory to DIR. (use "help cd" instead of "man cd")
  • mkdir - make directories
  • rmdir - remove empty directories
Small index of commands useful for combining in pipelines:
  • grep, egrep, fgrep, rgrep - print lines matching a pattern
  • tail - output the last part of files
  • head - output the first part of files
  • sort - sort lines of text files
  • uniq - report or omit repeated lines
  • sed - stream editor
  • wc - print the number of newlines, words, and bytes in files
Problems found during the lesson:
  • You set the system default locale to Amharic, and the gdm login will be in Amharic input mode. We didn't find out how to switch it back to input roman characters. Right click on the input field to set the input method doesn't work. Since usernames are not in Amharic, you're locked out.

  • So you CTRL+ALT+F1, login and try dpkg-reconfigure locales. On Ubuntu Dapper, it does not work anymore.

  • So you dig and dig and dig and finally find that you can force a locale in /etc/default/gdm (but not in /etc/gdm/locale.conf, nor in /etc/gdm/gdm.conf).

  • Then the internet works for a bit and you look up how to reconfigure locales in Ubuntu. Turns out you have to use localeconf, which is not installed by default, is not in universe and thus not on the CDs, and needs to be downloaded from the Internet.

  • The Ubuntu wiki is all on https, which defeats any attempt of proxy caching.

  • An Internet proxy needs to be configured 3 times: in Gnome, in Firefox and in Synaptic (well, apt). This is especially tricky when you forgot to setup the proxy in Synaptic and seemingly unrelated applications fail, like the Ubuntu language selector, which internally invokes the package manager to download missing langpacks.

  • Some short descriptions in the NAME section of manpages are hard to understand, or wrong. Noted on apt-get, apt-cache and less. Top prize goes to apt-cache:

    NAME
           apt-cache - APT package handling utility -- cache manipulator
    DESCRIPTION
           [...] apt-cache does not manipulate the state of the system but
           does provide operations to search and generate interesting output
           from the package metadata. [...]
    
    So apt-cache is a manipulator that doesn't manipulate. A possible improvement can be "query the APT package cache".
  • The language selector in Ubuntu Breezy doesn't really exit and keeps the package database locked. This seems to be fixed in Dapper, and probably had been fixed in some Breezy update. System updates here are a problem: my Dapper (with some Universe things in it) wanted to download more than 120Mb of data, and the Uni network was giving me 14Kbps. It's been a nice opportunity to teach about fuser -uva and kill.

  • dict, squid and many other packages from 'main' are not on the normal Ubuntu CDs: is there an easy way to build a CD with them? Or do Ubuntu CDs with extra packages already exist? I'll have to find out.

  • cupsys has documentation outside of /usr/share/doc, in /usr/share/cups/doc-root.

  • man works on all commands, except cd, which is an internal shell command and thus needs help instead of man. I should remember to ponder about autogenerating manpages from help output.

  • Is there an index-like manpage with a list of the core Unix commands and their short descriptions? It there's not, it's easy to generate:

    #!/bin/sh
    DIR=$ 1:-"/bin" 
    (
    find $DIR   while read FILE
    do
       if [ -x $FILE ] && ! [ -d $FILE ]
       then
               LANG=C COLUMNS=2000 man  basename $FILE    \
                     grep ^SYNOPSIS -B 100   grep ^NAME -A 100   \
                     tail -n +2   head -n +2   \
                     grep -v '^[ \t]*$'
       fi
    done
    )   sort   uniq   sed 's/^ \+//'
    
    Try running it on /bin and /sbin: it's great!. Also, since it doesn't redirect stderr, it nicely exposes a number of manpage problems.
Lots of bugs to report when I come home: from here it'll take ages, and lots of money on the hotel internet connection, and some are Ubuntu-specific so I'd need to do everything online with Malone. As usual, teaching is one of the best ways to find bugs. I propose an Etch training session a month before release. Other things to do:
  • Find more info about that Wikipedia live CD with Wikipedia browsable without the Internet.
  • Make a collection of Free technical E-books: even those Indian low-cost book editions are too expensive here, so E-books mean a lot.

Next.

Previous.