The latest version of skype doesn't appear to work well on RHEL6, I found the following forum http://community.skype.com/t5/Linux/Skype-for-Redhat-Enterprise-6/td-p/… and followed the two things mentioned there to make it work.

  • Download the ubuntu 10 version and extract the contents with dpkg
  • Download the ubuntu 10 qtwebkit and extract using dpkg, put the libraries in /usr/share/skype
  • rename the skype binary to skype-ubuntu and then run skype from a script which sets GTK2_RC_FILES=/etc/gtk-2.0/gtkrc
    <br />
    #!/bin/sh
    <p>export LD_LIBRARY_PATH=/usr/share/skype:$LD_LIBRARY_PATH<br />
    export GTK2_RC_FILES=/etc/gtk-2.0/gtkrc<br />
    exec skype-ubuntu $@<br />

You can get the contents of the debian package with dpkg

<br />
mkdir skype-debian<br />
dpkg -x skype-debian_4.1.0.20-1_i386.deb skype-debian<br />
dpkg -x libqt4-webkit_4.6.2-0ubuntu5.5_i386.deb skype-debian<br />
cd skype-debian<br />
mv usr/lib/libQtWeb* usr/share/skype<br />
rm -r usr/lib<br />
rm -r usr/share/doc/libqt4-webkit<br />
tar cjf skype-4.1.0.20.tar.bz2 *<br />

Then use the following spec file with that tar and you'll be able to make a src rpm for mocking...

%define __os_install_post %{nil}
%define _enable_debug_packages %{nil}
Summary: Skype is free Internet telephony that just works
Name: skype
Version: 4.1.0.20
Release: 1%{?dist}
License: Commercial
Group: Applications/Internet
URL: http://www.skype.com/products/skype/linux/
Source: skype-4.1.0.20.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Provides: config(skype) = %{version}-fc16, skype = %{version}-fc16, skype(x86-32) = %{version}-fc16
Requires: sqlite(x86-32)
Requires: alsa-lib(x86-32)
Requires: qt-x11(x86-32)
Requires: libXrandr(x86-32)

%description
Hack to get Skype 4.1 to work on Springdale Linux
Skype

Skype is software that enables the world's conversations.
Millions of individuals and businesses use Skype to make free video and voice
calls, send instant messages and share files with other Skype users.
Everyday, people also use Skype to make low-cost calls to landlines
and mobiles.

* Make free Skype-to-Skype calls to anyone else, anywhere in the world.
* Call to landlines and mobiles at great rates.
* Group chat with up to 200 people or conference call with up to 25 others.
* Free to download.

