All posts by antipaucity

what is “plan b” for iot security?

Schneier has a recent article on security concerns for IoT (internet of things) devices – IoT Cybersecurity: What’s Plan B?

We can try to shop our ideals and demand more security, but companies don’t compete on IoT safety — and we security experts aren’t a large enough market force to make a difference.

We need a Plan B, although I’m not sure what that is. Comment if you have any ideas.

There are loads of great comments on the post.

Here’s the start of some of my thoughts:

There are a host of avenues which need to be gone down and addressed regarding device security in general, and IoT security in particular.

Any certification program could be good .. right up until the vendor goes out of business. Or ends the product line. Or ends formal support. Unless we go to a lease model for everything, you’re going to have unsupported/unsupportable devices out there.

We can’t have patches ad infinitum because it’s not practical: every vendor EOLs products (from OSes to firearms to DB servers to cars, etc).

A few things which would be good:

  • safe/secure by default from the vendor – you have to manually de-safe it to use it (like a rifle which only becomes usable/dangerous/operable when you load a cartridge and put the safety off)
  • well-known, highly-publicized support lifecycles (caveating the vendor going out of business)
  • related to the above, notifications from the device as it nears end of support
  • notifications from the device as well as the vendor that updates/patches are available
  • liability regulations – and an associated insurance structure – affecting businesses which choose to offer IoT devices across a few levels:
    1. here it is :: you deal with it || no support, no insurance, whatever risk is there is your problem
    2. patches / updates for 1 year || basic insurance / guarantee of operation through supported period, as long as you’re patched up to date
    3. patches / updates for 3 years ||
    4. patches / updates for 5 years || first-level business offering || insurance against hacks / flaws that have been disclosed for more than 90 days so long as you have patched
    5. patches / updates for 10 years || enterprise / long-term support || “big” insurance coverage (up to a year, so long as you’re yp-to-date) || proactive notifications from the vendor to customers regarding flaws, patches, etc

There are probably other things which need to be considered.

But there’s my start.

david pogue’s 1996 mac holiday sing-along


God Rest Ye Copland Programmers
(to the tune of “God Rest Ye Merry Gentlemen”)

God rest ye Copland programmers,
It’s finally Christmas Day.
You’ve all worked 20-hour shifts
Beginning back in May.
No wonder after such neglect
Your spouses moved away.
The last real meal you had
Was late last year–
That’s what we hear;
And since then you’ve lived on
Pizza, Coke, and beer.

Your bosses change, and change their minds,
Is Copland off or on?
Are last week’s OS plans in place
Or now completely gone?
God rest ye well this Christmas Day,
You’d better sleep in late–
It’s the last sleep you’ll get till ’98.
Isn’t that great?
It’s the last day off you’ll have till ’98!

The Bill Gates Song
(to the tune of “The Christmas Song”)

Netscape roasting on an open fire,
Apple begging on its knees,
Photo popping up on Time magazine,
Yes, Bill Gates dreams of days like these!
Everybody knows he’s never fully satisfied,
Throws himself behind each task,
World dominion is his company’s goal.
Well, hey, is that so much to ask?
He knows the world is in his sway,
We’ll buy whatever software he might toss our way,
We’ll surf his Internet, watch his TV,
He’ll take us anywhere we ask him–for a fee.

And so we’re offering this simple prayer,
To Bill and all his MS grunts:
Since we all follow any standard you write,
Make it good, please,
Make it good, please,
Make it good, please, just once!

Gil Amelio’s Coming to Town!
(to the tune of “Santa Claus Is Coming to Town”)

You better watch out,
Absurd as it sounds,
‘Cause Apple’s about
To lose a few pounds–
Gil Amelio’s coming to town!

He’s making a list,
And trimming the rolls
Of projects that missed
Their revenue goals–
Gil Amelio’s coming to town!
He knows what’s losing money,
Like eWorld, PowerTalk . . .
You’d better make your project work
Or prepare to take a walk!

Though you follow his lead
Right out the back door,
You know he’ll succeed–
He’s done it before!
Gil Amelio’s coming to town!

(to the tune of “Jingle Bells”)

Nine-tenths of a gig,
Biggest ever seen,
God, this program’s big–
MS Word 15!
Comes on ten CDs,
And requires–damn!
Word is fine, but jeez–
60 megs of RAM?!

Oh! Microsoft, Microsoft,
Bloatware all the way!
I’ve sat here installing Word
Since breakfast yesterday!
Oh! Microsoft, Microsoft,
Moderation, please.
Guess you hadn’t noticed:
Four-gig drives don’t grow on trees!

