Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2010-01-07:

[12:24] <ondras> Wes-: finally! I managed to compile+run v8cgi on your mac!
[14:59] <Wes-> ondras: *awesome*!
[19:29] <Dantman> Wes-, you up for another session of helping an inexperienced sysadmin?
[19:30] <Wes-> Dantman: perhaps! :)
[19:32] <Dantman> We got a report saying that one of our servers was doing port scans.
[19:34] <Dantman> I need to track down what is supposedly doing that without my knowledge.
[19:35] <Wes-> hehehe
[19:35] <Wes-> what OS is the server?
[19:35] <Dantman> ubuntu
[19:35] <Wes-> I'll bet, BTW, that the server has been compromised
[19:36] <Wes-> unless you don't have tight controls on logins
[19:36] <Wes-> now, are the port scans ongoing?
[19:36] <Dantman> We use ssh keys
[19:36] <Wes-> yes, but if some idiot logs in and runs a port scan, that will get detected as a port scan, you know?
[19:36] <Wes-> so, many users? few?
[19:37] <Dantman> We only got one report about a large port scan to one network
[19:37] <Dantman> Different IPs on the same network, being scanned for 5060 and 1080
[19:39] <Wes-> dantman: got voip?
[19:39] <Dantman> Not that I know of.
[19:40] <Wes-> Dantman: probable outcome -- you have an intruder looking for SIP (to make free calls) and open socks proxies
[19:40] <Wes-> Dantman: if scan is ongoing (verify via tshark), use ??? to locate offending PID
[19:40] <Wes-> ??? might be lsof on Linux, it's pfiles on solaris
[19:40] <Wes-> pfiles `pgrep .` > bigfile.txt
[19:42] <Wes-> CommonJS question: how do I implement an iterator in JS? Is that different than while (condition) { yield stuff; } ?
[19:42] <Wes-> hdon ^
[19:43] <Wes-> Or is the description of the methods in the fs-base spec enough?
[19:43] <Wes-> (i.e. I make an object does that, is it an Iterator?)
[19:49] <Dantman> Wes-, ever heard of "sockdd"?
[19:49] <Wes-> Dantman: no
[19:50] <Wes-> was that running on your box?
[19:50] <Dantman> Aye, /sbin/sockdd
[19:50] <Wes-> ubuntu?
[19:51] <Dantman> mhmm
[19:51] <Dantman> What command was it to check if a file is part of a package?
[19:51] <Wes-> Dantman: not there on a stock ubuntu 9.04, fwiw
[19:52] <Wes-> Dantman: No clue. That's linux-specific. OTOH, you should strings the binary and see what's in it
[19:52] <Wes-> ldd it, too
[19:52] <Wes-> but not as root
[19:52] <inimino> Wes-: that's a generator: https://developer.mozilla.org/En/Core_JavaScript_1.5_Guide/Iterators_and_Generators
[19:52] <ashb> Dantman: dpkg -S or -L
[19:52] <inimino> Dantman: dpkg -S or some such
[19:52] <inimino> man dpkg-query
[19:52] <Dantman> 8.04 actually, it's an old machine
[19:53] <Wes-> inimino: So, fs-base asking for next() and prev() is maybe out to lunch? http://wiki.commonjs.org/wiki/Filesystem/A/0#Listing
[19:53] <ashb> can you go backwards with readdir?
[19:53] <ashb> been a long time since i used it directly
[19:54] <Wes-> ashb: readdir can't
[19:54] <ashb> Wes-: a generator has .close(), .next() (and also .send(x) ) methods
[19:54] <Wes-> here is my current impl, seem like what the spec calls for? http://pastebin.mozilla.org/695483
[19:54] <Wes-> ashb: Huh, I've never used 'em in anything other than a loop, I guess!
[19:55] <ashb> Wes-: so yeah, that is the .next() function
[19:55] <inimino> Wes-: seems alright
[19:55] <inimino> (the spec, anyway)
[19:55] <inimino> ashb: that's the interface of an Iterator, right?
[19:55] <inimino> a generator is a function that returns an iterator
[19:55] <ashb> Wes-: oh and cos of the yield you get everything but .next()
[19:55] <ashb> thow the throwing StopIteration is uneeded. i think a simple return; is good enough due to the yield
[19:55] <ashb> *though
[19:56] <Wes-> So, if fs-base wants backwards iterate, that means we need to buffer and implement our own Iterators? Doesn't seem ideal to me...
[19:56] <ashb> inimino: an iterator has ot spec
[19:56] <ashb> Wes-: yeah its probably also not very useful
[19:56] <Wes-> *making notes*
[19:56] <Wes-> ashb: what did you do in flusspferd?
[19:57] <ashb> dont yet
[19:57] <ashb> never got round to it
[19:57] <ashb> (the iterator list
[19:58] <ashb> Wes-: seekdir and telldir?
[19:58] <Wes-> Oh, I thought you were just missing permissions
[19:58] <ashb> so did i
[19:58] <ashb> until you mentioned that
[19:59] <Wes-> ashb: Maybe, although... that starts to get ugly if the directory changes during iteration (which is actually the common use-case here!)
[19:59] <ashb> Wes-: its not much different form it changing between going forward is it?
[19:59] <ashb> oh tho i spose seek/tell is differnt
[20:00] <Wes-> ashb: FWIW I also exposed a sortParameter in the list() function, figure it's cheap and easy and might be handy
[20:00] <Wes-> ashb: yeah, going forward, you always a meaningful value, at least at time-of-read
[20:00] <ashb> yeah i think the boost fs lib only has forward iteration as well
[20:00] <ashb> wonder what narwhal does
[20:01] <ashb> it doesn't it seems
[20:01] <Wes-> ashb: got extended attributes? That's the only thing I'm missing, I think.
[20:01] <Wes-> Well, besides backward iteration and tests
[20:02] <ashb> i was about to say i have some tests, but i dont. its just two small regressions
[20:03] <ashb> had a bug in my canonicalize at one point: fs.canonical('..') != fs.canonical('../..')
[20:03] <Wes-> I'm sure I have tonnes of bugs, I just finished pounding out ~800 LOC without testing any of them. ;)
[20:05] <ashb> heh. boost fs lib has a very similar API to fs-base, so most methods are 3-4 lines
[20:13] <Dantman> Wes-, should I save that suspicious program somewhere before I delete it?
[20:13] <Wes-> Dantman: yes, absolutely
[20:13] <Wes-> Dantman: and deleting it doesn't mean it's not running any more
[20:14] <Wes-> Dantman: lsof it first
[20:14] <Wes-> see where it's writing its log files
[20:14] <Dantman> It's not in ps anymore
[20:15] <Dantman> I killed it... Now to deal with the report
[20:15] <Wes-> Dantman: you know you have to consider that box compromised, right? all keys, all passwords, etc need to be burnt
[20:22] <ashb> Wes-: re canonical: i think we might need two functions
[20:22] <ashb> normalize and canonicalize
[20:23] <ashb> or maybe even 3: one that tidies up '/../' and '//', one that does that and resolve symlinks but doesn't die if something doesn't exist and a 3rd that does die
[20:25] <ashb> symlink/hardlink - you dont deal with or create hard links
[20:25] <ashb> symlink is far far more common
[20:25] <ashb> symlink also has hte issue of is it symlink or symbolicLink
[20:25] <Wes-> ashb: right, but I find it confusing to have CommonJS link() mean the opposite of POSIX link() -- would prefer clarity in name
[20:26] <ashb> true.
[20:26] <Wes-> symlink() in POSIX FWIW
[20:26] <ashb> if you dont get any other replies on ML remind me to post
[20:27] <Wes-> 'k
[20:27] <ashb> Wes-: what do you mean by 1. ?
[20:27] <Dantman> Wes-, already killed password logins
[20:28] <Wes-> ashb: Is there a way to represent, in any of these functions, a filename which cannot be represented in Unicode? How to express that?
[20:29] <ashb> oh right. "Dont do that" :D
[20:29] <ashb> in all honstly tho, i think having the filename as a String is right
[20:29] <ashb> and if the underlying FS isn't utf8 then the engine needs to deal with it
[20:29] <Wes-> my thinking -- allow ByteString Paths everywhere, must be instanceof require("binary").ByteString or something
[20:30] <Wes-> You can't just say "engine needs to deal with it" - you need to define how it's going to
[20:30] <ashb> oh wait - 'which cannot be represented in Unicode'
[20:31] <ashb> what is there that can't outside of han unification issues?
[20:31] <ashb> (i was thinking/talking about when the FS isn't utf8 before)
[20:32] <Wes-> ashb: some sequences of bytes are simply not legal unicode
[20:32] <Wes-> like, say, an old FAT filesystem with random high-bit characters in use
[20:32] <ashb> hmmm.
[20:32] <ashb> i'd really like to say 'tough'.
[20:33] <ashb> but thats not realyl the right answer
[20:33] <Wes-> It's an interesting question. It means in theory you can traverse a directory with fs-base but not open certain files because of their filenames
[20:33] <ashb> hmmm.
[20:33] <Wes-> And then "Do we care enough to fix", and "shouldn't a standards body care?"
[20:34] <ashb> so how would .list deal with the high bytes
[20:34] <ashb> just turn byte 200 into code point 200 in that case?
[20:34] <Wes-> Of course, maybe we can fall back on the old crutch:
[20:34] <Wes-> - javascript doesn't validate utf-16 sequences
[20:34] <Wes-> - unicode says garbage in unicode strings is okay
[20:35] <Wes-> Means if we're careful, maybe we *can* traverse-and-open, but not necessarily convert into Strings for output
[20:35] <Wes-> "just turn" -- yeah
[20:36] <Wes-> Means for a really robust system, fs-base needs to know non-naive details about fs
[20:36] <ashb> only for obscure platforms
[20:36] <Wes-> I think an impl could ignore those in the real world, but in the spec world, we need to talk about them
[20:36] <Wes-> ashb: obscure, like a linux box with a usb key drive which came out of a window machine?
[20:36] <ashb> yeah i think it does need to be mentioned, but i'd really prefer to just keep it as strings if we can
[20:37] <Wes-> DOS could write non-unicode filenames to FAT, I imagine windows can too
[20:37] <Wes-> *nod*
[20:37] <Wes-> Maybe we should talk about making openRaw and list cross-usable but not guarantee printability?
[20:38] <ashb> just as a footnote/addendum?
[20:38] <Wes-> yeah
[20:39] <ashb> Wes-: https://bugzilla.redhat.com/show_bug.cgi?id=162710
[20:39] <ashb> in answer to your specific question - its a kernel bug in that case :)_
[20:39] <ashb> oh no perhaps not
[20:41] <Wes-> Yeah, not a kernel bug, but a corner case for sure which is bound to trip up lots of folks, CommonJS implementers included. :)
[21:01] <Dantman> *twitch* Riiiight... I need to remember that pressing that "Reboot" link on Zeroshell's ui kills my internet connection temporarily.
[22:28] <Dantman> Ugh... yahoo should have just died off..... That Flickr API TOS is ridiculous

 

 

Logs by date :