Uncategorized

Change your default shell in FreeBSD

With all the hype surrounding Ubuntu, I decided to go a different direction and try out FreeBSD. I like to do the opposite of what everyone else does.

The install was smooth, the initial login was great. And so here I am, at the command-line.

First thing, I gotta have bash. sh just dosen’t cut it for me. So… how to do that??

which bash returned nothing. whereis bash says I have a copy, but I’m not famaliar with the ports system to know how to start. I dug through some docs and found this:

Log in as root and do:

pkg_add -r bash

This will download bash and its dependencies from, um, the, repository? I’ve got a lot of new terms to learn.

Is it there?

grep bash /etc/shells

/usr/local/bin/bash

awesome. its there and waiting. Now to make it my new default!

As user, do:

chsh -s /usr/local/bin/bash
enter your password,
log out,
log in,
echo $SHELL
/usr/local/bin/bash

Yeah!

Well that was easy, whats next?

Use syslog-ng on RHEL3 to report authentication activity to a Snare server

The default syslogd under RHEL3 does not report a date and timestamp when used to log user authentication activity to an external source (Snare, remote syslogd, etc). Syslog-ng can run side by side or as a replacement to RedHat’s syslogd facility. These instructions were written while I was working on a workstation that was reporting to a Snare micro-server on a Windows machine.

As root (or sudo), install the package: (Note: This is probably available from DAG)

rpm -ivh syslog-ng-1.6.9-1.el3.i386.rpm

Make it run on boot:
chkconfig syslog-ng on

Edit the file: /etc/syslog-ng/syslog-ng.conf

Change the destination d_auth line – replace the IP with the IP (or name) of the Snare micro-server (or other external logging source):
destination d_auth { udp(“192.168.1.10” port(514) localport(999)); };

Start the service:
service syslog-ng start

There is 1 additional parameter you might need to change if you don’t see syslog auth messages getting through.

/etc/syslog-ng/syslog-ng.conf:

Change:
filter f_filter3 { facility(authpriv); };

To read:

filter f_filter3 { facility(authpriv) or facility(auth); };

Save, exit, restart syslog-ng.

Picasa for Linux !

Google today released Picasa for Linux. Amazing stuff!

http://picasa.google.com/linux/index.html

Active Directory authentication with SuSE Linux 9.3

Note: The following is probably incomplete but is a useful overview of the process.

Overview:

Install missing software packages (kerberos, winbind – see notes below)

Extract pre-configured config files to / from .tar.gz (on euler)

Add euler to /etc/hosts

Configure kerberos

Setup smb.conf (see notes below)

Get kerberos ticket

Join domain

insserv (updates /etc/init.d/rcX.d)

————————————————————–

Kerberos:

Yast, Network Services, Kerberos
Add missing packages when prompted
Domain, realm, and server should already be populated. If not, use:
domain=janus, realm=JANUS.LOCAL, server=euler
Finish

———–

Winbind:

Yast, Software, Install and Remove Software
search for: winbind
Select package, Accept
Finish

System, System Services (Runlevel)
Select expert, winbind, Enable. Make sure runlevels 3 – 5 are enabled
Disable firewall if enabled

Edit /etc/samba/smb.conf
Change netbios =

Join domain:

kinit
klist

net ads join -U

insserv

reboot

password-less ssh logins

Log in to a RHEL3 Linux box. In your home dir, if you have a .ssh dir, back it up to some other dir name. (ssh-original, or whatever you like):

mv .ssh ssh-original

Generate the rsa keypair, but don’t create a passphrase (press enter when prompted for one):

ssh-keygen -t rsa

Copy your public key to your authorized_keys:

cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys

In addition, generating a rsa version 1 keypair will allow you to access most all other hosts not running Open-SSH: (Protocols v1.2, v1.3, etc)

ssh-keygen -t rsa1

…and then, cat .ssh/identity.pub (append) to .ssh/authorized_keys:

cat ~/.ssh/identity.pub >> ~/.ssh/authorized_keys

Perms are important for this to work. Check that your .ssh dir is mode 755:

chmod 755 .ssh/

Also, we found that your home dir cannot be group or world writeable. Mine looks like this:

drwxr-xr-x 130 jloconne genusers 23K Sep 14 09:58 /accts/jloconne/

