Makes Java a little nicer
Why there are two kinds of programmers
Library Programmers
- Know very well how to use specific libraries for specific programming languages
- Don’t really care too much about memory / CPU performance
- “Get the job done” attitude
Low Programmers
- Understand pointers (had the “pointer moment” as I call it)
- Care, maybe too much, about performance
- Care about writing “nice” programs
I still personally think that a bottom -> up approach will give you a more solid understanding of the high level languages.
I am starting to understand that programming is not about people that started with Pascal or Basic when they were nine. Programming has become a career choice. People are now studying computing because they think they can get a well paid laid back job afterwards. Of course this is annoying us passionate programmers that spent their childhood learning how to write slim quick code, because these are our values.
So if someone comes up to you and sais “I am a programmer, but I only know Java” Don’t condemn him right away. He is just a library programmer, if this is good or bad time will show.
id -G funny group
On a system with afs, if you run
$ id -G
500 1102830893
you will get this very big number at the end.
$ id -G `whoami`
500
will not show this number. This is due to afs creating a group in
memory that is not in /etc/group . This of course becomes more
interesting if you run :
$ id -Gn
me id: cannot find name for group ID 1102830893
1102830893
groups behaves in the same way :
$ groups
me id: cannot find name for group ID 1102830893
1102830893
If you look into the id.c you can see why this is happening:
if (argc - optind == 1)
{
struct passwd *pwd = getpwnam (argv[optind]); /* Will go of to
/etc/nsswitch.conf and appropriate*/
if (pwd == NULL)
error (EXIT_FAILURE, 0, _("%s: No such user"), argv[optind]);
ruid = euid = pwd->pw_uid;
rgid = egid = pwd->pw_gid;
}
else
{
euid = geteuid (); /* glibc will do this */
ruid = getuid ();
egid = getegid ();
rgid = getgid ();
}
This is very easy to fix. I have already done this and it works.
I am aware that this is actually a problem of afs and not coreutils.
Hope this might help someone who is confused about that group :)
Rant about GNU again
#! /bin/shThat was it. As easy as that.
# $OpenBSD: true.sh,v 1.2 1996/06/26 05:32:50 deraadt Exp $
exit 0
#! /bin/sh
# $OpenBSD: false.sh,v 1.2 1996/06/26 05:32:50 deraadt Exp $
exit 1
A nother WHY do we use coreutils.
Google docs pink?
Geeks versus Nerds
After trying to explain to my mom what the differnece is here you go http://chickybaberules.blogspot.com/2006/04/chickybabes-guide-to-geeks-and-nerds.html
- Geeks are sociable people. Nerds have no social skills and are social outcasts.
- Geeks engage in meaningful conversations. They can look you in the eye, give you an unexpected timid smile and may even flirt with you. Nerds can’t maintain eye contact because they look at their gadgets and rattle on specifications. Note: The geek’s flirting methods may be ever so subtle, but it is still considered flirting.
- Geeks have a human touch, even during their geekiest moments, such as fixing your PC. Nerds don’t touch; they’re too busy flipping their pencils.
- Geeks can be sensitive, romantic and have a witty sense of humour. Nerds get romantic cutting code and playing with circuitboards.
- Geeks have style and a good fashion sense, even when they don’t have the physique for it. Nerds think that wearing a pen in your shirt pocket is the latest fashion accessory.
- Geeks can look cool in a suit if/when they wear one (ie job interviews). Nerds don’t look cool in anything.
- Geeks are sexy and can carry themselves with confidence. The words “nerds” and “sexy” are mutually exclusive.
- Geeks can be into sports and outdoor activities. Nerds are identified by pallor on their skin and loss of muscle tone; flipping pencils does not constitute a sport.
- Calling someone a geek can be a compliment; calling someone a nerd is derogatory.
- Geeks can be well-read and articulate. Nerds read hardware specs and installation guides for leisure.
- Geeks know they’re geeks, and they’re proud of it. Nerds don’t label themselves for fear of labels.
- Geeks and nerds have an inherent dislike of one another; I wonder why.
- Geeks can tell good jokes and laugh. Ever heard a nerd laugh?
- A nerd will offer to fix your computer for money. A geek will ask for other favours.
- Geeks take their girls to bed, nerds sleep at their desks.
- Geeks who talk in their sleep are likely to be dreaming of sex. Nerds who talk during their sleep speak of building computers*.
So now I hope this will never be mixed up again
Why Gentoo is dead :(
"SHUT UP AND CODE"
And stay a distro for geeks and not try to get into the ubuntu market. Because of this hacking wasn't fun anymore.
No I only have to administer 2 more gentoo boxes that I don't update anymore and am waiting till I can replace them with something alive.
Update:
It seams like the gentoo people are noticing that have a problem:
http://spyderous.livejournal.com/95715.html
After reading some comments I must say I changed to arch about 6 month ago and I love it.
I know someone is going to post a reply telling me that this is all not true and anyway it is my fault but I am just going to delete it without reading that crap.
How to Simplify Your Life
If you are, just a little, successful in life do not think about buying or even reading this book. Because you will know everything already. But as I already mentioned if you want to kill yourself and you want good to help you get on the right path, please PLEASE read it. Or maybe just kill yourself anyway.
Eclipse fu*king sweet feature
Well done eclipse.
I have been trying eclipse with c{\ and,++} but it really couldn't convince me there. But Java and eclipse just work so nicely.
Buy the way, i tried NetBeans (6.0.1) and it is still utter crap.
bash-3.00$ strace -p 2564
Process 2564 attached - interrupt to quit
[ Process PID=2564 runs in 32 bit mode. ]
futex(0xf7fc9be8, FUTEX_WAIT, 2565, NULL
Cern Week 27
Lock my screen with a smartcard
#!/usr/bin/perl
use ExtUtils::testlib;
use Chipcard::PCSC;
use Chipcard::PCSC::Card;
use Data::Dumper;
use warnings;
use strict;
my @mycard = [
59,
105,
0,
0,
36,
148,
1,
2,
1,
0,
1,
1,
169
];
sub compare_arrays {
my ($first, $second) = @_;
no warnings; # silence spurious -w undef complaints
return 0 unless @$first == @$second;
for (my $i = 0; $i < @$first; $i++) {
return 0 if $first->[$i] ne $second->[$i];
}
return 1;
}
sub checkCard(){
#-------------------------------------------------------------------------------
my $hContext = new Chipcard::PCSC();
return 1 unless (defined $hContext);
#-------------------------------------------------------------------------------
my @ReadersList = $hContext->ListReaders ();
return 1 unless (defined($ReadersList[0]));
#-------------------------------------------------------------------------------
my $hCard = new Chipcard::PCSC::Card ($hContext, $ReadersList[0]);
return 1 unless (defined($hCard));
#-------------------------------------------------------------------------------
my @StatusResult = $hCard->Status ();
return 1 unless (defined ($StatusResult[0]));
if (not compare_arrays(\@mycard ,\@{$StatusResult[3]})) {
return 0;
}
#-------------------------------------------------------------------------------
$hCard->Disconnect($Chipcard::PCSC::SCARD_LEAVE_CARD);
undef $hCard;
#-------------------------------------------------------------------------------
$hContext = undef;
}
my $forked =0;
daemonize();
while (1) {
# Device was found and command should be executed
if (checkCard()==0 && $forked == 1) {
system("/bin/sh -c \"killall xscreensaver\"");
system("/bin/sh -c \"xscreensaver -no-splash &\"");
$forked =0;
}
# Device is gone and command should be executed
elsif ( (checkCard()==1) && ($forked != 1) ) {
my $pid =fork();
if ($pid == 0) {
system("/bin/sh -c \"xscreensaver-command -activate\"");
exit(0);
}else{
$forked = 1;
}
}
sleep ( 2 );
}
# Become a daemon
sub daemonize
{
chdir("/");
close(STDIN);
close(STDOUT);
}
Thats why I hate ubuntu
Limit Groups On Clusters With Ldap and quattor
File overview
- /etc/ldap.conf
- /etc/pam.d/system-auth
- /etc/nsswitch.conf
- Template
/etc/ldap.conf
As far as I understand there are 2 ways of limiting a box to a specific group. The first is to add every user to the specific group on the ldap server. And then configure the client to read this. The 2 values in ldap.conf are# Group to enforce membership of
pam_groupdn cn=c3,ou=group,dc=example,dc=edu
# Group member attribute
pam_member_attribute memberUid
So the ldap entry would look something like
# dev, posixGroups, priv, root, com
dn: cn=c3,ou=posixGroups,dc=example,dc=org
cn: c3
objectClass: posixGroup
objectClass: top
gidNumber: 1016
memberUid: cn=didi,ou=People,dc=example,dc=org
memberUid: cn=jan,ou=People,dc=example,dc=org
This of course is a nice way of maneging dynamic groups but if you want to add a member you always have to fiddle with the ldap server and if you have a huge amount of users you can quickly loose the orientation (try doing this with 21717 users) The second way is to add a filter to the ldap search that pam_ldap / nss_ldap does.
As explained in my post http://computingfunnyfacts.blogspot.com/2008/01/pamfilter-not-working.html you have to very careful what you specify as a pam filter.
TIPP
: Look at what the ldap server is processing. With $ slapd -d 256
you can get a nice queried overview.
To configure this with quattor you can use the authconfig module:
"/software/components/authconfig/method/ldap/enable" = true;
"/software/components/authconfig/method/ldap/nssonly" = false;
"/software/components/authconfig/method/ldap/conffile" = "/etc/ldap.conf";
"/software/components/authconfig/method/ldap/servers" = list ( "lolol.cern.ch" );
"/software/components/authconfig/method/ldap/basedn" = "dc=example,dc=edu";
"/software/components/authconfig/method/ldap/tls/enable" = false;
"/software/components/authconfig/method/ldap/binddn" = "cn=Manager,dc=example,dc=edu";
"/software/components/authconfig/method/ldap/bindpw" = "NFW";
"/software/components/authconfig/method/ldap/rootbinddn" = "cn=Manager,dc=example,dc=edu";
"/software/components/authconfig/method/ldap/port" = 389;
"/software/components/authconfig/method/ldap/timeouts/idle" = 3600;
"/software/components/authconfig/method/ldap/timeouts/bind" = 300;
"/software/components/authconfig/method/ldap/timeouts/search" = 300;
"/software/components/authconfig/method/ldap/pam_filter" = "gidNumber=1012";
Here the interesting part is the pam_filter which is supported from version 1.1.5
/etc/pam.d/system-auth
The default entry in system-auth iswhich is not enough to fail if the user is not in the specified group.
account [default=bad success=ok user_unknown=ignore] /lib/security/$ISA/pam_ldap.so
So you have to change this into
account required /lib/security/$ISA/pam_ldap.so
this is best done through quattor with the authconfig module again. Just add
this will overwrite the entry with a more stricter configuration.
"/software/components/authconfig/pamadditions/system/conffile"="/etc/pam.d/system-auth";
"/software/components/authconfig/pamadditions/system/section"="account";
"/software/components/authconfig/pamadditions/system/lines"=list( nlist(
"order","last",
"entry","required /lib/security/$ISA/pam_ldap.so"
));
/etc/nsswitch.conf
Nswitch should be configured correctly by default but here just be sure the configuration I have been using:
# cat /etc/nsswitch.conf | egrep -v "(^#|^$)"
passwd: files ldap
shadow: files ldap
group: files ldap
hosts: files dns
bootparams: files
ethers: files
netmasks: files
networks: files
protocols: files ldap
rpc: files
services: files ldap
netgroup: files ldap
publickey: files
automount: files ldap
aliases: files
Template
Here an example template with some security important stuff removed:
############################################################
#
# object template profile_lolol
#
# Generated automatically with /distribution/remedy/programs/CDBAddHost script.
#
# Created Thu Jun 2 11:52:22 2005 by remedy
#
# Do NOT edit.
#
############################################################
object template profile_lolol;
include stages/prod;
#
# include profile_base for use of typed properties
#
include pro_declaration_profile_base;
"/software/components/access_control/privileges/acl_root/user/ribalba/0/targets"=list("+node::lolol");
"/software/components/access_control/privileges/acl_interactive/user/me/0/targets"=list("+node::lolol");
#
# used resources
#
include pro_hardware_elonex_2800_64;
include netinfo_lolol;
include pro_type_lxdev_slc4;
#include pro_service_java_sun;
"/hardware/contract" = create("pro_hardware_contract_it_3319");
"/system/cluster/subname" = "zuul";
"/system/function" = "Zuul dev machine / Didi, Jan - FIO/FS";
#
# "deregister" this box
#
"/software/packages" = pkg_del("CERN-CC-regis_client");
"/software/components/regisclient/active" = false;
"/software/components/sindes/all" = "";
delete "/software/components/sindes/items/group-header";
delete "/software/components/sindes/items/passwd-header";
"/software/packages" = pkg_del("ncm-localhomedir");
delete "/software/components/localhomedir";
delete "/system/accounts";
#
# Sendmail options
#
"/software/components/sendmail/localusers" = push("root");
"/software/components/sendmail/localusers" = push("operator");
#
# ncm-accounts
#
"/software/packages" = pkg_repl("ncm-accounts","3.0.5-1","noarch");
#
# So lets do some dev work
#
"/software/components/accounts/ldap" = true;
"/software/components/accounts/active" = true;
"/software/components/accounts/rootpwd" = "$1$HAHAHAHAHAHHAHA";
"/software/components/accounts/shadowpwd" = true;
#
# /etc/group : works fine!
#
"/software/components/accounts/groups" = nlist("ct",nlist("comment","undef","gid",1023),
"ci",nlist("comment","undef","gid",1016),
);
#
# /etc/passwd:
# - does not create /home/operator
# - quotes (") around the gecos field
#
"/software/components/accounts/users" =
nlist("operator",nlist(
"comment" , "Computer Operations",
"homeDir" , "/home/operator",
"createHome" , true,
"groups" , list(1023), # group names or gid's?
#"groups" , list("ct"), # group names or gid's?
"password" , "$1$HAHAHAHAHAHAHAHAHAHAHA",
"shell" , "/bin/tcsh",
"uid" , 616,
),
"oracle",nlist(
"comment" , "Oracle Support",
"homeDir" , "/ORA/dbs01/oracle/home",
"createHome" , true,
"groups" , list(1016), # group names or gid's?
"password" , "$1$HAHAHAHAHAHAHAHAHAHAHAH",
"shell" , "/bin/bash",
"uid" , 1286,
),
);
#
# ncm-authconfig
#
"/software/components/authconfig/active" = true;
"/software/components/authconfig/safemode" = false; # When set to true, no actual configuration will change
"/software/components/authconfig/usemd5" = true; # Enable the use of MD5 hashed password
"/software/components/authconfig/useshadow" = true; # Enable the use of shadow password files
"/software/components/authconfig/usecache" = true; # Enable or disable nscd operation
"/software/components/authconfig/startstop" = true; # ??? Undocumented ???
"/software/components/authconfig/method/files/enable" = true;
#"/software/components/authconfig/method/afs/enable" = false;
#"/software/components/authconfig/method/afs/cell" = "cern.ch";
"/software/components/authconfig/method/ldap/enable" = true;
"/software/components/authconfig/method/ldap/nssonly" = false;
"/software/components/authconfig/method/ldap/conffile" = "/etc/ldap.conf";
"/software/components/authconfig/method/ldap/servers" = list ( "lolol.cern.ch" );
"/software/components/authconfig/method/ldap/basedn" = "dc=example,dc=edu";
"/software/components/authconfig/method/ldap/tls/enable" = false;
"/software/components/authconfig/method/ldap/binddn" = "cn=Manager,dc=example,dc=edu";
"/software/components/authconfig/method/ldap/bindpw" = "NFW";
"/software/components/authconfig/method/ldap/rootbinddn" = "cn=Manager,dc=example,dc=edu";
"/software/components/authconfig/method/ldap/port" = 389;
"/software/components/authconfig/method/ldap/timeouts/idle" = 3600;
"/software/components/authconfig/method/ldap/timeouts/bind" = 30;
"/software/components/authconfig/method/ldap/timeouts/search" = 30;
"/software/components/authconfig/method/ldap/pam_filter" = "gidNumber=1012";
"/software/components/authconfig/method/nis/enable" = false;
"/software/components/authconfig/method/nis/domain" = "nikhef.nl";
"/software/components/authconfig/method/nis/servers" = list ( "ajax.nikhef.nl" );
"/software/components/authconfig/method/krb5/enable" = false;
"/software/components/authconfig/method/krb5/kdcs" = list ( "kdc.nikhef.nl" );
"/software/components/authconfig/method/krb5/adminserver" = list ( "krbadmin.nikhef.nl" );
"/software/components/authconfig/method/krb5/realm" = "NIKHEF.NL";
"/software/components/authconfig/pamadditions/system/conffile"="/etc/pam.d/system-auth";
"/software/components/authconfig/pamadditions/system/section"="account";
"/software/components/authconfig/pamadditions/system/lines"=list( nlist(
"order","last",
"entry","required /lib/security/$ISA/pam_ldap.so"
));
"/hardware/serialnumber" = "ch445-521-77";
# machine moved on 27.02.07 from = "ri17";
include pro_monitoring_hardware_elonex_2800;
"/hardware/cards/nic/0/hwid" = "xxxxxxxxxxxx";
include serial_map_lxc2ri25;
include diskinfo_lxb5477;
# machine moved on 02.03.07 from = "ri17";
"/hardware/rack/name" = "ri17";
-- Main.GeerdDietgerHoffmann - 04 Feb 2008
Cern Week 26
/etc/pam.d/system.authconfig and updated the ldap.conf to respect these rules. I modified a quattor component to do so (ncm-autconfig). After some test at Nikhef (National institute for subatomic physics in Amsterdam) my patch set was pushed into production. My other posts go into more detail. Further I wrote some documantation about all the canges I had made so that other people could implement Ldap on theire machines. (https://twiki.cern.ch/twiki/bin/view/FIOgroup/LimitGroupsOnClustersWithLdap).
At last I got the OK from my boss to talk to the Windows guys to implement one Ldap server that everyone would use. Through this Windows and Linux can stay in sync without any mayor problems. After some political discussion ("Is Windows capable of processing this", etc...) we decided to just extend a already existing Windows server and Linux would sync with this. I created a public user that only has read writes and that can be used by the clients to query the data. Further I investigated into a database idea I had and still are. Further to come on this. And finally I played around with my new keyboard and tried to get it to authenticate me with a smart card.
Cern Week 25
- A Dark Universe: Dark Matter and Dark Energy Which in general was about how the universe was created and how you can calculate the mass and the age.
- Germans at Cern Which was a delegation from German industries that talked about the involvement of Germany in the LHC project.
- The brain, an orchestra without conductor(Prof. SINGER, Wolf) This was basically my Artificial Intelligence course one step further. It was very interesting to find out in more detail how the brain works and how we can save data. Like that the short term memory can only hold about 6 things. That's why all those horrible party games work so nicely.
Further I started adding support for limiting specific groups for specific clusters through quattor templates. This was quite hard as pam_ldap.so has quite a few errors. So I ended up reading 4000 lines of C code and creating a Cern internal package which contains all my patches. Further I extended a quattor module to be able to add the 'pam_filter' to the /etc/ldap.conf file. After looking for an error for half a day I found that I had forgotten to update the PAM file. Which was quite frustrating.