Record of some of the computer tech I deal with so that it's documented at least somewhere.

Monday, 31 August 2009

mouting a cd in Plan 9

#!/bin/rc
cdfs
rm -f /srv/cd.d000
9660srv -f /mnt/d000 cd.d000
chmod +r /srv/cd.d000
chmod +w /srv/cd.d000
mount /srv/cd.d000 /n/cd

Inferno on OpenBSD 4.6

got mercurial once I got the ports worked out.

ack, all went horribly wrong, no X source, what a todoo

Sunday, 30 August 2009

OpenBSD 4.6 packages

It all started with
# cd /usr/ports/*/mercurial
# make
===> mercurial-1.3.1 depends on: python->=2.5,<2.6 - not found
===> Verifying install for python->=2.5,<2.6 in lang/python/2.5
===> python-2.5.4p2 uses X11, but /usr/X11R6 not found.
===> Returning to build of mercurial-1.3.1
===> mercurial-1.3.1 depends on: python->=2.5,<2.6 - not found
===> Verifying install for python->=2.5,<2.6 in lang/python/2.5
===> python-2.5.4p2 uses X11, but /usr/X11R6 not found.


er, wtf

Seems the package system has undergone some changes while I've been away.

so the upshot is you need a PKG_PATH set and take binary installs. Ah, the Plan9 way comes to OpenBSD, well done Theo!

The only problem is that you're left to your own devices to find a package store you can trust!

Does it really need so many mirrors. You'd have thought it would find one for you out of the box, perhaps it does, it's not like I've read any documentation.

anyway ratfans, here's mine.

PKG_PATH=ftp://ftp.plig.net/pub/OpenBSD/snapshots/packages/i386

Thursday, 27 August 2009

Reverse shell with tcpserver

I've got an ssh server that is v2 only

on it I run
ssh2srv % tcpserver -v 127.0.0.1 9999 srvrc

srvrc is
#!/usr/local/plan9/bin/rc
/usr/local/plan9/bin/rc <>[2=1]

on a local Lunix box I run
ssh2client % ssh -N -L 192.168.9.2:5999:localhost:9999 ssh2only

then finally on plan9 I run
p9 % srv tcp!192.168.9.2!5999 rc
p9 % con -C /srv/rc


and I get

post...
%


and I have my prompt.

Lunix is your dad.

"Unix never says please.'" said the cheese.

Some Lunix apps bleat if you make some system files group writeable, some even refuse to run. They email me every week to let me know.

These apps trust neither their ecosystem or their administrators.

Now sit back and wait for "anatomy of my pwnage".

Wednesday, 26 August 2009

BASH CAN FUCK RIGHT OFF

When once more one is bitten by a=oh and a = oh being different it is time to stop pretending Bash is a usable product.

That's without thinking abut the runtime penalty of all that shit like history and fucking command line completion that are there to defend you from your badly planned filesystem layout.

A per computer view of the filesystem, shit, you may as well drop to single user.

...

Even hours later my invective hasn't lessened. I've been using it all day. I say using, more like flinging faeces at the plexiglass through which no-one is looking.

Always battling, never a joy.

Emacs or vi is like Beatles or Rolling Stones ?

Tuesday, 25 August 2009

Plan9 Command Line History

or rather

"If you would learn to think more clearly Mr. Edison, you wouldn't have to sweat so much"

Command line history rewards sloppy preparation.

fn f { echo do shit; whatis f }; f

losers

Monday, 24 August 2009

Alcatel / Thompson SpeedTouch 330 on OpenBSD

I've got the green one.

The actual process was a damn sight easier than that blinking instructions suggested.

Get yourself OpenBSD4.6 & install it

Get your source from http://speedtouch.sourceforge.net/
I used vers 1.3.1 which hasn't seen an update for years which is good.

The Thompson drivers have moved to http://www.thomson.net/GlobalEnglish/Deliver/In-Home-Digital-Distribution/Telco-ISP/dsl-modems-gateways/residential_wired/other_supported_products/thomson_st330/Pages/default.aspx

Though I got mine pre-packaged from here
http://speedtouch.hysplace.co.uk/latest/Kqd6_3.012