ssh into whatever you want. The first time you encounter a machine you’ll be prompted to save its key into you .ssh/authorized_hosts file. After that you’ll never be prompted again.

Subversion for RHEL3

As root, install subversion from dag: (see earlier post for enabling DAG repo for RHEL3)

apt-get install subversion

As user, generate config dir:
svn co

If your behind a proxy:

Edit ~/.subversion/servers
section [global] (toward end of file)

Uncomment and change the following line:
http-proxy-host = proxy

Check something out

Example:
svn co https://svn.sourceforge.net/svnroot/gaim/trunk gaim

bcm43xx on iBook G4 w/Ubuntu Breezy

d/l – ieee80211, softmac, bcm43xx, precompiled 2.6.15.1 kernel + source

install build-essential, kernel-package

Magic formula:

1) Install kernel
2) Extract source kernel to /usr/src, make linux symlink
3) Copy /boot/config-2.6.15.1 /usr/src/linux/.config
4) make-mpkg clean
5) make-kpkg –initrd –stem linux –revision=temp1.0 kernel_image
Let it build until it gets past scripts/, then Ctrl-C
6) ybin -v
7) Reboot into new kernel.
7.5) Make symlink from /lib/modules/2.6.15.1/build to /usr/src/linux/2.6.15.1
8) Install ieee80211, answer Y to all questions regarding removing files + links
9) Install softmac
10) Install bcm43xx driver. Edit bcm43xx.h, comment out checks for CONFIG_IEEE80211
11) modprobe bcm43xx

YEAH!

26 lines of code to help me remember how to make a connection to a MySQL database from a .php script

Adding a user into mysql

mysql
use mysql
select * from users G; (to get the format)
insert into users (Host, User, Password, Select_priv, etc) values (“localhost”, “php”, Password(“f00”), “Y”, etc);
flush privileges;
quit
mysql -u php -p

—————————-
*making the connection*
config/config.php:

—————————-
whatever.php:

How to run stuff on an Actiontec DSL router

I read somewhere that 2 geeks got BitchX to run on an Actiontec router. The link to the site never worked,
so I set off on my own quest to make it work.

First, your gonna need to setup a toolchain. Dan Kegel’s crosstool produces binaries that work on the router:

http://kegel.com/crosstool/

un tar, move into contrib

next

mkdir -p /opt/crosstool
chown $USER /opt/crosstool

./demo-mips

BitchX needs ncurses and ncurses needs to be re-compiled aginst uClibc to work correctly, so:

Cross compiling ncurses 5.4 for an Actiontec GT DSL Router

Get the source:

http://www.gnu.org/software/ncurses/ncurses.html

extract

./configure
make sources

setup cross-compile environment – heres mine:

export BASE=~jloconne/mips-bin/
#export LINUX=$HOME/snapgear/linux-2.4.x/include/
export TOOLSBASE=/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/bin/mipsel-unknown-linux-uclibc
export CC=$TOOLSBASE-gcc
export STRIP=$TOOLSBASE-strip
export RANLIB=$TOOLSBASE-ranlib
export LDFLAGS=”-L/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/mipsel-unknown-linux-uclibc/lib -L/accts/jloconne/ncurses-5.4/lib”
export CFLAGS=-I/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/mipsel-unknown-linux-uclibc/include/
#export CFLAGS=”-I/accts/jloconne/actiontec-source/linux-2.4.17_mvl21/include/asm/”

export DEST=/accts/jloconne/mips-bin

./configure –host=mipsel-linux –without-ada –without-progs –without-cxx –prefix=$DEST

make
make install

Now, compile BitchX

Get source,
un-tar

Tell autoconf where to find your new ncurses lib

export LDFLAGS=/path/to/ncurses/lib

./configure
make

Now, strip the binary to save space,

/opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.3-uClibc-0.9.23/bin/mipsel-unknown-linux-uclibc-strip BitchX

The easiest way I’ve found to put binaries on the router is by placing it on an ftp or web server, then doing
a wget once your telnetted in.

ftp blah.blah.com

then, telnet to the router, and switch to /var/tmp

wget ftp://IPaddress/BitchX
wget ftp://IPaddress/vt102

mkdir ./terminfo/v
mv vt102 ./terminfo/v

export HOME=.

chmod 700 BitchX

./BitchX

There you have it…