hmm.. so what did I do today.
I modded darqbot to run in a chroot jail, this actually took some work;
- chroot/setre[U,G]id etc
- modify a bunch of paths in darqbot
- chdir twice to clean envs (didn't want to have env variables null, but wanted to wash them a bit)
- mount binded fs's inside the chroot jail, read only, ie:
mount -B /lib /darqbot/lib
mount -o remount,ro /darqbot/lib
had to do that with dev, usr, lib.. copied over etc manually, only a few files
so this means, darqbot now has a little fs people can play with through whatever mechanism, most likely the ^guile interface (scheme lisp interpreter).. since that scheme code can modify files/do all sorts of stuff, it needs to be jailed for basic protection.
- modify guile source slightly, to get rid of (system*) & (kill), as well as fork/exec etc..
- lisp processing and my pipe processing now goes hand in hang, you can do things like:
^e |^guile (display (gethost "aol.com"))) |^caps|^fgcolor(pink)
so lisp and my stuff can all be processed on the same line..
next step is to integrated my modules INTO guile, that will be very nice.. then i can do things like:
^e |^guile (^fgcolor pink) (gethost "aol.com")
plus it needs to understand my bot_t structure, so that power/admin users can actually use (system* ..) etc
etc
- having a slight problem with zombie procs in guile.. reduced 99% of the zombies by redoing my sigchld/sigpipe/sigsegv signal handlers & set up an alarm to kill any guile modules after 5 seconds, but 1 scenario is still causing a problem...
here's an example loop being processed: (dko is the bot)
02:56 < n9> ^e|^guile (let loop ((n 1)) (if (<= n 10) (begin (display n)(newline) (loop (+ n 1))))) |^multi
02:56 < dko> 1
02:56 < dko> 2
02:56 < dko> 3
02:56 < dko> 4
02:56 < dko> 5
...
without ^multi, it would print on the same line.. beast.
there's all sorts of limits and flood protection mechanisms in place, all of which can be set with the ^var trigger.
tomorrow i need to work on:
- adding arguments to my alias function
my idea so far is, a very basic argument structure, shell-like:
^alias test ^e $1 | ^rot13 | | hi $3 | yo $2
^a test one two three
-> xg hi three yo two
etc..
another example, incorporating a lisp func:
^a(add) dns ^e | ^guile (display (gethost "$1")) <-- set the alias
^a dns adarq.org <-- resolve adarq.org
the alias would expand to
^e | ^guile (display (gethost "adarq.org"))
really happy about implementing guile.. darqbot is now 1000000x more powerful.
damn this is my longest post in a while.. i write stuff like this down every day in my code-journal thing, so im going to move it into my actual journal..
;d