I’m Dreaming of a Clean System
(to the tune of “White Christmas”)

I’m dreaming of a clean System,
Something that fits on one CD.
Each component matches,
Not bits and patches,
Unlike 7-5-point-3.
I’m longing for a dream System,
Small, stable, fast, and trouble-free.
What we want, I think you’ll agree,
Is called System 6-point-oh-3!

Violent Night
(to the tune of “Silent Night”)

Silent Mac, broken Mac!
System bombed, screen went black.
Books suggested things; I tried ’em all:
Shift key, desktop file, clean reinstall.
Now my deadline is tight,
This Mac’s been silent all night.

Violent night, horrible night!
Lost my cool, filled with spite,
Threw my Mac through the balcony door
Watched it fall from the 20th floor,
Now I’m sleeping in peace;
Thank God I had it on lease.

Prove It’s So!
(to the tune of “Let It Snow”)

Oh, the papers say Apple’s dying,
But before we start good-byeing,
We should call them all up and go,
“Prove it’s so! Prove it’s so! Prove it’s so!”

They say “Mac OS software’s scarcer.”
We say, “Read those numbers, there, sir,
Sales continued this year to grow.
There ya go, there ya go, there ya go!”

When they tell us Win 95
Made the Mac’s famed advantages ebb,
We’ll say, “Why, then, do Macs now drive
60 percent of the Web?”

We can win our PR reversal–
Make the Mac be universal–
Though we may have some years to go,
Make it so, make it so, make it so!

Happily Addicted to the Web
(to the tune of “Winter Wonderland”)

Doorbell rings, I’m not list’nin’,
From my mouth, drool is glist’nin’,
I’m happy–although
My boss let me go–
Happily addicted to the Web.
All night long, I sit clicking,
Unaware time is ticking,
There’s beard on my cheek,
Same clothes for a week,
Happily addicted to the Web.

Friends come by; they shake me,
Saying, “Yo, man!
Don’t you know tonight’s the senior prom?”
With a listless shrug, I mutter, “No, man;
I just discovered letterman-dot-com!”

I don’t phone, don’t send faxes,
Don’t go out, don’t pay taxes,
Who cares if someday
They drag me away?
I’m happily addicted to the Web!

fallocate vs dd for swap file creation

I recently ran across this helpful Digital Ocean community answer about creating a swap file at droplet creation time.

So I decided to test how long using my old method (using dd) takes to run vs using fallocate.

Here’s how long it takes to run fallocate on a fresh 40GB droplet:

root@ubuntu:/# rm swapfile && time fallocate -l 1G /swapfile
real	0m0.003s
user	0m0.000s
sys	0m0.000s

root@ubuntu:/# rm swapfile && time fallocate -l 2G /swapfile
real	0m0.004s
user	0m0.000s
sys	0m0.000s

root@ubuntu:/# rm swapfile && time fallocate -l 4G /swapfile
real	0m0.006s
user	0m0.000s
sys	0m0.004s

root@ubuntu:/# rm swapfile && time fallocate -l 8G /swapfile
real	0m0.007s
user	0m0.000s
sys	0m0.004s

root@ubuntu:/# rm swapfile && time fallocate -l 16G /swapfile
real	0m0.012s
user	0m0.000s
sys	0m0.008s

root@ubuntu:/# rm swapfile && time fallocate -l 32G /swapfile
real	0m0.029s
user	0m0.000s
sys	0m0.020s

Interestingly, the relationship of size to time is non-linear when running fallocate.

Compare to building a 4GB swap file with dd (on the same server, it turned out using either a 16KB or 4KB bs gives the fastest run time):

time dd if=/dev/zero of=/swapfile bs=16384 count=262144 

262144+0 records in
262144+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 4.52602 s, 949 MB/s

real	0m4.528s
user	0m0.048s
sys	0m4.072s

Yes, you read that correctly – using dd with an “optimum” bs of 16KB (after much testing different bs settings) takes ~1000x as long as using fallocate to create the same “size” file!

How is fallocate so much faster? The details are in the man pages for it (emphasis added):

fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks and marking them as uninitialized, requiring no IO to the data blocks. This is much faster than creating a file by filling it with zeroes.

dd will “always” work. fallocate will work almostall of the time … but if you happen to be using a filesystem which doesn’t support it, you need to know how to use dd.

But: if your filesystem supports fallocate (and it probably does), it is orders of magnitude more efficient to use it for file creation.