I chopped all of the usb startup out of speedtouch-start :

# Goal: Start the connection

# Ensure to have a working PATH
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

# check for root privileges

#
# FIRMWARE_LOADER_FILE
# FIRMWARE_FILE
# PPPD_PEER
#

if [ -f /etc/speedtouch/speedtouch.conf ]; then
. /etc/speedtouch/speedtouch.conf
fi

the rest was the same

speedtouch.conf is

FIRMWARE_LOADER_FILE="/etc/speedtouch/Kqd6_3.012"
FIRMWARE_FILE="/etc/speedtouch/Kqd6_3.012"
MODEM_RUN_OPTIONS=""
PPPD_PEER=speedtouch-pppoa


/etc/ppp/chap-secrets isn't :>
"alphas@example.dsl" "*" "W00t"

/etc/ppp/ppp.conf
these are supposed to be indented with just the ones with a colon in column zero, like a c label

default:
ident user-ppp
set log Phase Chat IPCP CCP tun command
set ifaddr 10.0.0.1/0 10.0.0.2/0

adsl:
set authname alphas@example.dsl
set authkey W00t
set device !"/usr/local/sbin/pppoa2 -vpi 0 -vci 38 -v 1" # find your own, this is BT UK on griffin adsl
accept chap
set speed sync
set timeout 0
set redial 15 10000
set dial ""
add default HISADDR
enable dns

Connection:


/etc/rc.local

/usr/local/bin/speedtouch-start
ppp -nat -ddial adsl


/etc/sysctl.conf
net.inet.ip.forwarding=1 # 1=Permit forwarding (routing) of IPv4 packets
net.inet6.ip6.forwarding=1 # 1=Permit forwarding (routing) of IPv6 packets

Das Brickenn vas Goot

EPIA as a router, got the OpenBSD 4.5 disk, got it installed once I reset the partitions as the default it gave me for an 8gb can't install the ports on itself!

First thing I have to do is add packet forwarding

# echo "net.inet.ip.forwarding=1" >> /etc/sysctl.conf
# echo "net.inet6.ip6.forwarding=1" >> /etc/sysctl.conf


I guess I should play with IPv6 some time, anyway lets go nattin
/etc/pf.conf

ext_if = "tun0 "
int_if = "vr0"
int_net = "vr0:network"
lan_net = "192.168.9.0/24"

momos = "{ 993 25 22 }"
pigs = "{ 80 222 }"

# nat on $int_if to any -> $(ext) - ppp is natting for me
# even though my IP is fixed, it's still assigned by dhcp

table const { self }
set skip on lo0
# it doesn't like the next line
# scrub in all
block all
block in quick from urpf-failed
pass in on $int_if from $lan_net to any
pass out on $int_if from any to $lan_net
pass out on $ext_if proto { tcp udp icmp } all modulate state
pass in on $ext_if proto tcp from any to ! port ssh synproxy state
rdr log on $ext_if proto tcp from any to any port $momos -> 192.168.9.14
pass in on $ext_if proto tcp from any to any port $momos
rdr log on $ext_if proto tcp from any to any port $pigs -> 192.168.9.6
pass in on $ext_if proto tcp from any to any port $pigs

Sunday, 23 August 2009

dumping venti arenas

It's about time I dumped my venti arenas.

Here's the script I'm using to read the arenas.


#!/bin/rc

! test -w /dev/sdC0/arenas && status='not hostowner' && exit

rfork e

echo `{date -n} `{fossil/last $1/fossil} >> vacs

# sort this bit out to cd to the backup dir
9fs momo
cd /n/momo/home/t23/arenas
# in backup dir