Originally done with rpm version 4.9.1.2,
built on du4-fc16-linuxui-02 at Mon Jun 11 19:38:07 2012
from skype-4.0.0.7-fc16.src.rpm with opt flags -O2 -g -march=i386 -mtune=i686

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
pushd $RPM_BUILD_ROOT
tar xjvf %{SOURCE0}
mv %{name}-%{version}/* .
mkdir -p $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version}
mv LICENSE README README.sdl third-party_attributions.txt $RPM_BUILD_ROOT/%{_docdir}/%{name}-%{version}
\rm -r %{name}-%{version}
popd

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%verify(md5 size link user group mtime mode rdev) %config %attr(0644L,root,root) "/etc/dbus-1/system.d/skype.conf"
%verify(md5 size link user group mtime mode rdev) %config %attr(0644L,root,root) "/etc/prelink.conf.d/skype.conf"
%verify(md5 size link user group mtime mode rdev) %attr(0755L,root,root) %{_bindir}/skype
%verify(md5 size link user group mtime mode rdev) %attr(0755L,root,root) %{_bindir}/skype-ubuntu
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/applications/skype.desktop
%verify(md5 size link user group mtime mode rdev) %doc %attr(0644L,root,root) %{_docdir}/%{name}-%{version}/LICENSE
%verify(md5 size link user group mtime mode rdev) %doc %attr(0644L,root,root) %{_docdir}/%{name}-%{version}/README
%verify(md5 size link user group mtime mode rdev) %doc %attr(0644L,root,root) %{_docdir}/%{name}-%{version}/README.sdl
%verify(md5 size link user group mtime mode rdev) %doc %attr(0644L,root,root) %{_docdir}/%{name}-%{version}/third-party_attributions.txt
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/icons/skype.png
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/icons/SkypeBlue_16x16.png
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/icons/SkypeBlue_32x32.png
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/icons/SkypeBlue_48x48.png
%verify(md5 size link user group mtime mode rdev) %attr(0644L,root,root) %{_datadir}/pixmaps/skype.png
%{_datadir}/skype

%changelog
* Mon Nov 25 2012 Thomas Uphill 4.1.0.20
- update to latest version

* Tue Feb 05 2008 Skype Technologies S.A. 2.1.0.10
- bugfix: #98304, Groups: No menus without surprise key.
- bugfix: #98312, Debug logs have different Filenames.
- bugfix: fix for tabs issue with qt 4.4.0 forward ported from 2.0.
- internal: disable prelink for skype on fc9 and fc10.
- internal: lib update

Sorry for making you jump through hoops but I doubt skype would like me posting the src rpm. Good luck.

I wanted to be able to define nfs shares with puppet and have puppet take care of the exports line and exportfs. I found this page, but I didn't like that there was perl code thrown in the midst. I rewrote it to use an inline template instead.

The code is up on github at github.com/uphillian/puppet-nfsshare

The main difference is using an inline template to create the options to set.

$options_set = inline_template(" nfsopts.each do |opt| -set dir[.= \"= @nfsshare \"]/client[.=\"= @nfsaccess \"]/option[.=\"= opt \"] = opt\n end ")

I wanted to configure rate limiting on our exim server and needed to setup an ACL that I could include in multiple spots in the configuration. The keyword acl = acl_name is supported (referred to as nested ACL's) but the logic took a little bit of thought...

I want to ratelimit users, the acl for that is here:

warn authenticated = *
ratelimit = 50 / 1h / strict / $authenticated_id
message = Your account has sent over 50 messages per hour, the hourly limit is 100 - please contact support help@example.com to change this limit
log_message = WARN USER RATE EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max 500)

deny authenticated = *
ratelimit = 100 / 1h / strict / $authenticated_id
message = Your account has sent over 100 messages per hour - please contact support help@example.com to change this limit
log_message = RATE USER EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max $sender_

Now I wanted to turn this into a named acl and include it elsewhere. The logic of this tripped me up.


deny acl = acl_ratelimit_user

acl_ratelimit_user:
warn authenticated = *
ratelimit = 50 / 1h / strict / $authenticated_id
message = Your account has sent over 50 messages per hour, the hourly limit is 100 - please contact support help@example.com to change this limit
log_message = WARN USER RATE EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max 500)

deny authenticated = *
ratelimit = 100 / 1h / strict / $authenticated_id
message = Your account has sent over 100 messages per day - please contact support help@exmaple.com to change this limit
log_message = RATE USER EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max $sender_rate_limit)

The problem here is that I have

deny acl = acl_ratelimit_user

But the logic of this reads like this:
deny if the condition is true (accept). So I need to change the acl so that anything it accepts, I will deny. Anything that is denied in the acl results in acl = acl_ratelimit_user being false which means the deny won't apply and therefore the mail will be allowed. Once I understood that, it was easy enough to change the logic, the final solution is:

acl_check_data:
deny acl = acl_ratelimit_user
accept

# since we are including this acl elsewhere as a condition, we need it to return accept (true) when we want the top acl to deny.
acl_ratelimit_user:
warn authenticated = *
ratelimit = 50 / 1h / strict / $authenticated_id
message = Your account has sent over 50 messages per hour, the daily limit is 100 - please contact support help@example.com to change this limit
log_message = WARN USER RATE EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max 500)

accept authenticated = *
ratelimit = 100 / 1h / strict / $authenticated_id
message = Your account has sent over 100 messages per hour - please contact support help@example.com to change this limit
log_message = RATE USER EXCEEDED: $authenticated_id -> $sender_rate/$sender_rate_period (max $sender_rate_limit)

I also made a rule to limit hosts, the important thing to remember there is that your smart hosts or incoming hosts should be excluded. Again, the logic for that must be reversed. You need to deny a list of hosts in order for the acl to fail, which results in a pass higher up.

acl_ratelimit_host:
warn ratelimit = 75 / 1h / strict
message = This machine has sent over 75 messages per hour, the hourly limit is 150 - please contact support help@example.com to change this limit
log_message = WARN HOST RATE EXCEEDED: $sender_host_address -> $sender_rate/$sender_rate_period (max 500)

deny hosts = 172.16.12.31 : 172.16.12.32 : 172.16.13.151
accept ratelimit = 150 / 1h / strict
message = This machine has sent over 150 messages per hour - please contact support help@example.com to change this limit
log_message = RATE HOST EXCEEDED: $sender_host_address -> $sender_rate/$sender_rate_period (max $sender_rate_limit)

I ran into a snag when trying to update the bios on my PE R210ii, the Bios update is 8MB, too large to fit on a floppy image, so I needed to make a floppy image large enough for the file. I tried increasing the size of the Dell floppy image and that didn't work, so I had to start from scratch with a boot floppy made from windows. Funny enough the first link that came back in my google search was that of my coworker.

Here are the steps I took to get the large boot floppy working with PXE.

  • create boot floppy from Windows Server 2008 in a vm. I suspect using a boot image from bootdisk.com would work just as well.
  • expand the floppy image using newmkfloppyimg.sh. I chose to make a 20MB floppy.

    sudo ./newmkfloppyimg.sh 20 bigfloppy.img floppy.img

    This script requires you have mkdosfs, dd and mktemp, you need root to be able to mount the old and new floppy images and copy the contents. The key here is that it uses mkdosfs to make a new larger filesystem image (mkdosfs -I -v -C newfile size). Then it mounts the filesystem, copies the files from the old image to the new one. Finally it copies the boot sector from the original to the new using dd (that's the part I figured out manually before finding the script :-( )


    dd if=$OLDIMAGE of=$NEWIMAGE bs=1 count=10 conv=notrunc 2>/dev/null
    dd if=$OLDIMAGE of=$NEWIMAGE bs=1 skip=61 seek=61 conv=notrunc count=451 2>/dev/null

  • next I mounted the new image and copied the 8MB dell bios upgrade file onto the filesystem.


    [thomas@install: ~] $ mkdir /tmp/bigfloppy
    [thomas@install: ~] $ sudo mount -o loop bigfloppy.img /tmp/bigfloppy
    [thomas@install: ~] $ ls -lh PER210II_020005.exe
    -rw-rw-r-- 1 thomas thomas 8.2M Sep 13 08:47 PER210II_020005.exe
    [thomas@install: ~] $ sudo cp PER210II_020005.exe /tmp/bigfloppy/
    [thomas@install: ~] $ sudo umount /tmp/bigfloppy

  • Install syslinux and copy memdisk into the tftpboot directory.
  • Create a menu entry in our pxelinux config file.


    MENU BEGIN Bios
    MENU PASSWD superdupersecretpasswordnoguessing
    LABEL per20ii
    MENU label PE-R210ii
    kernel memdisk
    initrd bios/r210ii.img
    append floppy
    MENU END

    You can append to the "append floppy" line the number of cylinders, heads and sectors but my memdisk was able to guess them properly so I didn't.

  • PXEBoot the machine, select the Bios menu and enter the superdupersecret and you are off to the races.

My PowerEdge R210ii wouldn't boot with a QLogic 8GB Fibre channel card installed (just a cursor in the corner). After applying this Bios update the card is working great.

I've run into this enough times that I thought I'd write a little script to do the work for me.
It's just a simple one line call to python, but I wrapped it with some argument parsing.

It's a python script that takes a password and returns the salted sha512 hash by default. sha256 and md5 can be specified with switches.

The script is hosted at github here.

We maintain multiple repositories, many of which have the same rpms repeated in different locations. In order to save space we use hardlinking extensively. The hardlink command does an ok job of finding things to link, but we are only really interested in rpms and don't want repomod.xml or comps getting linked so I wrote a little python script to hard link all the rpms based on a checksum. The script is over at my github. hardlink_rpms

When using an mdbox or maildir mailbox, you need to use the dovecot-lda to deliver the message and not allow procmail to do this directly. I had a few issues getting this to work properly, here are the details of getting it going.

The first issue is that my procmail transport in exim needed to set user to the local_part and do initgroups to get the uid and gid of the localuser, then run procmail as that user/group. Here is that transport:


procmail_pipe:
driver = pipe
command = /usr/bin/procmail -d $local_part
return_path_add
check_string = "From "
escape_string = ">From "
user = $local_part
initgroups
envelope_to_add

The check_string and escape_string parts are from the manual, they just work around a bug in procmail where it would make a mistake if it saw a line starting with From.

Next I had to get deliver to do the right thing, in my case that meant taking off the group and user parts of the lda in dovecot.conf, so I made a separate dovecot-lda.conf with those settings commented out, the lda part of my config is also included.


#mail_privileged_group = mail
#mail_gid =12

protocol lda {
postmaster_address=root@example.com
mail_plugins = $mail_plugins sieve
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
log_path = /var/log/dovecot/deliver-errors.log
info_log_path = /var/log/dovecot/deliver.log
}

The postmaster_address is needed so that if there are errors with submission via lda, the errors will be delivered to this address, similarly we add log lines. We use sieve here so we append sieve to the plugins line. The next two lines are important, lda_mailbox_autocreate and lda_mailbox_autosubscribe. If the call to deliver names a mailbox that doesn't exist yet, deliver will create it. Without this line the mail fails if the box doesn't exist. The autosubscribe is there so that the box shows up in the users list after creation.

With a new config file, I wrote a small script that calls dovecot-lda with the appropriate config file.

<br />
#!/bin/sh</p>
<p>exec /usr/libexec/dovecot/dovecot-lda -c /etc/dovecot/dovecot-lda.conf $@<br />

I wasn't kidding about small...that's all it needs to do. I store this in /usr/bin/deliver and make sure it's selinux type is procmail_exec_t

<br />
[<a href="mailto:thomas@example">thomas@example</a>: ~] $ ls -Z /usr/bin/deliver<br />
-rwxr-xr-x. root root system_u:object_r:procmail_exec_t:s0 /usr/bin/deliver<br />

With these settings in place, you can make a procmailrc that calls /usr/bin/deliver


DELIVER="/usr/libexec/dovecot/deliver"
LOGFILE="$HOME/.procmail.log"
:0 c
! tuphill@gmail.com
:0
* ^From example@*
| $DELIVER -d $LOGNAME -m Example

:0 w
| $DELIVER -d $LOGNAME

In the above, any email from example@someplace will be delivered via dovecot to the Example mailbox, the rest of the mail will be delivered to the Inbox.

I also needed to make some selinux adjustments to allow procmail to run the dovecot-lda command as well as use the sendmail command (which is just exim). Here is my selinux policy for that part.


policy_module(procmail-sendmail,0.6)

require {
type dovecot_deliver_exec_t;
type dovecot_t;
type dovecot_var_run_t;
type exim_t;
type exim_log_t;
type exim_spool_t;
type procmail_t;
type procmail_exec_t;
type sendmail_t;
type var_lib_t;
}

allow procmail_t dovecot_deliver_exec_t:file { open read execute execute_no_trans getattr };
allow procmail_t dovecot_t:unix_stream_socket connectto;
allow procmail_t procmail_exec_t:lnk_file read;
allow procmail_t dovecot_var_run_t:dir search;
allow procmail_t dovecot_var_run_t:sock_file write;

allow procmail_t exim_spool_t:file { read write };

allow procmail_t sendmail_t:process { siginh rlimitinh noatsecure };
allow procmail_t var_lib_t:file read;

allow sendmail_t exim_log_t:dir search;
allow sendmail_t exim_log_t:file open;

allow sendmail_t exim_spool_t:dir { write search read remove_name open getattr add_name };

allow sendmail_t exim_spool_t:file { rename setattr read lock create write getattr open append };
allow sendmail_t exim_t:process { siginh rlimitinh noatsecure };

'cause enforcing is the only way to run...

I have a view of profile data that I want to sort by lastname. The name field currently has "firstname [middlename] lastname" in it. I looked around and found this example of using views php filter to sort based on a query.

I then made a query which ordered nid's by lastname and plugged that into my view as a filter.


SELECT nid,title,SUBSTRING_INDEX(title,' ',-1) AS lastname FROM node WHERE type='profile' ORDER BY lastname;

Running that query returns the nids in lastname order.
So my whole filter is the following:

$sql="select nid,title,substring_index(title,' ',-1) as lastname from node where type='profile' order by lastname;";
$sql = db_rewrite_sql($sql);
$result = db_query($sql);
while ($row = db_fetch_array($result)) {
$node_ids[] = $row['nid'];
}
return $node_ids;

Our aliases are spammed like any other account, but filtering on them would require making a real account. I wanted to be able to filter aliases without creating accounts for everything. My first solution was to create an account and filter on that one, then using $original_local_part I could forward to a filtered alias. This works but if someone discovers the filtered alias, they can bypass the filtering.

The exim docs suggested that I could have filtering in the aliases but it didn't seem to work and I kept getting this in the logs:

error in redirect data: missing or malformed local part (expected word or "

Looking closer at the docs I found this sentence:

If you are reading the data from a database where newlines cannot be included, you can use the ${sg} expansion item to turn the escape string of your choice into a newline.

Exim isn't interpreting the \n as a newline so it ignores the alias as a filter file. I added the sg to my data part on the alias router and voila, everything works.

data = ${sg{${lookup{$local_part}dbm{/etc/exim/aliases.db}}}{newline}{\n}}

This sg will take any occurence of the word newline in an alias and translate it into a newline. After that when I deliver -d I see the line being translated...


lookup yielded: # Exim filter newline if $sender_address contains proofpoint-pps newline then newline seen finish newline else deliver thomas@example.com newline endif
expanded: # Exim filter
if $sender_address contains proofpoint-pps
then
seen finish
else deliver thomas@example.com
endif

So aliases can be filtered like real accounts this way, you could use the #Sieve filter syntax too but the #Exim filter syntax works well enough for me.

The leap second has had been a problem for Java apps (389-console for me) and apparently some ruby apps (seems like puppet ((can't prove it)) ). I found the common fix is to just set the date based on the current date as shown here.

Doing this on all the machines, a single line with func.

func \* call command run 'date; date $(date +%m%d%H%M%C%y.%S); date'

The only thing to remember here is that $(something) is better than `something`, since the shell will do that locally first if I used backticks. And of course single quotes are better than doubles...

After running that, all the machines are happy again.

https://t.co/AGeihMALAv configuring grub2 with EFI Fri Sep 13 05:20:01 +0000 2019

I published a Thing on @thingiverse! https://t.co/IYpRyEb7Hz #thingalert Tue Jul 23 19:27:57 +0000 2019

Nokogiri install on MacOSX https://t.co/v3An0miW9L Fri Jul 12 15:06:49 +0000 2019

HTML email with plain mailer plugin on Jenkins https://t.co/Z6FSDMDjy8 Thu Jul 11 21:07:25 +0000 2019

git sparse checkout within Jenkinsfile https://t.co/tcL7V8mzFK Thu Jul 11 20:40:53 +0000 2019