fn do{
b=`{echo $1 | sed -e 's!/dev/!!g' -e 's!/arenas!!g'}
b=$b(1)
if(~ $#3 0)
venti/rdarena $1 $2 > $b.$2
if not
if(! test -e $b.$3)
venti/rdarena $1 $2 > $b.$2.$3 && rm -f $b
}

fossil/last >> vacs

hget http://127.1:8000/index |
awk '
/^arena=/ { arena=substr($1, 7); score=""}
/^ arena=/ { dev=$3 }
/^ score=/ { score=substr($1, 7) }
/^ written:/ { print "do " dev " " arena " " score }
' |rc


which is adapted from Russ' restore script.
I added the hostowner check and I' not sure it works so note that

next up I have to work out if the final score is checkable outside venti, i.e it could be the hash of the whole arena.

Wednesday, 19 August 2009

blogger fs new tool


% cat /bin/blg
#!/bin/rc

echo -n 'Title: '
title = `{read}
echo -n 'Tags: '
tags = `{read}
echo -n 'Draft: '
draft = `{read}
if(~ $draft Yes) draft = 'Draft: yes
'
{
echo 'Title: ' $"title
echo 'Tags: ' $"tags
echo -n $draft
cat
} > /n/blogger/new


The slight use advantage of the FS for this is that you can export it once you have authenticated and hand it to a service.

Off the top of my head you could run fossil/last and save it as a draft post on blogger.

It also means you can use blogger as a storage system for your CP

Tuesday, 18 August 2009

New Post

Text for new post

write only group blog

quad% import t23 /srv/ /n/bsrv
quad% mount /n/bsrv/blogger /n/blogger
quad% { echo 'Title: New Post'; echo 'Text for new post' } > /n/blogger/new

bloggerfs in action

How plan9 people do stuff

Set up your blogger account with factotum (typing your password at the prompt)

% g=maht.lawless@googlemail.com
% auth/factotum -g 'proto=pass server=www.google.com user='$g' !password?'

!Adding key: proto=pass server=www.google.com user=maht.lawless@googlemail.com
password:
!

% blogger/blogs $g
3062883415508658133 compjootery
% blogger/actionfs $g 3062883415508658133
% { echo 'Title: Date demo'; echo 'Tags: demo, blogger' ; date} > /n/blogger/new
% cat /n/blogger/posts
3931523848251033590 Date demo
% cat /n/blogger/3931523848251033590
Title: Date demo
Tags: blogger, demo
Tue Aug 18 21:01:07 GMT 2009
% { echo 'Title: Date demo'; echo 'Tags: demo, blogger' ; date} > /n/blogger/3931523848251033590
% cat /n/blogger/3931523848251033590
Title: Date demo
Tags: blogger, demo
Tue Aug 18 21:01:25 GMT 2009
%

Fixed some bugs in bloggerfs

blogger/read | blogger/update now works as it should
This entry is posted with it.

Sounds come to my plan9 terminal

The Edirol UA-3D works great for dfm
hget `{hget http://dfm.nu/dfm_1.m3u | grep http} | madplay -
Here's the stats
quad% usb/audio -V
Audio output unit 1
Dev can record from Line connector
Audio input unit 13
Dev can play to USB Streaming
Audio Selector Unit 11
Audio Feature Unit 9 for Playback
mute control on master channel
volume control on channel 1
volume control on channel 2
Interface 1: mono, 16 bits, discrete frequencies are: 32000 44100 48000
Interface 1: stereo, 16 bits, discrete frequencies are: 32000 44100 48000
Interface 2: mono, 16 bits, discrete frequencies are: 32000 44100 48000
Interface 2: stereo, 16 bits, discrete frequencies are: 32000 44100 48000
usb/audio: playback on ep 2
usb/audio: record on ep 2
usb/audio: buttons on ep 1
Setting default play parameters: 44100 Hz, 2 channels at 16 bits
Setting default record parameters: 44100 Hz, 2 channels at 16 bits
Warning, can't configure record for 44100 Hz, configuring for 48000 Hz instead
Playback speed control, value 44100
Playback mute control, value 0
Playback volume control, min -5888, max 2048, step 256, values[1] -2048 [2] -2048
Playback channels control, min 1, max 2, value 2
Playback resolution control, min 16, max 16, value 16
Record speed control, value 48000
Record channels control, min 1, max 2, value 2
Record resolution control, min 16, max 16, value 16


Here's the stats for the Creative Soundblaster USB
Note the : Warning, can't configure playout for 44100 Hz, configuring for 48000 Hz instead

Audio output unit 1
Dev can record from Microphone
Dev can record from Line connector
Dev can record from S/PDIF
Audio input unit 7
Dev can play to USB Streaming
Audio Selector Unit 8
Audio Feature Unit 9, not known what for
mute control on master channel
volume control on channel 1
volume control on channel 2
Audio Feature Unit 10 for Record
mute control on master channel
volume control on master channel
agc control on master channel
Audio Feature Unit 11 for Record
Second feature unit (10, 11) on record
mute control on master channel
volume control on channel 1
volume control on channel 2
Audio Feature Unit 12 for Record
Second feature unit (11, 12) on record
mute control on master channel
Audio Feature Unit 13 for Record
Second feature unit (12, 13) on record
mute control on master channel
volume control on master channel
Audio Feature Unit 14 for Record
Second feature unit (13, 14) on record
mute control on master channel
volume control on channel 1
volume control on channel 2
Audio Mixer Unit 15
Mixer 15 for I & O
Mixer 15 for I & O
Interface 1: stereo, 16 bits, discrete frequencies are: 48000
Interface 2: stereo, 16 bits, discrete frequencies are: 48000 44100
usb/audio: playback on ep 1
usb/audio: record on ep 1
Setting default play parameters: 44100 Hz, 2 channels at 16 bits
Warning, can't configure playout for 44100 Hz, configuring for 48000 Hz instead
Setting default record parameters: 44100 Hz, 2 channels at 16 bits
Warning, can't configure record for 44100 Hz, configuring for 48000 Hz instead
Playback speed control, min 48000, max 48000, value 48000
Playback channels control, min 2, max 2, value 2
Playback resolution control, min 16, max 16, value 16
Record speed control, min 48000, max 44100, value 48000
Record mute control, value 1
Record volume control, min 0, max 12240, step 48, values[1] 9168 [2] 9168
Record agc control
Record channels control, min 2, max 2, value 2
Record resolution control, min 16, max 16, value 16




Sunday, 16 August 2009

And acme posts

I'm going to upload what I have so far and leave the rest to fate.

Date demo

Tue Aug 18 22:29:27 GMT 2009

post from bloggerfs

A new darn post

Now with editing in Acme

Hello from plan9 python

bloggerfs incoming

Friday, 14 August 2009

HG Unwells?

(while making this and feeding back, the packages are being changed so its worth checking

--rw-rw-r-- M 149 bichued sys 5510112 Oct 17 2008 python-2.5.1-ape.tgz
quad% md5sum python-2.5.1-ape.tgz
ac73a8b4fcb38b966e81fe8ad3aa50e1 python-2.5.1-ape.tgz
%
)

ok, somehow bichued is involved, that dastardly hacker

http://plan9.bell-labs.com/sources/contrib/bichued/python/

He's got hg, python the darn lot going on in there

The excitement is killing me as it copies. I wonder if I'll ever write copy-with-progress, everything is just waiting for it.

Oh I added python to linuxemu already, ver 2.3.5, handy little box I suppose.

The instructions for it are in /n/sources/contrib/bichued/python-2.5.1-ape.tgz
cat Readme.Plan9

got some contribs to install (ooh first time I have fgb/contrib tools, I am honoured)

the order in the list of contribs is wrong
lcms depends on tiff
and png depends on z
tiff & xml depend on z

openssl is a monster


k now I need to patch ape
ramfs
bind -ac /tmp /n/sources/patch/ape-chmod-dirbit
patch/apply ape-chmod-dirbit
bind -ac /tmp /n/sources/patch/applied/ape-ftruncate
patch/apply applied/ape-ftruncate

I got some perm errors on the last one but the update seems to have worked

The mkfiles need adjustment for python-2.5.1-ape, I got away with this :
% cd python-2.5.1-ape
% grep 'CFLAGS=' `{walk | grep mkfile}
Extra/mkfile:CFLAGS=-c -I.. -I../Include -DT$objtype -DNDEBUG -D_SUSV2_SOURCE
Modules/mkfile:CFLAGS=-c -I. -I.. -I../Include -DT$objtype -DNDEBUG -DPLAN9 -D_SUSV2_SOURCE
Objects/mkfile:CFLAGS=-c -I.. -I../Include -DT$objtype -DPy_BUILD_CORE -DNDEBUG
Parser/mkfile:CFLAGS=-c -I.. -I../Include -DT$objtype -DPy_BUILD_CORE -DNDEBUG
Python/mkfile:CFLAGS=-c -I.. -I../Include -DT$objtype -DPy_BUILD_CORE -DNDEBUG
mkfile:CFLAGS=-FVwN
mkfile:CFLAGS=-c -I. -IInclude -DT$objtype -DPy_BUILD_CORE -DNDEBUG -D_SUSV2_SOURCE
% mk install
...
% python
Python 2.5.1 (r251:54863, Aug 15 2009, 21:45:20) [C] on plan9
Type "help", "copyright", "credits" or "license" for more information.
>>>


now for hg

bind python-2.5.1-ape /n/python
; bind -a /n /tmp
; cd hg-1.0.2
; mk install

; hg -v
Mercurial Distributed SCM (version 1.0.2)

Thursday, 13 August 2009

Adventures in Linuxemu

Installation is exactly as cinap says

But the apt sources have moved
deb http://archive.debian.org/debian sarge main

Now apt-update worked

apt-get install host
got me a working host

apt-get install python
would have got me python2.3 but I cancelled it

Upgrading to etch is not possible because etch requires the "dswap" instruction

adding privoxy to test sockets

apt-get -y install privoxy
it's also installing adduser & cron

adduser is failing to lock /etc/passwd so wont add new users

trying apt-get -y install ssh
it asks you if you want to disable ssh 1 buy i can only say yes!

worse than that, it ignores the -y

So I went for proftpd and it's hauled in the army - 6M expanding to 25M - no questions asked!

Same option problem so I mashed the keys and it worked but I don't know what I chose, inetd or standalone

dammit, that wants user ftp, didnt think of that

should have tried nc instead

anyway gone for vnc4server which drags in X !

can't open display

Wednesday, 12 August 2009

Net booting Plan9

This *should* be easy, eventually it was!

NVidia Bootagent doesn't like it but IBM Boot Agent v.1.2.2 is a worker

/cfg/pxf/ is being picked up
it needed a ether= ip= in /lib/ndb/local

after working out the pxe file I ended up with :

ether0=igbe
monitor=vesa
vgasize=800x600x8
mouseport=ps2intellimouse
user=maht
bootfile=ether0!/386/9pc
bootargs=tcp!t23
nobootprompt=tcp!t23
*nomp=1 # vesa graphics boo hoo


I added secstore to the server and added myself as a user

I fiddled around with lib/profile and added factotum
now you get prompted for your secstore password twice, profile then imports your home directory using your auth and you can write to it. Means you have to shuffle your profile round a little bit, mine's now

fn bins {
bind -a $home/bin/rc /bin
bind -a $home/bin/$cputype /bin
bind -c $home/tmp /tmp
bind -a /usr/inferno/Plan9/386/bin/ /bin
}

font = /lib/font/bit/lucidasans/unicode.8.font
prompt=($sysname^'% ' ' ')
fn $sysname%{ $* }
fn acme { /bin/acme -f /lib/font/bit/lucidasans/unicode.7.font $* }
timezone=`{cat /adm/timezone/local}
switch($service){
case terminal
auth/factotum
import t23 / /n/t23
bind -c /n/t23/usr/$user /usr/$user
bind -c /n/t23/usr/$user/tmp /tmp
bind -c /n/t23/usr/inferno /usr/inferno
bins
plumber
upas/fs
echo -n accelerated > '#m/mousectl'
echo -n 'res 3' > '#m/mousectl'
exec rio
case cpu
bins
if (test -e /mnt/term/mnt/wsys) {
# rio already running
wsys = /mnt/term^`{cat /mnt/term/env/wsys}
bind -a /mnt/term/mnt/wsys /dev
echo -n $sysname > /dev/label
}
bind /mnt/term/dev/cons /dev/cons
bind /mnt/term/dev/consctl /dev/consctl
bind -a /mnt/term/dev /dev
upas/fs
news
if (! test -e /mnt/term/mnt/wsys) {
# cpu call from drawterm
plumber
auth/factotum
exec rio
}
case con
bins
news
}