I've now had an "Internet of Things" device for about a year. It is Logitech Harmony HUB, an universal remote controller. It comes with a traditional remote, but the interesting part is that it allows me to use my smartphone/tablet as remote over WiFi. With the android app it provides a rather nice use experience, yet I can see the inevitable end in anger. Bare minimum GPL respectToday, the GPL sources for hub are available - at least the kernel and a patch for busybox. The proper GPL release is still only through written offer. The sources appeared online April this year while Hub has been sold for two years already. Even if I ordered the GPL CD, it's unlikely I could build a modified system with it - too many proprietary bits. The whole GPL was invented by someone who couldn't make a printer do what he wanted. The dystopian today where I have to rewrite the whole stack running on a Linux-based system if I'm not happy what's running there as provided by OEM.App onlyThe smartphone app is mandatory. The app is used to set up the hub. There is no HTML5 interface or any other way to control to the hub - just the bundled remote and phone apps. Fully proprietary apps, with limited customization options. And if app store update removes a feature you have used.. well you can't get it from anywhere anymore. The dystopian today where "Internet of Things" is actually "Smartphone App of Things".Locked APIMaybe instead of modifying the official app you could write your own UI? Like one screen with only the buttons you ever use when watching TV? There *is* an API with delightful headline "Better home experiences, together". However, not together with me, the owner of the harmony hub. The official API is locked to selected partners. And the API is not to control the hub - it's to let the hub connect to other IoT devices. Of course, for talented people, locked api is usually just undocumented api. People have reverse engineered how the app talks to the hub over wifi. Curiously it is actually Jabber based with some twists like logging credentials through Logitech servers. The dystopian today where I can't write programs to remotely control the internet connected thing I own without reverse engineering protocols.Central ServerDid someone say Logitech servers? Ah yes, all configuring of the remote happens via myharmony servers, where the database of remote controllers lives. There is some irony in calling the service *my* harmony when it's clearly theirs. The communication with cloud servers leaks at minimum back to Logitech what hardware I control with my hub. At the worst, it will become an avenue of exploits. And how long will Logitech manage these servers? The moment they are gone, harmony hub becomes a semi-brick. It will still work, but I can't change any configuration anymore. The dystopian future where the Internet of Thing will stop working *when* cloud servers get sunsetWhat nowThis is not just the Harmony hub - this is a pattern that many IoT products follow - Linux based gadget, smartphone app, cloud services, monetized apis. After the gadget is bought, the vendor has little incentive to provide any updates. After all, the next chance I'll carry them money is when the current gadget gets obsolete. I can see two ways out. The easy way is to get IoT gadgets as monthly paid service. Now the gadget vendor has the right incentive - instead of trying to convince me to buy their next gadget, their incentive is to keep me happily paying the monthly bill. The polar opposite is to start making open competing IoT's, and market to people the advantage of being yourself in control. I can see markets for both options. But half-way between is just pure dystopy.
The recent AWS introduction of the Elastic File System gives you an automatic grow-and-shrink capability as an NFS mount, an exciting option that takes away the previous overhead in creating shared block file systems for EC2 instances.
However it should be noted that the same auto-management of capacity is not true in the EC2 instance s Elastic Block Store (EBS) block storage disks; sizing (and resizing) is left to the customer. With current 2015 EBS, one cannot simply increase the size of an EBS Volume as the storage becomes full; (as at June 2015) an EBS volume, once created, has fixed size. For many applications, that lack of resize function on its local EBS disks is not a problem; many server instances come into existence for a brief period, process some data and then get Terminated, so long term managment is not needed.
However for a long term data store on an instance (instead of S3, which I would recommend looking closely at from a durability and pricing fit), and where I want to harness the capacity to grow (or shrink) disk for my data, then I will need to leverage some slightly more advanced disk management. And just to make life interesting, I wish to do all this while the data is live and in-use, if possible.
Enter: Logical Volume Management, or LVM. It s been around for a long, long time: LVM 2 made a debut around 2002-2003 (2.00.09 was Mar 2004) and LVM 1 was many years before that so it s pretty mature now. It s a powerful layer that sits between your raw storage block devices (as seen by the operating system), and the partitions and file systems you would normally put on them.
In this post, I ll walk through the process of getting set up with LVM on Debian in the AWS EC2 environment, and how you d do some basic maintenance to add and remove (where possible) storage with minimal interruption.
Getting Started
First a little prep work for a new Debian instance with LVM.
As I d like to give the instance its own ability to manage its storage, I ll want to provision an IAM Role for EC2 Instances for this host. In the AWS console, visit IAM, Roles, and I ll create a new Role I ll name EC2-MyServer (or similar), and at this point I ll skip giving it any actual privileges (later we ll update this). As at this date, we can only associate an instance role/profile at instance launch time.
Now I launch a base image Debian EC2 instance launched with this IAM Role/Profile; the root file system is an EBS Volume. I am going to put data that I ll be managing on a separate disk from the root file system.
First, I need to get the LVM utilities installed. It s a simple package to install: the lvm2 package. From my EC2 instance I need to get root privileges (sudo -i) and run:
apt update && apt install lvm2
After a few moments, the package is installed. I ll choose a location that I want my data to live in, such as /opt/. I want a separate disk for this task for a number of reasons:
Root EBS volumes cannot currently be encrypted using Amazon s Encrypted EBS Volumes at this point in time. If I want to also use AWS encryption option, it ll have to be on a non-root disk. Note that instance-size restrictions also exist for EBS Encrypted Volumes.
It s possibly not worth make a snapshot of the Operating System at the same time as the user content data I am saving. The OS install (except the /etc/ folder) can almost entirely be recreated from a fresh install. so why snapshot that as well (unless that s your strategy for preserving /etc, /home, etc).
The type of EBS volume that you require may be different for different data: today (Apr 2015) there is a choice of Magnetic, General Purpose 2 (GP2) SSD, and Provisioned IO/s (PIOPS) SSD, each with different costs; and depending on our volume, we may want to select one for our root volume (operating system), and something else for our data storage.
I may want to use EBS snapshots to clone the disk to another host, without the base OS bundled in with the data I am cloning.
I will create this extra volume in the AWS console and present it to this host. I ll start by using a web browser (we ll use CLI later) with the EC2 console.
The first piece of information we need to know is where my EC2 instance is running. Specifically, the AWS Region and Availability Zone (AZ). EBS Volumes only exist within the one designated AZ. If I accidentally make the volume(s) in the wrong AZ, then I won t be able to connect them to my instance. It s not a huge issue, as I would just delete the volume and try again.
I navigate to the Instances panel of the EC2 Console, and find my instance in the list:
A (redacted) list of instance from the EC2 console.
Here I can see I have located an instance and it s running in US-East-1A: that s AZ A in Region US-East-1. I can also grab this with a wget from my running Debian instance by asking the MetaData server:
The returned text is simply: us-east-1a .
Time to navigate to Elastic Block Store , choose Volumes and click Create :
Creating a volume in AWS EC2: ensure the AZ is the same as your instance
You ll see I selected that I wanted AWS to encrypt this and as noted above, at this time that doesn t include the t2 family. However, you have an option of using encryption with LVM where the customer looks after the encryption key see LUKS.
What s nice is that I can do both have AWS Encrypted Volumes, and then use encryption on top of this, but I have to manage my own keys with LUKS, and should I lose them, then I can keep all the cyphertext!
I deselected this for my example (with a t2.micro), and continue; I could see the new volume in the list as creating , and then shortly afterwards as available . Time to attach it: select the disk, and either right-click and choose Attach , or from the menu at the top of the list, chose Actions -> Attach (both do the same thing).
Attaching a volume to an instance: you ll be prompted for the compatible instances in the same AZ.
At this point in time your EC2 instance will now notice a new disk; you can confirm this with dmesg tail , and you ll see something like:
[1994151.231815] xvdg: unknown partition table
(Note the time-stamp in square brackets will be different).
Previously at this juncture you would format the entire disk with your favourite file system, mount it in the desired location, and be done. But we re adding in LVM here between this raw device, and the filesystem we are yet to make .
Marking the block device for LVM
Our first operation with LVM is to put a marker on the volume to indicate it s being use for LVM so that when we scan the block device, we know what it s for. It s a really simple command:
pvcreate /dev/xvdg
The device name above (/dev/xvdg) should correspond to the one we saw from the dmesg output above. The output of the above is rather straight forward:
Physical volume "/dev/xvdg" successfully created
Checking our EBS Volume
We can check on the EBS volume which LVM sees as a Physical Volume using the pvs command.
Here we see the entire disk is currently unused.
Creating our First Volume Group
Next step, we need to make an initial LVM Volume Group which will use our Physical volume (xvdg). The Volume Group will then contain one (or more) Logical Volumes that we ll format and use. Again, a simple command to create a volume group by giving it its first physical device that it will use:
# vgcreate OptVG /dev/xvdg
Volume group "OptVG" successfully created
And likewise we can check our set of Volume Groups with vgs :
The Attribute flags here indicate this is writable, resizable, and allocating extents in normal mode. Lets proceed to make our (first) Logical Volume in this Volume Group:
# lvcreate -n OptLV -L 4.9G OptVG
Rounding up size to full physical extent 4.90 GiB
Logical volume "OptLV" created
You ll note that I have created our Logical Volume as almost the same size as the entire Volume Group (which is currently one disk) but I left some space unused: the reason for this comes down to keeping some space available for any jobs that LVM may want to use on the disk and this will be used later when we want to move data between raw disk devices.
If I wanted to use LVM for Snapshots, then I d want to leave more space free (unallocated) again.
We can check on our Logical Volume:
The attribytes indicating that the Logical Volume is writeable, is allocating its data to the disk in inherit mode (ie, as the Volume Group is doing), and that it is active. At this stage you may also discover we have a device /dev/OptVG/OptLV, and this is what we re going to format and mount. But before we do, we should review what file system we ll use.
Filesystems
Popular Linux file systems
Name
Shrink
Grow
Journal
Max File Sz
Max Vol Sz
btrfs
Y
Y
N
16 EB
16 EB
ext3
Y off-line
Y
Y
2 TB
32 TB
ext4
Y off-line
Y
Y
16 TB
1 EB
xfs
N
Y
Y
8 EB
8 EB
zfs*
N
Y
Y
16 EB
256 ZB
For more details see Wikipedia comparison. Note that ZFS requires 3rd party kernel module of FUSE layer, so I ll discount that here. BTRFS only went stable with Linux kernel 3.10, so with Debian Jessie that s a possibility; but for tried and trusted, I ll use ext4.
The selection of ext4 also means that I ll only be able to shrink this file system off-line (unmounted).
I ll make the filesystem:
# mkfs.ext4 /dev/OptVG/OptLV
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 1285120 4k blocks and 321280 inodes
Filesystem UUID: 4f831d17-2b80-495f-8113-580bd74389dd
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
And now mount this volume and check it out:
# mount /dev/OptVG/OptLV /opt/
# df -HT /opt
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/OptVG-OptLV ext4 5.1G 11M 4.8G 1% /opt
Lastly, we want this to be mounted next time we reboot, so edit /etc/fstab and add the line:
/dev/OptVG/OptLV /opt ext4 noatime,nodiratime 0 0
With this in place, we can now start using this disk. I selected here not to update the filesystem every time I access a file or folder updates get logged as normal but access time is just ignored.
Time to expand
After some time, our 5 GB /opt/ disk is rather full, and we need to make it bigger, but we wish to do so without any downtime. Amazon EBS doesn t support resizing volumes, so our strategy is to add a new larger volume, and remove the older one that no longer suits us; LVM and ext4 s online resize ability will allow us to do this transparently.
For this example, we ll decide that we want a 10 GB volume. It can be a different type of EBS volume to our original we re going to online-migrate all our data from one to the other.
As when we created the original 5 GB EBS volume above, create a new one in the same AZ and attach it to the host (perhaps a /dev/xvdh this time). We can check the new volume is visible with dmesg again:
[1999786.341602] xvdh: unknown partition table
And now we initalise this as a Physical volume for LVM:
# pvcreate /dev/xvdh
Physical volume "/dev/xvdh" successfully created
And then add this disk to our existing OptVG Volume Group:
# vgextend OptVG /dev/xvdh
Volume group "OptVG" successfully extended
We can now review our Volume group with vgs, and see our physical volumes with pvs:
There are now 2 Physical Volumes we have a 4.9 GB filesystem taking up space, so 10.09 GB of unallocated space in the VG.
Now its time to stop using the /dev/xvgd volume for any new requests:
# pvchange -x n /dev/xvdg
Physical volume "/dev/xvdg" changed
1 physical volume changed / 0 physical volumes not changed
At this time, our existing data is on the old disk, and our new data is on the new one. Its now that I d recommend running GNU screen (or similar) so you can detach from this shell session and reconnect, as the process of migrating the existing data can take some time (hours for large volumes):
During the move, checking the Monitoring tab in the AWS EC2 Console for the two volumes should show one with a large data Read metric, and one with a large data Write metric clearly data should be flowing off the old disk, and on to the new.
A note on disk throughput
The above move was a pretty small, and empty volume. Larger disks will take longer, naturally, so getting some speed out of the process maybe key. There s a few things we can do to tweak this:
EBS Optimised: a launch-time option that reserves network throughput from certain instance types back to the EBS service within the AZ. Depending on the size of the instance this is 500 MB/sec up to 4GB/sec. Note that for the c4 family of instances, EBS Optimised is on by default.
Size of GP2 disk: the larger the disk, the longer it can sustain high IO throughput but read this for details.
Size and speed of PIOPs disk: if consistent high IO is required, then moving to Provisioned IO disk may be useful. Looking at the (2 weeks) history of Cloudwatch logs for the old volume will give me some idea of the duty cycle of the disk IO.
Back to the move
Upon completion I can see that the disk in use is the new disk and not the old one, using pvs again:
So all 5 GB is now unused (compare to above, where only 96 MB was PFree). With that disk not containing data, I can tell LVM to remove the disk from the Volume Group:
# vgreduce OptVG /dev/xvdg
Removed "/dev/xvdg" from volume group "OptVG"
Then I cleanly wipe the labels from the volume:
# pvremove /dev/xvdg
Labels on physical volume "/dev/xvdg" successfully wiped
If I really want to clean the disk, I could choose to use shred(1) on the disk to overwrite with random data. This can take a lng time
Now the disk is completely unused and disassociated from the VG, I can return to the AWS EC2 Console, and detach the disk:
Detach an EBS volume from an EC2 instance
Wait for a few seconds, and the disk is then shown as available ; I then chose to delete the disk in the EC2 console (and stop paying for it).
Back to the Logical Volume it s still 4.9 GB, so I add 4.5 GB to it:
# lvresize -L +4.5G /dev/OptVG/OptLV
Size of logical volume OptVG/OptLV changed from 4.90 GiB (1255 extents) to 9.40 GiB (2407 extents).
Logical volume OptLV successfully resized
We now have 0.6GB free space on the physical volume (pvs confirms this).
Finally, its time to expand out ext4 file system:
# resize2fs /dev/OptVG/OptLV
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/OptVG/OptLV is mounted on /opt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/OptVG/OptLV is now 2464768 (4k) blocks long.
And with df we can now see:
# df -HT /opt/
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/OptVG-OptLV ext4 9.9G 12M 9.4G 1% /opt
Automating this
The IAM Role I made at the beginning of this post is now going to be useful. I ll start by adding an IAM Policy to the Role to permit me to List Volumes, Create Volumes, Attach Volumes and Detach Volumes to my instance-id. Lets start with creating a volume, with a policy like this:
This policy puts some restrictions on the volumes that this instance can create: only within the given Availability Zone (matching our instance), only GP2 SSD (no PIOPs volumes), and size no more than 250 GB. I ll add another policy to permit this instance role to tag volumes in this AZ that don t yet have a tag called InstanceId:
Now that I can create (and then tag) volumes, this becomes a simple procedure as to what else I can do to this volume. Deleting and creating snapshots of this volume are two obvious options, and the corresponding policy:
Of course it would be lovely if I could use a variable inside the policy condition instead of the literal string of the instance ID, but that s not currently possible.
Clearly some of the more important actions I want to take are to attach and detach a volume to my instance:
Now with this in place, we can start to fire up the AWS CLI we spoke of. We ll let the CLI inherit its credentials form the IAM Instance Role and the polices we just defined.
and at this stage, the above manipulation of the raw block device with LVM can begin. Likewise you can then use the CLI to detach and destroy any unwanted volumes if you are migrating off old block devices.
Television loudness is the source of frustration for viewers
everywhere. Some channels are very load, others are less loud, and
ads tend to shout very high to get the attention of the viewers, and
the viewers do not like this. This fact is well known to the TV
channels. See for example the BBC white paper
"Terminology
for loudness and level dBTP, LU, and all that" from 2011 for a
summary of the problem domain. To better address the need for even
loadness, the TV channels got together several years ago to agree on a
new way to measure loudness in digital files as one step in
standardizing loudness. From this came the ITU-R standard BS.1770,
"Algorithms to
measure audio programme loudness and true-peak audio level".
The ITU-R BS.1770 specification describe an algorithm to measure
loadness in LUFS (Loudness Units, referenced to Full Scale). But
having a way to measure is not enough. To get the same loudness
across TV channels, one also need to decide which value to standardize
on. For European TV channels, this was done in the EBU Recommondaton
R128, "Loudness
normalisation and permitted maximum level of audio signals", which
specifies a recommended level of -23 LUFS. In Norway, I have been
told that NRK, TV2, MTG and SBS have decided among themselves to
follow the R128 recommondation for playout from 2016-03-01.
There are free software available to measure and adjust the loudness
level using the LUFS. In Debian, I am aware of a library named
libebur128
able to measure the loudness and since yesterday morning a new binary
named bs1770gain
capable of both measuring and adjusting was uploaded and is waiting
for NEW processing. I plan to maintain the latter in Debian under the
Debian
multimedia umbrella.
The free software based TV channel I am involved in,
Frikanalen, plan to follow the
R128 recommondation ourself as soon as we can adjust the software to
do so, and the bs1770gain tool seem like a good fit for that part of
the puzzle to measure loudness on new video uploaded to Frikanalen.
Personally, I plan to use bs1770gain to adjust the loudness of videos
I upload to Frikanalen on behalf of the
NUUG member organisation. The program seem to be able to measure
the LUFS value of any media file handled by ffmpeg, but I've only
successfully adjusted the LUFS value of WAV files. I suspect it
should be able to adjust it for all the formats handled by ffmpeg.
This year, on top of the many excellent contributed talks, BoFs, and other
events always part of DebConf (some of which have already been announced) we
are excited to have confirmed the following keynote speakers.
During the Open Weekend (Saturday, August 15th and Sunday, August 16th), we
will have keynotes delivered by:
Bradley M. Kuhn,
President, Software Freedom Conservancy / Board of Directors, Free Software Foundation
(Wikipedia page)
Werner Koch,
Creator and Lead Developer, GnuPG Project / g10 Code GmbH
(Wikipedia page)
Bdale Garbee,
Chief Technologist Open Source and Linux, HP / Debian Project
(Wikipedia page)
On the last day of DebConf, we look forward to the closing keynote by:
Jacob Appelbaum,
Security Researcher and Journalist / Tor Project
(Wikipedia page)
For more information about our invited speakers, please see
http://debconf15.debconf.org/invited_speakers.xhtml
Citizenfour Screening
Additionally, there will be a screening of the
Citizenfour movie,
winner of the Best Documentary Feature Academy Award on the evening of Friday,
August 21st.
You still have time to submit your talk
There are only a few days left before the end of the Call for Proposals on June
15th. Events submitted after that date might not be part of the official
DebConf schedule. So, please, hurry, check out the
proposal submission guide
and submit your event.
Regards from the DebConf Team
Last weekend Hermann Zapf, one of the greatest font designers and typographers of our times, has passed away at the age of 96. Much has been written about his life, his immense sphere of influence, his excellent typefaces, and some of the links to other obituaries can be found here at the end. There is nothing of value I can contribute, but let Hermann Zapf speak for himself with a few images from two books by or dedicated to him.
The books I have taken these photos from are:
Manuale Zapficum Typographic arrangements of words by and about the work of Hermann Zapf & Gudrun Zapf von Hesse. Cary Graphic Arts Press, Rochester 2008 (shown on the right below).
Alphabetgeschichten Eine Chronik technischer Entwicklungen von Hermann Zapf. Mergenthaler Edition, Linotype GmbH. Cary Graphic Arts Press, Rochester 2007 (shown on the left below).
In his long life, Hermann Zapf has created a wide range of typefaces, some if which have become the main staple in the printing business, most notably Palatino, Janson, Optima, and Zapf Dingbats. But there are many more:
While probably not as popular anymore as some years (decades?) ago, Palatino still is one of my favorite typefaces. I often wished to have the freedom to choose my own fonts for publications, but normally that doesn t happen. Palatino has found many offspring (or imitations?), and there are excellent renderings for use with (La)TeX, too.
Hermann Zapf also had connections with Don Knuth and the AMS (American Mathematical Society), and he designed for the AMS the Euler typeface, using Knuth s MetaFont program.
Last weekend, when I heard of Hermann Zapf s death, I was at a conference at Tsukuba University. What a coincidence that all the signs in the building (floor numbers, indications, etc) were set in another of his great typefaces, the Optima. I had a strange feeling, and reset my presentation in Optima/Euler in honor of Hermann Zapf s great life.
Although I never met Hermann Zapf personally I missed the TeX conferences where he participated it was to a great extent his influence that years ago I got started in typography. Living a life like he did, dedicating himself to the beauty and expressiveness of letters, design, calligraphy, seems like a dream for me. But beauty can be found even in the strangest equation in mathematics, the queerest theorem in logic. While not all of us are as gifted as Hermann Zapf in creating beauty, we should strive to increase our ability to appreciate the beauty.
The beauty of letters is subtle, evasive, and needs training, that is practice, to be appreciated. Hermann Zapf taught us how even self-training can lead to excellence. His letters, which I meet every day, are a permanent reminder to strive for beauty and clarity, and never relent in our exercise.
Thanks Hermann Zapf.
Links to tributes around the world
English
Linotype (Type foundry where Zapf started working) Bigelow and Holmes (Type designers) New York Times (Newspaper) Type Drawers Quarz (News magazine) Kaveh Bazargan (next president of TUG) TeX Overflow (Q&A website concerning TeX)
German
FontShop (Type foundry and internet shop) Deutschland Funk (News station) S ddeutsche (Newspaper) Echo (Newspaper) Heise (Techology News page)
My website for a while has used CloudFlare as its front-end. It s a rather nice setup and means my real server gets less of a hammering, which is a good thing. A few months ago they enabled a feature called Universal SSL which I have also added to my site. Around the same time, my SSL check scripts started failing for the website, the certificate had expired apparently many many days ago. Something wasn t right.
The Problem
The problem was simply at first I d get emails saying The SSL certificate for enc.com.au (CN: ) has expired! . I use a program called ssl-cert-check that would check all (web, smtp, imap) of my certificates. It s very easy to forget to renew and this program runs daily and does a simple check.
Running the program on the command line gave some more information, but nothing (for me) that really helped:
$ /usr/bin/ssl-cert-check -s enc.com.au -p443
Host Status Expires Days
---------------------------------------------------------------------------
unable to load certificate
140364897941136:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:701:Expecting: TRUSTED CERTIFICATE
unable to load certificate
139905089558160:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:701:Expecting: TRUSTED CERTIFICATE
unable to load certificate
140017829234320:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:701:Expecting: TRUSTED CERTIFICATE
unable to load certificate
140567473276560:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:701:Expecting: TRUSTED CERTIFICATE
enc.com.au:443 Expired -2457182
So, apparently, there was something wrong with the certificate. The problem was this was CloudFlare who seem to have a good idea on how to handle certificates and all my browsers were happy.
ssl-cert-check is a shell script that uses openssl to make the connection, so the next stop was to see what openssl had to say.
$ echo""/usr/bin/openssl s_client -connect enc.com.au:443 CONNECTED(00000003)140115756086928:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:s23_clnt.c:769:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read7 bytes and written 345 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
---
No peer certificate available. That was the clue I was looking for.
Where s my Certificate?
CloudFlare Universal SSL uses certificates that have multiple domains in the one certificate. The do this by having one canonical name which is something like sni(numbers).cloudflaressl.com and then multiple Subject Alternative Names (a bit like ServerAlias in apache configurations). This way a single server with a single certificate can serve multiple domains. The way that the client tells the server which website it is looking for is Server Name Indication (SNI). As part of the TLS handshaking the client tells the server I want website www.enc.com.au .
The thing is, by default, both openssl s_client and the check script do not use this feature. That was fail the SSL certificate checks were failing. The server was waiting for the client to ask what website it wanted. Modern browsers do this automatically so it just works for them.
The Fix
For openssl on the command line, there is a flag -servername which does the trick nicely:
$ echo""/usr/bin/openssl s_client -connect enc.com.au:443-servername enc.com.au
CONNECTED(00000003)depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO ECC Certification Authority
verify error:num=20:unable to get local issuer certificate
---(lots of good SSL type messages)
That was openssl happy now. We asked the server what website we were interested in with the -servername and got the certificate.
The fix for ssl-cert-check is even simpler. Like a lot of things once you know the problem, the solution is not only easy to work out but someone has done it for you already. There is a Debian bug report on this problem with a simple fix from Francois Marier.
Just edit the check script and change the line that has:
TLSSERVERNAME="FALSE"
and change it to true. Then the script is happy too:
$ ssl-cert-check -s enc.com.au -p https
Host Status Expires Days
---------------------------------------------------------------------------
enc.com.au:https Valid Sep 302015114
All working and as expected! This isn t really a CloudFlare problem as such, it is just that s the first place I had seen these sort of SNI certificates being used in something I administer (or more correctly something behind the something).
Nota: Este art culo, en espa ol, aqu .
I m not a gamer, although probably I ve played with machines/computers more than most of the girls of my age. My path has been: handheld machine, Pong and tenis in my uncle s console, MSX (with that one, in addition to playing, I learnt what was an algorithm and a program, and I started to write small programs in Basic, and I copied and ran the source code of small games and programs to make graphics, which I found in MSX magazines). My parents considered that arcade machines in bars were like slot machines so they were banned for us (even pinball, only table soccer was saved from them, and only if my father was playing with us).
In the MSX I played Magical Tree, Galaxians, Arkanoid, Konami s Sports Games, Spanish games from Dinamic, and some arcades like Golden Axe, Xenon, and maybe some more. The next computers (PC AT, later a 286) were not so for gaming; let s say that we played more with the printer (Harvard Graphics, Bannermania ). Later, I was interested in other things more than in computer games, and later there were highschool homework, dBase III, and later the University and programming again and more, and it was the end of gaming, computer was for office and Uni homework.
Later, it came the internet and since then, reading and writing and communicating was more interesting for me than playing.
I was not good at playing, and if you are not good, you play less, and you don t get better, so you begin to find other ways to loose your time, or to win it :)
The new generation
My son is 6 years old now, and I m living with him a second adventure about games. Games have changed a lot, and the family computing try to stay in the libre software side whenever I am the one that can decide, so sometimes some challenges arise.
Android (phone and tablet)
The kid has played games in the phone and tablet with Android since he was a baby. We tried some of the last years popular games. I am not so keen of banning things, but I don t feel comfortable with the popular games for Android (advertisements, nonfree software, addictive elements, massive data recollection and possible surveillance ), so I try to control without being Cruella de Vil . Some techniques I use:
We agree in the amount of time for using the table, setting a tomato to control the time (thanks Pomodoro in F-Droid)
I set the airplane mode and shut down internet everytime that I can. I never register account or login to play (if it s mandatory to login in Google or create an account, sorry but we cannot play, or we create a new empty profile).
I put barriers to installing games (for example, I say that he should uninstall 2 or 3 games first if he wants a new one, or he should explain well why he wants that game and why the ones that were installed became boring suddenly).
I ve never bought games for Android, and I m not thinking about buying them in the future. I prefer to donate for some libre game project.
I try to divert attention to other games (not computer games, usually).
If the equivalent non-computer game exists, we play that one (tic-tac-toe, hungman, battleship )
I seldom play in the phone/tablet, unless we play together.
On the other side, in my phone there is no Google Play, so we have been able to discover the section Games of F-Droid.
We have tried (all of them available in F-Droid, emphasis in the ones that he liked best): 2048, AndroFish, Bomber, Coloring for Kids, Core, Dodge, Falling Blocks, Free Fall, Frozen Bubble, HeriSwap (this one in the tablet), Hex, HyperRogue, Meerkat Challenge, Memory, Pixel Dungeon, Robotfindskitten, Slow it!, Tux Memory, Tux Rider, Vector Pinball.
Playing in my phone with CyanogenMod and having downloaded the games from F-Droid provides a relief similar to the one when playing a non-computer game. At least with the games that I have listed above. Maybe it is because they are simpler games, or they make me remember the ones that I played time ago. But it s also because of the peace of mind of knowing that they are libre software, that have been audited by the F-Droid community, that they don t abuse the user.
The same happens with Debian, what takes me to the next part of this blogpost.
Computer games: Debian
The kid has learnt to play with the tablet and the phone before than with the computer, because our computers have no joysticks nor touchscreens. He learnt to use the touchpad before than the mouse, because it s easier and we have no mouse at home. He learnt to use the mouse at school, where they work with educative games via CD or via web, using Flash :(
So Flash player appears and dissapears from my Debian setup depending on his willness to play with the school games .
Until few time ago, in the computer we played with GCompris, ChildsPlay, and TuxPaint.
When he learnt to use the arrow keys, I installed Hannah and he liked a lot, specially when we learnt to do hannah -l 900 :)
Later, in ClanTV there were advertisements about some online computer games about their favorite series, resulting in that they need Flash or a framework called Unity3D (no, it s not Ubuntu s Unity), and after digging a bit I decided that I was not going to install that #@%! in my Debian, so when he insisted in play those games, I booted the Windows 7 partition in his father s laptop and I installed it there.
Windows is slow and sad in the computer, and those web games with that framework are not very light, so luckily they have not become very interesting.
We have not played in the computer much more, maybe some incursion in Minetest, what takes me to the next section.
(Not without stating my eternal thanks to the Games Team in Debian. I think they do a very important work and I think that next year I ll try to get involved in some way, because I know that the future of our family computer games is tied to libre games in Debian).
PlayStation 3 and Minecraft
Some time ago my husband bought a PlayStation 3 for home. The shop had discounts prices and so. He would play together with the kid an so.
The machine came home with some games for free (included in the price), but most of them were classified for +13 or so, so the only two left were Pro Evolution Soccer, and Minecraft.
I decided not to connect the machine to the network. Maybe we are loosing cool things, but I feel safer like that. So, no ethernet cable plugged, no registration in the Sony shop (or whatever its name is).
The controllers are quite complex for the three of us. They are DualShock don t-know-what, and I think there is something (software) that makes the game adaptative to the person playing, because my husband is worse player after the son plays, if they play in turns and use the same controller.
The kid liked Minecraft. I didn t know anything about that game (well, I knew that there was a libre clone called Minetest), so, for learning the basics I had a look at the wiki and searched videos about how to and we began learning. Now, the kid can read a bit so he needs less help, and he has watched a lot of videos about Minecraft, so he is interested in exploring and building.
I had a look at Minetest, and I installed it in Debian. Having to use the keyboard is a disadvantage, and we didn t know how to dig, so it was not much attractive at first sight. I have looked a bit about how to use the PS3 controller in the computer, via USB, and it seems to work, but I suppose I need to write something to match each controller button with the corresponding key and subsequent action in Minetest. This is work, and I am lazy, and the boy seems not very interested in playing with the computer.
Watching the videos we have infered that it s possible to download saved games and worlds to upload them in the videogame console. We have done some tests. I wanted to upload a saved game about an amusement park, but the file was in a folder of name NPEB01899* and even when the PS3 saw it to copy it from USB to the console, later it didn t appear in the list of saved games (our sved games were in folders named BLES01976). And renaming the folder didn t work, of course. I understood that we had met Sony s restrictions, so I searched for more info. The games are saved using an encryption key and you are not able to use saved games from consoles in other world zone or using a media different than ours (the game can be played using a disc or purchasing it in the digital shop, it seems). Very ugly all of this! I read somewhere that there is certain software (libre software, BTW) that allows to break the encryption and re-encrypt the saved game with the zone and type of media of your console, but it seems the program only works for Windows, and it needs a console ID that we have not, because we didn t register the console in the PlayStation network. All these things look shaky grounds for me, unpleasant stuff, I don t want to spend time on this, maybe I should learn a bit more about Minetest and make it work and interesting and tell Sony go fly a kite. Finally, I found a saved game in the same format as ours (BLES01976), it s not an amusement park but it is a world with interesting places to explore and many things already built, so I ve tried to import it and it worked, so my son will be happy for some time, I suppose.
We have tried Minetest in the tablet too, but the touchscreen is not comfortable for this kind of games.
I feel quite frustrated and angry about this issue of Sony s restrictions on saved games. So I suppose that in the next months I ll try to learn more about Minetest in Debian, game controllers in Debian, and games in Debian in general. So I hope to be able to offer cool stuff to my son, and he becomes more interested in playing in a safe environment which does not abuse the user.
And with this, I finish
Libre games in GNU/Linux, Debian, and info about games in internet
When we have searched info about games in internet, I found that many times you need to go out from the secure environment: webpages with links to downloads that who knows if they contain what they say they contain, advertisements, videoblogs with a language not adequate for kids (or any person that loves their mother language) That s why I believe the path is to go into detail about libre games provided by the distro you use (Debian in my case). Here I bookmark a list of website with info that surely will be useful for me, to read in depth:
I've recently found myself explaining polkit (formerly PolicyKit) to one of
Collabora's clients, and thought that
blogging about the same topic might be useful for
other people who are confused by it;
so, here is why udisks2 and polkit are the way they are.
As always, opinions in this blog are my own, not Collabora's.
Privileged actions
Broadly, there are two ways a process can do something: it can do it
directly (i.e. ask the kernel directly), or it can use inter-process
communication to ask a service to do that operation on its behalf.
If it does it directly, the components that say whether it can succeed
are the Linux kernel's normal permissions checks
(DAC),
and if configured, AppArmor, SELinux or a similar
MAC layer.
All very simple so far.
Unfortunately, the kernel's relatively coarse-grained checks are not sufficient
to express the sorts of policies that exist on a desktop/laptop/mobile
system. My favourite example for this sort of thing is mounting filesystems.
If I plug in a USB stick with a FAT filesystem, it's reasonable to expect
my chosen user interface to either mount it automatically, or
let me press a button to mount it. Similarly, to avoid data loss, I
should be able to unmount it when I'm finished with it.
However, mounting and unmounting a USB stick is fundamentally the same
system call as mounting and unmounting any other filesystem - and if
ordinary users can do arbitrary mount system calls, they can cause all
sorts of chaos, for instance by mounting a filesystem that contains setuid
executables (privilege escalation), or umounting a critical OS filesystem
like /usr (denial of service). Something needs to arbitrate: you can mount
filesystems, but only under certain conditions .
The kernel developer motto for this sort of thing is mechanism, not policy :
they are very keen to avoid encoding particular environments' policies
(the sort of thing you could think of as business rules ) in the kernel,
because that makes it non-generic and hard to maintain. As a result,
direct mount/unmount actions are only allowed by privileged processes,
and it's up to user-space processes to arrange for a privileged process
to make the desired mount syscall.
Here are some other privileged actions which laptop/desktop users can
reasonably expect to just work , with or without requiring a sysadmin-like
(root-equivalent) user:
reconfiguring networking (privileged because, in the general case, it's an
availability and potentially integrity issue)
installing, upgrading or removing packages (privileged because, in the
general case, it can result in arbitrary root code execution)
suspending or shutting down the system (privileged because you wouldn't
want random people doing this on your server, but should normally be
allowed on e.g. laptops for people with physical access, because they could
just disconnect the power anyway)
In environments that use a MAC framework like AppArmor, actions that
would normally be allowed can become privileged: for instance, in a
framework for sandboxed applications, most apps shouldn't be allowed to
record audio. This prevents carrying out these actions directly,
again resulting in the only way to achieve them being to ask a service
to carry out the action.
Ask a system service to do it
On to the next design, then: I can submit a request to a privileged process,
which does some checks to make sure I'm not trying to break the system
(or alternatively, that I have enough sysadmin rights that I'm allowed
to break the system if I want to), and then does the privileged
action for me.
You might think I'm about to start discussing D-Bus and daemons, but
actually, a prominent earlier implementation of this was mount(8), which
is normally setuid root:
% ls -l /bin/mount
-rwsr-xr-x 1 root root 40000 May 22 11:37 /bin/mount
If you look at it from an odd angle, this is inter-process communication
across a privilege boundary: I run the setuid executable, creating a
process. Because the executable has the setuid bit set, the kernel makes
the process highly privileged: its effective uid is root, and it has
all the necessary capabilities to mount filesystems. I submit the request
by passing it in the command-line arguments. mount does some checks -
specifically, it looks in /etc/fstab to see whether the filesystem I'm
trying to mount has the user or users flag - then carries out the
mount system call.
There are a few obvious problems with this:
When machines had
a static set of hardware devices
(and a sysadmin who knew how to configure them), it might have
made sense to list them all in /etc/fstab; but this is not a useful
solution if you can plug in any number of USB drives, or if you are
a non-expert user with Linux on your laptop. The decision
ought to be based on general attributes of devices, such as is removable? ,
and on the role of the machine.
One fact that a reasonable security policy might include is users who
are logged in remotely should have less control over physically present
devices than those who are physically present - but that sort of thing
can't be checked by mount(8) without specifically teaching the
mount binary about it.
Ask a system service to do it, via D-Bus or other IPC
To avoid the issues of setuid, we could use inter-process communication in
the traditional sense: run a privileged daemon (on boot or on-demand),
make it listen for requests, and use the IPC channel as our privilege boundary.
udisks2 is one such privileged daemon, which uses D-Bus as its IPC channel.
D-Bus is a commonly-used inter-process system; one of its
intended/designed uses is to let user processes and system services
communicate, especially this sort of communication between a privileged
daemon and its less-privileged clients.
People sometimes criticize D-Bus as not doing anything you couldn't do yourself
with some AF_UNIX sockets. Well, no, of course it doesn't - the important
bit of the reference implementation and the various interoperable
reimplementations consists of a daemon and some AF_UNIX sockets, and the
rest is
a simple matter of programming.
However, it's sufficient for most uses in its problem space, and is usually better than inventing your
own.
The advantage of D-Bus over doing your own thing is precisely that you
are not doing your own thing: good IPC design is hard, and D-Bus makes
some structural decisions so that fewer application
authors have to think about them. For instance, it has a central hub daemon
(the dbus-daemon, or message bus ) so that n communicating applications
don't need O(n ) sockets; it uses the dbus-daemon to provide a
total message ordering
so you don't have to think about message reordering; it has a distributed
naming model (which can also be used as a distributed mutex) so you don't
have to design that; it has a serialization format and a type system so you
don't have to design one of those; it has a framework for activating"
run-on-demand daemons so they don't have to use resources initially,
implemented using a setuid helper and/or systemd; and so on.
If you have religious objections to D-Bus, you can mentally replace
D-Bus with AF_UNIX or something and most of this article will
still be true.
Is this OK?
In either case - exec'ing a privileged helper, or submitting a request to a
privileged daemon via IPC - the privileged process has two questions that
it needs to answer before it does its work:
what am I being asked to do?
should I do it?
It needs to make some sort of decision on the latter based on the
information available to it. However, before we even get there, there is
another layer:
did the request get there at all?
In the setuid model, there is a simple security check that you can
apply: you can make /bin/mount only executable by a particular group,
or only executable by certain AppArmor profiles, or similar. That works
up to a point, but cannot distinguish between physically-present and
not-physically-present users, or other facts that might be interesting
to your local security policy.
Similarly, in the IPC model, you can make certain communication channels
impossible, for instance by using dbus-daemon's ability to decide which
messages to deliver, or AF_UNIX sockets' filesystem permissions,
or a MAC framework like AppArmor.
Both of these are quite coarse-grained checks which don't really
understand the finer details of what is going on. If the answer to
"is this safe? is something of the form maybe, it depends on... ,
then they can't do the right thing: they must either let it through
and let the domain-specific privileged process do the check, or deny it
and lose potentially useful functionality.
For instance, in an AppArmor environment, some applications have absolutely no
legitimate reason to talk to udisks2, so the AppArmor policy can just
block it altogether. However, once again, this is a coarse-grained
check: the kernel has mechanism, not policy, and it doesn't know what
the service does or why. If the application does need to be able to talk
to the service at all, then finer-grained access control
(obeying some, but not all, requests) has to be the service's job.
dbus-daemon does have the ability to match messages in a relatively
fine-grained way, based on the object path, interface and member in
the message, as well as the routing information that it uses itself
(i.e. the source and destination). However, it is not clear that this
makes a great deal of sense conceptually: these are facts about the
mechanics of the IPC, not facts about the domain-specific request
(because the mechanics of the IPC are all that dbus-daemon understands).
For instance, taking the udisks2 example again, dbus-daemon can't
distinguish between an attempt to adjust mount options for a USB stick
(probably fine) and an attempt to adjust mount options for /usr (not good).
To have a domain-specific security policy, we need a domain-specific
component, for instance udisks2, to get involved. Unlike dbus-daemon,
udisks2 knows that not all disks are equal, knows which
categories make sense to distinguish, and can identify which categories
a particular disk is in. So udisks2 can make a more informed decision.
So, a naive approach might be to write a function in udisks2 that looks
something like this pseudocode:
may_i_mount_this_disk (user, disk, mount options) boolean
if (user is root user is root-equivalent)
return true;
if (disk is not removable)
return false;
if (mount options are scary)
return false;
if (user is in manipulate non-local disks group)
return true;
if (user is not logged-in locally)
return false;
# https://en.wikipedia.org/wiki/Multiseat_configuration
if (user is not logged-in on the same seat where the disk is
plugged in)
return false;
return true;
Delegating the security policy to something central
The pseudocode security policy outlined above is reasonably
complicated already, and doesn't necessarily cover everything that you
might want to consider.
Meanwhile, not every system is the same. A general-purpose Linux
distribution like Debian might run on server/mainframe systems with only
remote users, personal laptops/desktops with one root-equivalent user,
locked-down corporate laptops/desktops, mobile devices and so on; these
systems should not necessarily all have the same security policy.
Another interesting factor is that for some privileged operations, you
might want to carry out interactive authorization: ask the requesting user
to confirm that the action (which might have come from a background
process) should take place (like Windows'
UAC),
or to prove that the person currently at the keyboard is the same as
the person who logged in by giving their password
(like sudo).
We could in principle write code for all of this in udisks2, and in
NetworkManager, and in systemd, ... - but that clearly doesn't scale,
particularly if you want the security policy to be configurable.
Enter polkit
(formerly PolicyKit), a system service for applying security policies
to actions.
The way polkit works is that the application does its domain-specific
analysis of the request - in the case of udisks2, whether the device to
be mounted is removable, whether the mount options are reasonable, etc. -
and converts it into an action. The action gives polkit a way to
distinguish between things that are conceptually different, without
needing to know the specifics. For instance, udisks2 currently divides
up filesystem-mounting into org.freedesktop.udisks2.filesystem-mount,
org.freedesktop.udisks2.filesystem-mount-fstab,
org.freedesktop.udisks2.filesystem-mount-system and
org.freedesktop.udisks2.filesystem-mount-other-seat.
The application also finds the identity of the user making the request.
Next, the application sends the action, the identity of the requesting
user, and any other interesting facts to polkit. As currently implemented,
polkit is a D-Bus service, so this is an IPC request via D-Bus.
polkit consults its database of policies in order to choose one of several
results:
yes, allow it
no, do not allow it
ask the user to either authenticate as themselves or as a privileged
(sysadmin) user to allow it, or cancel authentication to not allow it
ask the user to authenticate the first time, but if they do, remember
that for a while and don't ask again
So how does polkit decide this? The first thing is that it reads the
machine-readable description of the actions, in /usr/share/polkit-1/actions,
which specifies a default policy. Next, it evaluates a local security policy
to see what that says. In the current version of polkit, the local security
policy is configured by writing JavaScript in /etc/polkit-1/rules.d
(local policy) and /usr/share/polkit-1/rules.d (OS-vendor defaults).
In older versions such as the one currently shipped in Debian unstable,
there was a plugin architecture; but in practice
nobody wrote plugins for it, and instead everyone used the
example local authority shipped with polkit, which was configured
via files in /etc/polkit-1/localauthority and
/etc/polkit-1/localauthority.d.
These policies can take into account useful facts like:
what is the action we're talking about?
is the user logged-in locally? are they active, i.e. they are not just on a
non-current virtual console?
is the user in particular groups?
For instance, gnome-control-center on Debian installs this snippet:
which is reasonably close to being pseudocode for active local users in the
sudo group may set the system locale, keyboard layout, hostname and time,
without needing to authenticate . A system administrator could of course
override that by dropping a higher-priority policy for some or all of these
actions into /etc/polkit-1/rules.d.
Summary
Kernel-based permission checks are not sufficiently fine-grained to be able
to express some quite reasonable security policies
Fine-grained access control needs domain-specific understanding
The kernel doesn't have that information (and neither does dbus-daemon)
The privileged service that does the domain-specific thing can provide the
domain-specific understanding to turn the request into an action
polkit evaluates a configurable policy to determine whether privileged
services should carry out requested actions
I encourage anyone interested in debian development to get involved with the Reproducible Builds project. My own project is to try to diagnose (and hopefully provide patches for) two unreproducible packages a week. Maybe you can do one package a week? Reproducible Builds is another example of the kind of audacious project that I celebrated in my last blog post. It's a fun way to learn a little bit about different parts of the archive, and to help on an incrementally-improving process. My workflow below is meant to encourage folks to join in. The documentation on the wiki is certainly more authoritative (and will be more up-to-date in the future). My usual workflow is this:
If you have a guess about what's wrong, but don't feel sure, pop over to the #debian-reproducible IRC channel on irc.oftc.net -- usually there are friendly people there who will discuss it with you.
If you find a debbindiff that is completely indecipherable, go back and pick another package
Fetch the package source. I like to use debcheckout from the devscripts package, so that i can work with the maintainer's revision control system of choice. With cloc above, i'd do:
debcheckout cloc
If that failed for some reason, I would use:
apt-get source cloc
Change into the source directory you just unpacked and use your preferred tools (i like good old grep and find) to figure out where the affected file is created, and how it derives its variance. You might want to look through the list of known causes of unreproducibility to see if there are any similar suggestions there.
If you can fix the variance, make a patch!
File a bug report with your diagnosis (and with your patch if you have one). I write my bug reports as a simple e-mail, with the subject line describing what i found, and with a header referring it to the r-b project, like this:
The information at the R-B wiki page is quite detailed if you want more info. Finally, many many thanks to all of the people involved in the project, and particularly to h01ger and Lunar^, who have both contributed a ton of work, and have also made it easy to plug in and help as a less-involved contributor. The nice automatically-updated statistics provided by the team's continuous integration work makes it a fun game to help out. Tags: challenge, reproducible builds
The latest stable release of Mono has happened, the first bugfix update to our 4.0 branch. Here are the release highlights, and some other goodies.
Stable Packages
This release covers Mono 4.0.1, and MonoDevelop 5.9. As promised last time, this includes builds for RPM-based x64 systems (CentOS 7 minimum), Debian-based x64, i386, ARMv5 Soft Float, and ARMv7 Hard Float systems (Debian 7/Ubuntu 12.04 minimum).
Version numbering
From now on, we re going to be clearer with our version numbering scheme. Historically, we ve shipped, say, 4.0.0 to the public internally, there have been a lot of builds on this target branch, all of which get an internal revision number. 4.0.0 as-shipped was in fact 4.0.0.143 internally that was the first 4.0.0 branch release approved of for stable release.
This release is the first service release on the 4.0.0 branch, numbered 4.0.1.44 it ll be officially referred to as 4.0.1 in some places, but isn t the same as 4.0.1.0, which already released on Linux/Windows a while back, to include an emergency bugfix for those platforms.
That was sorta a screwup really. Using the 4-part version removes the ambiguity, rather than having 44 different 4.0.1 s in existence. And we ll aim to be clearer in future about what is alpha, what is beta, and what is final (and what is a random emergency snapshot).
Alpha Linux packages
Want to see things earlier? We ve now got the structure in place to provide Linux packages (and source releases) to mirror what we do on Mac. When we upload a prospective package to our Mac customers, we will automatically trigger builds for Linux too. See http://www.mono-project.com/download/alpha/
Beta Linux packages
See above. s/alpha/beta/.
Weekly git Master snapshots
We already have packages in place for every git commit, which parallel-install Mono into /opt. This is different.
Weekly (or, right now, when I manually run the requisite Jenkins job), the latest Mac build of Mono git master from our internal CI system will be copied to a public location just for you, a source tarball generated, and packages built. See here for info on making use of that. directhex@marceline:~$ mono --version
Mono JIT compiler version 4.3.0 (Nightly 4.3.0.21/88d2b9d Thu May 28 10:54:32 UTC 2015)
I don't often write about tools I use when for my daily software development
tasks. I recently realized that I really should start to share more often my
workflows and weapons of choice.
One thing that I have a hard time enduring while doing Python code reviews, is
people writing utility code that is not directly tied to the core of their
business. This looks to me as wasted time maintaining code that should be
reused from elsewhere.
So today I'd like to start with
retrying, a Python package that you
can use to retry anything.
It's OK to fail
Often in computing, you have to deal with external resources. That means
accessing resources you don't control. Resources that can fail, become
flapping, unreachable or unavailable.
Most applications don't deal with that at all, and explode in flight, leaving a
skeptical user in front of the computer. A lot of software engineers refuse to
deal with failure, and don't bother handling this kind of scenario in their
code.
In the best case, applications usually handle simply the case where the
external reached system is out of order. They log something, and inform the
user that it should try again later.
In this cloud computing area, we tend to design software components with
service-oriented architecture
in mind. That means having a lot of different services talking to each others
over the network. And we all know that networks tend to fail, and distributed
systems too. Writing software with failing being part of normal operation is a
terrific idea.
Retrying
In order to help applications with the handling of these potential failures,
you need a plan. Leaving to the user the burden to "try again later" is rarely
a good choice. Therefore, most of the time you want your application to
retry.
Retrying an action is a full strategy on its own, with a lot of options. You
can retry only on certain condition, and with the number of tries based on time
(e.g. every second), based on a number of tentative (e.g. retry 3 times and
abort), based on the problem encountered, or even on all of those.
For all of that, I use the retrying
library that you can retrieve easily on
PyPI.
retrying provides a decorator called retry that you can use on top of any
function or method in Python to make it retry in case of failure. By default,
retry calls your function endlessly until it returns rather than raising an
error.
importrandom fromretryingimportretry
@retry defpick_one(): ifrandom.randint(0,10)!=1: raiseException("1 was not picked")
This will execute the function pick_one until 1 is returned by
random.randint.
retry accepts a few arguments, such as the minimum and maximum delays to use,
which also can be randomized. Randomizing delay is a good strategy to avoid
detectable pattern or congestion. But more over, it supports exponential delay,
which can be used to implement
exponential backoff, a
good solution for retrying tasks while really avoiding congestion. It's
especially handy for background tasks.
@retry(wait_exponential_multiplier=1000,wait_exponential_max=10000) defwait_exponential_1000(): print"Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" raiseException("Retry!")
You can mix that with a maximum delay, which can give you a good strategy to
retry for a while, and then fail anyway:
# Stop retrying after 30 seconds anyway >>>@retry(wait_exponential_multiplier=1000,wait_exponential_max=10000,stop_max_delay=30000) ...defwait_exponential_1000(): ...print"Wait 2^x * 1000 milliseconds between each retry, up to 10 seconds, then 10 seconds afterwards" ...raiseException("Retry!") ... >>>wait_exponential_1000() Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Wait2^x*1000millisecondsbetweeneachretry,upto10seconds,then10secondsafterwards Traceback(mostrecentcalllast): File"<stdin>",line1,in<module> File"/usr/local/lib/python2.7/site-packages/retrying.py",line49,inwrapped_f returnRetrying(*dargs,**dkw).call(f,*args,**kw) File"/usr/local/lib/python2.7/site-packages/retrying.py",line212,incall raiseattempt.get() File"/usr/local/lib/python2.7/site-packages/retrying.py",line247,inget six.reraise(self.value[0],self.value[1],self.value[2]) File"/usr/local/lib/python2.7/site-packages/retrying.py",line200,incall attempt=Attempt(fn(*args,**kwargs),attempt_number,False) File"<stdin>",line4,inwait_exponential_1000 Exception:Retry!
A pattern I use very often, is the ability to retry only based on some
exception type. You can specify a function to filter out exception you want to
ignore or the one you want to use to retry.
retry will call the function passed as retry_on_exception with the
exception raised as first argument. It's up to the function to then return a
boolean indicating if a retry should be performed or not. In the example above,
this will only retry to read the file if an IOError occurs; if any other
exception type is raised, no retry will be performed.
The same pattern can be implemented using the keyword argument
retry_on_result, where you can provide a function that analyses the result
and retry based on it.
This example will read the file until it stops being empty. If the file does
not exist, an IOError is raised, and the default behavior which triggers
retry on all exceptions kicks-in the retry is therefore performed.
That's it! retry is really a good and small library that you should leverage
rather than implementing your own half-baked solution!
Hello
One of my last blog introduced the new cme update dpkg-copyright command and explained how to use this command to create a debian/copyright file from scratch.
We will see in this blog how cme update dpkg-copyright command can also be used if a debian/copyright file already exists.
During the lifetime of a package, creating a new debian/copyright copyright file should only happen once. When updating a package to a new upstream version, the content of the copyright file should be modified to reflect upstream changes by:
adding or removing file entries
updating years or owners
updating licenses
cme update dpkg-copyright can be run with an existing debian/copyright file: the information extracted by licensecheck are merged in debian/copyright. Unfortunately, this merge may bring back the errors coming from licensecheck that you ve cleaned up manually last time.
This last part is not optimal as the manual clean up must be repeated after cme update dpkg-copyright is run.
Here s a way to avoid the last problem: cme update dpkg-copyright supports a way to modify the content of debian/copyright after the merge: the optional file debian/fix.scanned.copyright contains instructions to tweak the content of debian/copyright. (See Config::Model::Dpkg::Copyright man page for more details)
You may remember that Config::Model handles all configuration information as a tree. The information contained in the copyright file is also stored in a tree structure. debian/fix.scanned.copyright contains instructions to navigate this tree and modify the content of the tree.
Imagine that there s a robot (or a monkey) in that configuration tree. Each instruction tells the robot either to move in the tree or to perform an operation.
The most useful instructions for debian/fix.scanned.copyright are:
! to move to the root of the tree
= to assign a value , e.g: short_name=MIT or Copyright="2014, FooBar" (use double quotes when the value white space or other fancy characters).
.= to append to a value, e.g Copyright.=" Appended info."
=~ to apply a substitution with a Perl regexp, e.g. Copyright=~"/ \s*//g"
: to move a Files element, e.g. Files:"foo/baz.c"
:~ to remove a Files element, e.g. Files:~"bogus.c"
Otherwise:
Comments with # or // must begin at the beginning of the line
Instructions are separated by space(s) or new lines
Let s see a commented example:
# go to the root of the tree (with '!')
# and remove a bogus Files entry (with ":~")
! Files:~"foo/bogus.c"
// go to a Files entry and append (operator '.=') some info to owner
! Files:"foo/bar.h"
Copyright.=" Appended info."
# go back to tree root and assign info
! Files:"foo/baz.c" Copyright="2014, FooBar"
# add a global license and a file entry missed by licensecheck
# global license must be set before using it in Files entry
# note: MIT text license is provided by cme
! License=MIT
! Files:"3rdparty/missed.c" Copyright="2005 FooBar" License short_name=MIT
Other possible instructions for this file are described in Config::Model::Loader doc.
The number of instructions depends on the accuracy of licencecheck command. Hopefully, this number can be reduced by improving licensecheck.
Last but not least, the following packages are required:
You may want to install also libconfig-model-tkui-perl to update the copyright file with cme GUI.
In summary, the command cme updated dpkg-copyright associated with instructions stored in debian/fix.scanned.copyright enable Debian packagers to update with less effort debian/copyright file when updating a package.
All the best
CVE-2015-3456, also known as VENOM, is a security
vulnerability in QEMU virtual floppy controller:
The Floppy Disk Controller (FDC) in QEMU, as used in Xen [ ]
and KVM, allows local guest users to cause a denial of service
(out-of-bounds write and guest crash) or possibly execute arbitrary
code via the FD_CMD_READ_ID, FD_CMD_DRIVE_SPECIFICATION_COMMAND,
or other unspecified commands.
Even when QEMU has been configured with no floppy drive, the
floppy controller code is still active. The vulnerability is easy to
test1:
Once the fix installed, all processes still have to be restarted for
the upgrade to be effective. It is possible to minimize the downtime
by leveraging virsh save.
Another possibility would be to patch the running processes. The Linux
kernel attracted a lot of interest in this area, with solutions like
Ksplice (mostly killed by Oracle), kGraft (by Red Hat) and
kpatch (by Suse) and the inclusion of a common framework in
the kernel. The userspace has far less out-of-the-box solutions2.
I present here a simple and self-contained way to patch a running
QEMU to remove the vulnerability without requiring any sensible
downtime. Here is a short demonstration:
Proof of concept
First, let s find a workaround that would be simple to implement
through live patching: while modifying running code text is possible,
it is easier to modify a single variable.
Concept
Looking at the code of the floppy controller and the
patch, we can avoid the vulnerability by not accepting any command
on the FIFO port. Each request would be answered by Invalid
command (0x80) and a user won t be able to push more bytes to the
FIFO until the answer is read and the FIFO queue reset. Of course, the
floppy controller would be rendered useless in this state. But who cares?
The list of commands accepted by the controller on the FIFO port is
contained in the handlers[] array:
To avoid browsing the array each time a command is received, another
array is used to map each command to the appropriate handler:
/* Associate command to an index in the 'handlers' array */staticuint8_tcommand_to_handler[256];staticvoidfdctrl_realize_common(FDCtrl*fdctrl,Error**errp)inti,j;staticintcommand_tables_inited=0;/* Fill 'command_to_handler' lookup table */if(!command_tables_inited)command_tables_inited=1;for(i=ARRAY_SIZE(handlers)-1;i>=0;i--)for(j=0;j<sizeof(command_to_handler);j++)if((j&handlers[i].mask)==handlers[i].value)command_to_handler[j]=i;/* [...] */
Our workaround is to modify the command_to_handler[] array to map
all commands to the fdctrl_unimplemented() handler (the last one in
the handlers[] array).
Testing with gdb
To check if the workaround works as expected, we test it with
gdb. Unless you have compiled QEMU yourself, you need to install a
package with debug symbols. Unfortunately, on Debian, they are not
available, yet3. On Ubuntu, you can install the
qemu-system-x86-dbgsym package after
enabling the appropriate repositories.
The following function for gdb maps every command to the
unimplemented handler:
define patch set $handler = sizeof(handlers)/sizeof(*handlers)-1 set $i = 0 while ($i < 256) set variable command_to_handler[$i++] = $handler end printf "Done!\n"end
Attach to the vulnerable process (with attach), call the function
(with patch) and detach of the process (with detach). You can
check that the exploit is not working anymore. This could be
easily automated.
Limitations
Using gdb has two main limitations:
It needs to be installed on each host to be patched.
The debug packages need to be installed as well. Moreover, it can
be difficult to fetch previous versions of those packages.
Writing a custom patcher
To overcome those limitations, we can write a customer patcher
using the ptrace() system call without relying on debug
symbols being present.
Finding the right memory spot
Before being able to modify the command_to_handler[] array, we need
to know its location. The first clue is given by the symbol table. To
query it, use readelf -s:
$ readelf -s /usr/lib/debug/.build-id/09/95121eb46e2a4c13747ac2bad982829365c694.debug \> sed -n -e 1,3p -e /command_to_handler/p
Symbol table '.symtab' contains 27066 entries: Num: Value Size Type Bind Vis Ndx Name 8485: 00000000009f9d00 256 OBJECTLOCALDEFAULT 26 command_to_handler
This table is usually stripped out of the executable to save space,
like shown below:
If your distribution provides a debug package, the debug symbols are
installed in /usr/lib/debug. Most modern distributions are now
relying on the build ID4 to map an executable to its
debugging symbols, like the example above. Without a debug package,
you need to recompile the existing package without stripping debug
symbols in a clean environment5. On Debian, this can be
done by setting the DEB_BUILD_OPTIONS environment variable to
nostrip.
We have now two possible cases:
the easy one, and
the hard one.
The easy case
On x86, here is the standard layout of a regular Linux process in
memory6:
The random gaps (ASLR) are here to prevent an attacker from reliably
jumping to a particular exploited function in memory. On x86-64, the
layout is quite similar. The important point is that the base
address of the executable is fixed.
The memory mapping of a process is also available through
/proc/PID/maps. Here is a shortened and annotated example on x86-64:
With a regular executable, the value given in the symbol table is
an absolute memory address:
$ readelf -s not-qemu \> sed -n -e 1,3p -e /command_to_handler/p
Symbol table '.dynsym' contains 9 entries: Num: Value Size Type Bind Vis Ndx Name 47: 0000000000602080 256 OBJECTLOCALDEFAULT 25 command_to_handler
So, the address of command_to_handler[], in the above example, is
just 0x602080.
The hard case
To enhance security, it is possible to load some executables at a
random base address, just like a library. Such an executable is called
a Position Independent Executable (PIE). An attacker won t be able
to rely on a fixed address to find some helpful function. Here is the
new memory layout:
With a PIE process, the value in the symbol table is now an offset
from the base address.
$ readelf -s not-qemu-pie sed -n -e 1,3p -e /command_to_handler/p
Symbol table '.dynsym' contains 17 entries: Num: Value Size Type Bind Vis Ndx Name 47: 0000000000202080 256 OBJECTLOCALDEFAULT 25 command_to_handler
If we look at /proc/PID/maps, we can figure out where the array is located in memory:
Patching a memory spot
Once we know the location of the command_to_handler[] array in memory,
patching it is quite straightforward. First, we start tracing
the target process:
/* Attach to the running process */staticintpatch_attach(pid_tpid)intstatus;printf("[.] Attaching to PID %d...\n",pid);if(ptrace(PTRACE_ATTACH,pid,NULL,NULL)==-1)fprintf(stderr,"[!] Unable to attach to PID %d: %m\n",pid);return-1;if(waitpid(pid,&status,0)==-1)fprintf(stderr,"[!] Error while attaching to PID %d: %m\n",pid);return-1;assert(WIFSTOPPED(status));/* Tracee may have died */if(ptrace(PTRACE_GETSIGINFO,pid,NULL,&si)==-1)fprintf(stderr,"[!] Unable to read siginfo for PID %d: %m\n",pid);return-1;assert(si.si_signo==SIGSTOP);/* Other signals may have been received */printf("[*] Successfully attached to PID %d\n",pid);return0;
Then, we retrieve the command_to_handler[] array, modify it and put it
back in memory7.
staticintpatch_doit(pid_tpid,unsignedchar*target)intret=-1;unsignedchar*command_to_handler=NULL;size_ti;/* Get the table */printf("[.] Retrieving command_to_handler table...\n");command_to_handler=ptrace_read(pid,target,QEMU_COMMAND_TO_HANDLER_SIZE);if(command_to_handler==NULL)fprintf(stderr,"[!] Unable to read command_to_handler table: %m\n");gotoout;/* Check if the table has already been patched. *//* [...] *//* Patch it */printf("[.] Patching QEMU...\n");for(i=0;i<QEMU_COMMAND_TO_HANDLER_SIZE;i++)command_to_handler[i]=QEMU_NOT_IMPLEMENTED_HANDLER;if(ptrace_write(pid,target,command_to_handler,QEMU_COMMAND_TO_HANDLER_SIZE)==-1)fprintf(stderr,"[!] Unable to patch command_to_handler table: %m\n");gotoout;printf("[*] QEMU successfully patched!\n");ret=0;out:free(command_to_handler);returnret;
Since ptrace() only allows to read or write a word at a time,
ptrace_read() and ptrace_write() are wrappers to read or write
arbitrary large chunks of memory8. Here is the code for
ptrace_read():
/* Read memory of the given process */staticvoid*ptrace_read(pid_tpid,void*address,size_tsize)/* Allocate the buffer */uword_t*buffer=malloc((size/sizeof(uword_t)+1)*sizeof(uword_t));if(!buffer)returnNULL;/* Read word by word */size_treadsz=0;doerrno=0;if((buffer[readsz/sizeof(uword_t)]=ptrace(PTRACE_PEEKTEXT,pid,(unsignedchar*)address+readsz,0))&&errno)fprintf(stderr,"[!] Unable to peek one word at address %p: %m\n",(unsignedchar*)address+readsz);free(buffer);returnNULL;readsz+=sizeof(uword_t);while(readsz<size);return(unsignedchar*)buffer;
Putting the pieces together
The patcher is provided with the following information:
the PID of the process to be patched,
the command_to_handler[] offset from the symbol table, and
the build ID of the executable file used to get this offset (as a safety measure).
The main steps are:
Attach to the process with ptrace().
Get the executable name from /proc/PID/exe.
Parse /proc/PID/maps to find the address of the text segment (it s the first one).
Do some sanity checks:
check there is a ELF header at this location (4-byte magic number),
check the executable type (ET_EXEC for regular executables, ET_DYN for PIE), and
get the build ID and compare with the expected one.
From the base address and the provided offset, compute the location of the command_to_handler[] array.
An interesting project seems to be Katana. But there
are also some insightful hackingpapers on
the subject.
Some packages come with a -dbg package with debug
symbols, some others don t. Fortunately, a proposal
to automatically produce debugging symbols for
everything is near completion.
If the build is incorrectly reproduced, the build ID
won t match. The information provided by the debug
symbols may or may not be correct. Debian currently
has a reproducible builds effort to ensure that
each package can be reproduced.
Being an uninitialized static variable, the variable is in
the BSS section. This section is mapped to a writable memory
segment. If it wasn t the case, with Linux, the ptrace()
system call is still allowed to write. Linux will copy the
page and mark it as private.
With Linux 3.2 or later, process_vm_readv()
and process_vm_writev() can be used to transfer data from/to
a remote process without using ptrace() at all. However,
ptrace() would still be needed to reliably stop the main
thread.
This is currently the top story on the Linux subreddit. It links to this Tweet which demonstrates using a System Management Mode backdoor to perform privilege escalation under Linux. This is not a story.
But first, some background. System Management Mode (SMM) is a feature in most x86 processors since the 386SL back in 1990. It allows for certain events to cause the CPU to stop executing the OS, jump to an area of hidden RAM and execute code there instead, and then hand off back to the OS without the OS knowing what just happened. This allows you to do things like hardware emulation (SMM is used to make USB keyboards look like PS/2 keyboards before the OS loads a USB driver), fan control (SMM will run even if the OS has crashed and lets you avoid the cost of an additional chip to turn the fan on and off) or even more complicated power management (some server vendors use SMM to read performance counters in the CPU and adjust the memory and CPU clocks without the OS interfering).
In summary, SMM is a way to run a bunch of non-free code that probably does a worse job than your OS does in most cases, but is occasionally helpful (it's how your laptop prevents random userspace from overwriting your firmware, for instance). And since the RAM that contains the SMM code is hidden from the OS, there's no way to audit what it does. Unsurprisingly, it's an interesting vector to insert malware into - you could configure it so that a process can trigger SMM and then have the resulting SMM code find that process's credentials structure and change it so it's running as root.
And that's what Dmytro has done - he's written code that sits in that hidden area of RAM and can be triggered to modify the state of the running OS. But he's modified his own firmware in order to do that, which isn't something that's possible without finding an existing vulnerability in either the OS or (or more recently, and) the firmware. It's an excellent demonstration that what we knew to be theoretically possible is practically possible, but it's not evidence of such a backdoor being widely deployed.
What would that evidence look like? It's more difficult to analyse binary code than source, but it would still be possible to trace firmware to observe everything that's dropped into the SMM RAM area and pull it apart. Sufficiently subtle backdoors would still be hard to find, but enough effort would probably uncover them. A PC motherboard vendor managed to leave the source code to their firmware on an open FTP server and copies leaked into the wild - if there's a ubiquitous backdoor, we'd expect to see it there.
But still, the fact that system firmware is mostly entirely closed is still a problem in engendering trust - the means to inspect large quantities binary code for vulnerabilities is still beyond the vast majority of skilled developers, let alone the average user. Free firmware such as Coreboot gets part way to solving this but still doesn't solve the case of the pre-flashed firmware being backdoored and then installing the backdoor into any new firmware you flash.
This specific case may be based on a misunderstanding of Dmytro's work, but figuring out ways to make it easier for users to trust that their firmware is tamper free is going to be increasingly important over the next few years. I have some ideas in that area and I hope to have them working in the near future.
As always, even though I've not been posting much, I'm still buying
books. This is a catch-up post listing a variety of random purchases.
Katherine Addison The Goblin Emperor (sff)
Milton Davis From Here to Timbuktu (sff)
Mark Forster How to Make Your Dreams Come True (non-fiction)
Angela Highland Valor of the Healer (sff)
Marko Kloos Terms of Enlistment (sff)
Angela Korra'ti Faerie Blood (sff)
Cixin Liu The Three-Body Problem (sff)
Emily St. John Mandel Station Eleven (sff)
Sydney Padua The Thrilling Adventures of Lovelace and Babbage
(graphic novel)
Melissa Scott & Jo Graham The Order of the Air Omnibus (sff)
Andy Weir The Martian (sff)
Huh, for some reason I thought I'd bought more than that.
I picked up the rest of the Hugo nominees that aren't part of a slate,
and as it happens have already read all the non-slate nominees at the time
of this writing (although I'm horribly behind on reviews). I also picked
up the first book of Marko Kloos's series, since he did the right thing
and withdrew from the Hugos once it became clear what nonsense was going
on this year.
The rest is a pretty random variety of on-line recommendations, books by
people who made sense on the Internet, and books by authors I like.
I manage a few servers for myself, friends and
family
as well as for the Libravatar project. Here is
how I customize recent releases of Debian on those servers.
Prior to spending any time configuring a new physical server, I like to
ensure that the hardware is fine.
To check memory, I boot into memtest86+ from the grub menu and let it run
overnight.
Then I check the hard drives using:
smartctl -t long /dev/sdX
badblocks -swo badblocks.out /dev/sdX
Configuration
apt-get install etckeepr git sudo vim
To keep track of the configuration changes I make in /etc/, I use etckeeper
to keep that directory in a git repository and make the following changes to
the default /etc/etckeeper/etckeeper.conf:
turn off daily auto-commits
turn off auto-commits before package installs
To get more control over the various packages I install, I change the
default debconf level to medium:
dpkg-reconfigure debconf
Since I use vim for all of my configuration file editing, I make it the
default editor:
update-alternatives --config editor
ssh
apt-get install openssh-server mosh fail2ban
Since most of my servers are set to UTC time, I like to use my local
timezone
when sshing into them. Looking at file timestamps is much less
confusing that way.
I also ensure that the locale I use is available on the server by adding it
the list of generated locales:
dpkg-reconfigure locales
Other than that, I harden the ssh configuration
and end up with the following settings in /etc/ssh/sshd_config (jessie):
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
UsePrivilegeSeparation sandbox
AuthenticationMethods publickey
PasswordAuthentication no
PermitRootLogin no
AcceptEnv LANG LC_* TZ
LogLevel VERBOSE
AllowGroups sshuser
Then I remove the "Accepted" filter in /etc/logcheck/ignore.d.server/ssh
(first line) to get a notification whenever anybody successfully logs into
my server.
I also create a new group and add the users that need ssh access to it:
addgroup sshuser
adduser francois sshuser
and add a timeout for root sessions by putting this in /root/.bash_profile:
Logcheck is the main tool I use to keep an eye on log files, which is why I
add a few additional log files to the default list in
/etc/logcheck/logcheck.logfiles:
To keep the system clock accurate and increase the amount of entropy
available to the server, I install the above packages and add the tpm_rng
module to /etc/modules.
Preventing mistakes
apt-get install molly-guard safe-rm sl
The above packages are all about catching mistakes (such as
accidental deletions).
However, in order to extend the molly-guard protection to mosh sessions, one needs to
manually apply a patch.
These tools help me keep packages up to date and remove unnecessary or
obsolete packages from servers. On Rackspace servers, a small configuration
change
is needed to automatically update the monitoring tools.
In addition to this, I use the update-notifier-common package along with
the following cronjob in /etc/cron.daily/reboot-required:
Most of these tools are configure-free, except for sysstat, which requires
enabling data collection in /etc/default/sysstat to be useful.
Apache configuration
apt-get install apache2-mpm-event
While configuring apache is often specific to each server and the services
that will be running on it, there are a few common changes I make.
I enable these in /etc/apache2/conf.d/security:
<Directory />
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>
ServerTokens Prod
ServerSignature Off
and remove cgi-bin directives from /etc/apache2/sites-enabled/000-default.
I also create a new /etc/apache2/conf.d/servername which contains:
ServerName machine_hostname
Mail
apt-get install postfix
Configuring mail properly is tricky but the following has worked for me.
In /etc/hostname, put the bare hostname (no domain), but in
/etc/mailname put the fully qualified hostname.
Change the following in /etc/postfix/main.cf:
before running newaliases to update the aliases database.
Create a new cronjob (/etc/cron.hourly/checkmail):
#!/bin/sh
ls /var/mail
to ensure that email doesn't accumulate unmonitored on this box.
Finally, set reverse DNS for the server's IPv4 and IPv6 addresses and then
test the whole setup using mail root.
Colin Percival and I have worked on an internet-draft on scrypt for some time. I realize now that the -00 draft was published over two years ago, turning this effort today somewhat into archeology rather than rocket science. Still, having a published RFC that is easy to refer to from other Internet protocols will hopefully help to establish the point that PBKDF2 alone no longer provides state-of-the-art protection for password hashing.
I have written about password hashing before where I give a quick introduction to the basic concepts in the context of the well-known PBKDF2 algorithm. The novelty in scrypt is that it is designed to combat brute force and hardware accelerated attacks on hashed password databases. Briefly, scrypt expands the password and salt (using PBKDF2 as a component) and then uses that to create a large array (typically tens or hundreds of megabytes) using the Salsa20 core hash function and then de-references that large array in a random and sequential pattern. There are three parameters to the scrypt function: a CPU/Memory cost parameter N (varies, typical values are 16384 or 1048576), a blocksize parameter r (typically 8), and a parallelization parameter p (typically a low number like 1 or 16). The process is described in the draft, and there are further discussions in Colin s original scrypt paper.
The document has been stable for some time, and we are now asking for it to be published. Thus now is good time to provide us with feedback on the document. The live document on gitlab is available if you want to send us a patch.
I recently acquired a Lenovo Yoga 2 13. While, at the time, the Yoga 3 was available, I decided to go for Yoga 2 13. The Yoga 3 comes with the newer Core M Broadwell family, which, in my opinion, doesn't really bring any astounding benefits.
The Yoga 2 13 comes in mulitple variants worldwide. Infact these hardware variations have different effets when run under Linux.
My varaint of Yoga 2 13 is:
CPU: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
RAM: 8 GiB - Occupying 2 slots
Memory Controller Information
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 8192 MB
Maximum Total Memory Size: 16384 MB
Handle 0x0006, DMI type 6, 12 bytes
Handle 0x0007, DMI type 6, 12 bytes
The usual PCI devices:
rrs@learner:~$ lspci
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4)
00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
01:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
17:37
And the storage devices
Device Model: WDC WD5000M22K-24Z1LT0-SSHD-16GB
Device Model: KINGSTON SM2280S3120G
Storage
The drive runs into serious performance problems when its SSHD's NCQ (mis)feature is under use in Linux <= 4.0.
[28974.232550] ata2.00: configured for UDMA/133
[28974.232565] ahci 0000:00:1f.2: port does not support device sleep
[28983.680955] ata1.00: exception Emask 0x10 SAct 0x7fffffff SErr 0x400100 action 0x6 frozen
[28983.681000] ata1.00: irq_stat 0x08000000, interface fatal error
[28983.681027] ata1: SError: UnrecovData Handshk
[28983.681052] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.681082] ata1.00: cmd 61/40:00:b8:84:88/05:00:0a:00:00/40 tag 0 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.681152] ata1.00: status: DRDY
[28983.681171] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.681202] ata1.00: cmd 61/40:08:f8:89:88/05:00:0a:00:00/40 tag 1 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.681271] ata1.00: status: DRDY
[28983.681289] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.681316] ata1.00: cmd 61/40:10:38:8f:88/05:00:0a:00:00/40 tag 2 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.681387] ata1.00: status: DRDY
[28983.681407] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.681435] ata1.00: cmd 61/40:18:78:94:88/05:00:0a:00:00/40 tag 3 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697642] ata1.00: status: DRDY
[28983.697643] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697646] ata1.00: cmd 61/40:c8:38:65:88/05:00:0a:00:00/40 tag 25 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697647] ata1.00: status: DRDY
[28983.697648] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697651] ata1.00: cmd 61/40:d0:78:6a:88/05:00:0a:00:00/40 tag 26 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697651] ata1.00: status: DRDY
[28983.697652] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697656] ata1.00: cmd 61/40:d8:b8:6f:88/05:00:0a:00:00/40 tag 27 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697657] ata1.00: status: DRDY
[28983.697658] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697661] ata1.00: cmd 61/40:e0:f8:74:88/05:00:0a:00:00/40 tag 28 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697662] ata1.00: status: DRDY
[28983.697663] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697666] ata1.00: cmd 61/40:e8:38:7a:88/05:00:0a:00:00/40 tag 29 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697667] ata1.00: status: DRDY
[28983.697668] ata1.00: failed command: WRITE FPDMA QUEUED
[28983.697672] ata1.00: cmd 61/40:f0:78:7f:88/05:00:0a:00:00/40 tag 30 ncq 688128 out
res 40/00:3c:78:a9:88/00:00:0a:00:00/40 Emask 0x10 (ATA bus error)
[28983.697672] ata1.00: status: DRDY
[28983.697676] ata1: hard resetting link
[28984.017356] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[28984.022612] ata1.00: configured for UDMA/133
[28984.022740] ata1: EH complete
[28991.611732] Suspending console(s) (use no_console_suspend to debug)
[28992.183822] sd 1:0:0:0: [sdb] Synchronizing SCSI cache
[28992.186569] sd 1:0:0:0: [sdb] Stopping disk
[28992.186604] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[28992.189594] sd 0:0:0:0: [sda] Stopping disk
[28992.967426] PM: suspend of devices complete after 1351.349 msecs
[28992.999461] PM: late suspend of devices complete after 31.990 msecs
[28993.000058] ehci-pci 0000:00:1d.0: System wakeup enabled by ACPI
[28993.000306] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[28993.016463] PM: noirq suspend of devices complete after 16.978 msecs
[28993.017024] ACPI: Preparing to enter system sleep state S3
[28993.017349] PM: Saving platform NVS memory
[28993.017357] Disabling non-boot CPUs ...
[28993.017389] intel_pstate CPU 1 exiting
[28993.018727] kvm: disabling virtualization on CPU1
[28993.019320] smpboot: CPU 1 is now offline
[28993.019646] intel_pstate CPU 2 exiting
In the interim, to overcome this problem, we can force the device to run in degraded mode. I'm not sure if it is really the degraded mode, or the device was falsely advertised as a 6 GiB capable device. Time will tell, but for now, force it to run in 3 GiB mode, and so far, I haven't run into the above mentioned probems. To force 3 GiB speed, apply the following.
And then verify it... As you can see below, I've forced it for ata1 because I want my SSD drive to run at full-speed. I've done enough I/O, which earlier resulted in the kernel spitting the SATA errors. With this workaround, the kernel does not spit any error messages.
[ 1.273365] libata version 3.00 loaded.
[ 1.287290] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 4 ports 6 Gbps 0x3 impl SATA mode
[ 1.288238] ata1: FORCE: PHY spd limit set to 3.0Gbps
[ 1.288240] ata1: SATA max UDMA/133 abar m2048@0xb051b000 port 0xb051b100 irq 41
[ 1.288242] ata2: SATA max UDMA/133 abar m2048@0xb051b000 port 0xb051b180 irq 41
[ 1.288244] ata3: DUMMY
[ 1.288245] ata4: DUMMY
[ 1.606971] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[ 1.607906] ata1.00: ATA-9: WDC WD5000M22K-24Z1LT0-SSHD-16GB, 02.01A03, max UDMA/133
[ 1.607910] ata1.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
[ 1.608856] ata1.00: configured for UDMA/133
[ 1.609106] scsi 0:0:0:0: Direct-Access ATA WDC WD5000M22K-2 1A03 PQ: 0 ANSI: 5
[ 1.927167] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 1.928980] ata2.00: ATA-8: KINGSTON SM2280S3120G, S8FM06.A, max UDMA/133
[ 1.928983] ata2.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32), AA
[ 1.929616] ata2.00: configured for UDMA/133
And the throughput you get out of your WD SATA SSHD drive, with capability set to 3.0 GiB is:
rrs@learner:/media/SSHD/tmp$ while true; do dd if=/dev/zero of=foo.img bs=1M count=20000; sync; rm -rf foo.img; sync; done
20000+0 records in
20000+0 records out
20971520000 bytes (21 GB) copied, 202.014 s, 104 MB/s
20000+0 records in
20000+0 records out
20971520000 bytes (21 GB) copied, 206.111 s, 102 MB/s
Hannes Reinecke has submitted patches for NCQ enhancements, for Linux 4.1, which I hope will resolve these problems. Another option is to disable NCQ for the drive, or else blacklist the make/model in driver/ata/libata-core.c
By the time I finished this blog entry draft, I had tests to conclude that this did not look like an NCQ problem. Because in degraded mode too, it runs with NCQ enabled (check above).
Another interesting feature of this drive is support for TRIM / DISCARD. This drive's FTL accepts the TRIM command. Ofcourse, you need to ensure that you have discard enabled in all the layers. In my case, SATA + Device Mapper (Crypt and LVM) + File System (ext4)
Display
The overall display of this device is amazing. It is large enough to give you vibrant look. At 1920x1080 resolution, things look good. The display support was available out-of-the-box.
There were some suspend / resume hangs that occured with kernels < 4.x, during suspend / resume. The issue was root caused and fixed for Linux 4.0.
You may still notice the following kernel messages, though not problematic to me so far.
[28977.518114] PM: thaw of devices complete after 3607.979 msecs
[28977.590389] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.590582] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.591095] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.591185] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.591368] acpi device:30: Cannot transition to power state D3cold for parent in (unknown)
[28977.591911] pci_bus 0000:01: Allocating resources
[28977.591933] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.592093] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[28977.592401] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
You may need to disable the Intel Management Engine Interface (mei.ko), incase you run into suspend/resume problems.
rrs@learner:/media/SSHD/tmp$ cat /etc/modprobe.d/intel-mei-blacklist.conf
blacklist mei
blacklist mei-me
17:01
You may also run into the following Kernel Oops during suspend/resume. Below, you see 2 interation of sleep because it first hibernates and then sleeps (s2both).
[ 180.470206] Syncing filesystems ... done.
[ 180.473337] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 180.475210] PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
[ 180.475213] PM: Marking nosave pages: [mem 0x0006f000-0x0006ffff]
[ 180.475215] PM: Marking nosave pages: [mem 0x00088000-0x000fffff]
[ 180.475220] PM: Marking nosave pages: [mem 0x97360000-0x97b5ffff]
[ 180.475274] PM: Marking nosave pages: [mem 0x9c36f000-0x9cffefff]
[ 180.475356] PM: Marking nosave pages: [mem 0x9d000000-0xffffffff]
[ 180.476877] PM: Basic memory bitmaps created
[ 180.477003] PM: Preallocating image memory... done (allocated 380227 pages)
[ 180.851800] PM: Allocated 1520908 kbytes in 0.37 seconds (4110.56 MB/s)
[ 180.851802] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 180.853355] Suspending console(s) (use no_console_suspend to debug)
[ 180.853520] wlan0: deauthenticating from c4:6e:1f:d0:67:26 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 180.864159] cfg80211: Calling CRDA to update world regulatory domain
[ 181.172222] PM: freeze of devices complete after 319.294 msecs
[ 181.196080] ------------[ cut here ]------------
[ 181.196124] WARNING: CPU: 3 PID: 3707 at drivers/gpu/drm/i915/intel_display.c:7904 hsw_enable_pc8+0x659/0x7c0 [i915]()
[ 181.196125] SPLL enabled
[ 181.196159] Modules linked in: rfcomm ctr ccm bnep pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) bridge stp llc xt_conntrack iptable_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_CHECKSUM xt_tcpudp iptable_mangle ip_tables x_tables nls_utf8 nls_cp437 vfat fat rtsx_usb_ms memstick snd_hda_codec_hdmi joydev mousedev hid_sensor_rotation hid_sensor_incl_3d hid_sensor_als hid_sensor_accel_3d hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf industrialio hid_sensor_iio_common iTCO_wdt iTCO_vendor_support hid_multitouch x86_pkg_temp_thermal intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm btusb hid_sensor_hub bluetooth uvcvideo videobuf2_vmalloc videobuf2_memops
[ 181.196203] videobuf2_core v4l2_common videodev media pcspkr evdev mac_hid arc4 psmouse serio_raw efivars i2c_i801 rtl8723be btcoexist rtl8723_common rtl_pci rtlwifi mac80211 snd_soc_rt5640 cfg80211 snd_soc_rl6231 snd_hda_codec_realtek i915 snd_soc_core snd_hda_codec_generic ideapad_laptop ac snd_compress dw_dmac sparse_keymap drm_kms_helper rfkill battery dw_dmac_core snd_hda_intel snd_pcm_dmaengine snd_soc_sst_acpi snd_hda_controller video 8250_dw regmap_i2c snd_hda_codec drm snd_hwdep snd_pcm spi_pxa2xx_platform i2c_designware_platform soc_button_array snd_timer i2c_designware_core snd i2c_algo_bit soundcore shpchp lpc_ich button processor fuse ipv6 autofs4 ext4 crc16 jbd2 mbcache btrfs xor raid6_pq algif_skcipher af_alg dm_crypt dm_mod sg usbhid sd_mod rtsx_usb_sdmmc rtsx_usb crct10dif_pclmul
[ 181.196220] crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd ahci libahci libata xhci_pci ehci_pci xhci_hcd ehci_hcd scsi_mod usbcore usb_common thermal fan thermal_sys hwmon i2c_hid hid i2c_core sdhci_acpi sdhci mmc_core gpio_lynxpoint
[ 181.196224] CPU: 3 PID: 3707 Comm: kworker/u16:7 Tainted: G O 4.0.4+ #14
[ 181.196225] Hardware name: LENOVO 20344/INVALID, BIOS 96CN29WW(V1.15) 10/16/2014
[ 181.196230] Workqueue: events_unbound async_run_entry_fn
[ 181.196233] 0000000000000000 ffffffffa0706f68 ffffffff81522198 ffff880064debc88
[ 181.196235] ffffffff8106c5b1 ffff880251460000 ffff880250f83b68 ffff880250f83b78
[ 181.196237] ffff880250f83800 0000000000000001 ffffffff8106c62a ffffffffa071407c
[ 181.196238] Call Trace:
[ 181.196248] [<ffffffff81522198>] ? dump_stack+0x40/0x50
[ 181.196251] [<ffffffff8106c5b1>] ? warn_slowpath_common+0x81/0xb0
[ 181.196254] [<ffffffff8106c62a>] ? warn_slowpath_fmt+0x4a/0x50
[ 181.196278] [<ffffffffa06ae349>] ? hsw_enable_pc8+0x659/0x7c0 [i915]
[ 181.196289] [<ffffffffa0643ee0>] ? intel_suspend_complete+0xe0/0x6e0 [i915]
[ 181.196300] [<ffffffffa0644501>] ? i915_drm_suspend_late+0x21/0x90 [i915]
[ 181.196311] [<ffffffffa0644690>] ? i915_pm_poweroff_late+0x40/0x40 [i915]
[ 181.196318] [<ffffffff813fa7ba>] ? dpm_run_callback+0x4a/0x100
[ 181.196321] [<ffffffff813fb010>] ? __device_suspend_late+0xa0/0x180
[ 181.196324] [<ffffffff813fb10e>] ? async_suspend_late+0x1e/0xa0
[ 181.196326] [<ffffffff8108b973>] ? async_run_entry_fn+0x43/0x160
[ 181.196330] [<ffffffff81083a5d>] ? process_one_work+0x14d/0x3f0
[ 181.196332] [<ffffffff81084463>] ? worker_thread+0x53/0x480
[ 181.196334] [<ffffffff81084410>] ? rescuer_thread+0x300/0x300
[ 181.196338] [<ffffffff81089191>] ? kthread+0xc1/0xe0
[ 181.196341] [<ffffffff810890d0>] ? kthread_create_on_node+0x180/0x180
[ 181.196346] [<ffffffff81527898>] ? ret_from_fork+0x58/0x90
[ 181.196349] [<ffffffff810890d0>] ? kthread_create_on_node+0x180/0x180
[ 181.196350] ---[ end trace 8e339004db298838 ]---
[ 181.220094] PM: late freeze of devices complete after 47.936 msecs
[ 181.220972] PM: noirq freeze of devices complete after 0.875 msecs
[ 181.221577] ACPI: Preparing to enter system sleep state S4
[ 181.221886] PM: Saving platform NVS memory
[ 181.222702] Disabling non-boot CPUs ...
[ 181.222731] intel_pstate CPU 1 exiting
[ 181.224041] kvm: disabling virtualization on CPU1
[ 181.224680] smpboot: CPU 1 is now offline
[ 181.225121] intel_pstate CPU 2 exiting
[ 181.226407] kvm: disabling virtualization on CPU2
[ 181.227025] smpboot: CPU 2 is now offline
[ 181.227441] intel_pstate CPU 3 exiting
[ 181.227728] Broke affinity for irq 19
[ 181.227747] Broke affinity for irq 41
[ 181.228771] kvm: disabling virtualization on CPU3
[ 181.228793] smpboot: CPU 3 is now offline
[ 181.229624] PM: Creating hibernation image:
[ 181.563651] PM: Need to copy 379053 pages
[ 181.563655] PM: Normal pages needed: 379053 + 1024, available pages: 1697704
[ 182.472910] PM: Hibernation image created (379053 pages copied)
[ 181.232347] PM: Restoring platform NVS memory
[ 181.233171] Enabling non-boot CPUs ...
[ 181.233246] x86: Booting SMP configuration:
[ 181.233248] smpboot: Booting Node 0 Processor 1 APIC 0x1
[ 181.246771] kvm: enabling virtualization on CPU1
[ 181.249339] CPU1 is up
[ 181.249389] smpboot: Booting Node 0 Processor 2 APIC 0x2
[ 181.262313] kvm: enabling virtualization on CPU2
[ 181.264853] CPU2 is up
[ 181.264903] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 181.277831] kvm: enabling virtualization on CPU3
[ 181.280317] CPU3 is up
[ 181.288471] ACPI: Waking up from system sleep state S4
[ 182.340655] PM: noirq thaw of devices complete after 0.637 msecs
[ 182.378087] PM: early thaw of devices complete after 37.428 msecs
[ 182.378436] rtlwifi: rtlwifi: wireless switch is on
[ 182.451021] rtc_cmos 00:01: System wakeup disabled by ACPI
[ 182.697575] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[ 182.697617] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 182.699248] ata1.00: configured for UDMA/133
[ 182.699911] ata2.00: configured for UDMA/133
[ 182.699917] ahci 0000:00:1f.2: port does not support device sleep
[ 186.059539] PM: thaw of devices complete after 3685.338 msecs
[ 186.134292] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.134479] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.134992] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.135080] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.135266] acpi device:30: Cannot transition to power state D3cold for parent in (unknown)
[ 186.135950] pci_bus 0000:01: Allocating resources
[ 186.135974] pcieport 0000:00:1c.0: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 01] add_size 200000
[ 186.135980] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.136049] pcieport 0000:00:1c.0: res[15]=[mem 0x00100000-0x000fffff 64bit pref] get_res_add_size add_size 200000
[ 186.136072] pcieport 0000:00:1c.0: BAR 15: assigned [mem 0x9fb00000-0x9fcfffff 64bit pref]
[ 186.136174] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 186.136490] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 199.454497] Suspending console(s) (use no_console_suspend to debug)
[ 200.024190] sd 1:0:0:0: [sdb] Synchronizing SCSI cache
[ 200.024356] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 200.025359] sd 1:0:0:0: [sdb] Stopping disk
[ 200.028701] sd 0:0:0:0: [sda] Stopping disk
[ 201.106085] PM: suspend of devices complete after 1651.336 msecs
[ 201.106591] ------------[ cut here ]------------
[ 201.106628] WARNING: CPU: 0 PID: 3725 at drivers/gpu/drm/i915/intel_display.c:7904 hsw_enable_pc8+0x659/0x7c0 [i915]()
[ 201.106628] SPLL enabled
[ 201.106656] Modules linked in: rfcomm ctr ccm bnep pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) bridge stp llc xt_conntrack iptable_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_CHECKSUM xt_tcpudp iptable_mangle ip_tables x_tables nls_utf8 nls_cp437 vfat fat rtsx_usb_ms memstick snd_hda_codec_hdmi joydev mousedev hid_sensor_rotation hid_sensor_incl_3d hid_sensor_als hid_sensor_accel_3d hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf industrialio hid_sensor_iio_common iTCO_wdt iTCO_vendor_support hid_multitouch x86_pkg_temp_thermal intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm btusb hid_sensor_hub bluetooth uvcvideo videobuf2_vmalloc videobuf2_memops
[ 201.106694] videobuf2_core v4l2_common videodev media pcspkr evdev mac_hid arc4 psmouse serio_raw efivars i2c_i801 rtl8723be btcoexist rtl8723_common rtl_pci rtlwifi mac80211 snd_soc_rt5640 cfg80211 snd_soc_rl6231 snd_hda_codec_realtek i915 snd_soc_core snd_hda_codec_generic ideapad_laptop ac snd_compress dw_dmac sparse_keymap drm_kms_helper rfkill battery dw_dmac_core snd_hda_intel snd_pcm_dmaengine snd_soc_sst_acpi snd_hda_controller video 8250_dw regmap_i2c snd_hda_codec drm snd_hwdep snd_pcm spi_pxa2xx_platform i2c_designware_platform soc_button_array snd_timer i2c_designware_core snd i2c_algo_bit soundcore shpchp lpc_ich button processor fuse ipv6 autofs4 ext4 crc16 jbd2 mbcache btrfs xor raid6_pq algif_skcipher af_alg dm_crypt dm_mod sg usbhid sd_mod rtsx_usb_sdmmc rtsx_usb crct10dif_pclmul
[ 201.106711] crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd ahci libahci libata xhci_pci ehci_pci xhci_hcd ehci_hcd scsi_mod usbcore usb_common thermal fan thermal_sys hwmon i2c_hid hid i2c_core sdhci_acpi sdhci mmc_core gpio_lynxpoint
[ 201.106714] CPU: 0 PID: 3725 Comm: kworker/u16:25 Tainted: G W O 4.0.4+ #14
[ 201.106715] Hardware name: LENOVO 20344/INVALID, BIOS 96CN29WW(V1.15) 10/16/2014
[ 201.106720] Workqueue: events_unbound async_run_entry_fn
[ 201.106723] 0000000000000000 ffffffffa0706f68 ffffffff81522198 ffff880064dd7c88
[ 201.106725] ffffffff8106c5b1 ffff880251460000 ffff880250f83b68 ffff880250f83b78
[ 201.106727] ffff880250f83800 0000000000000002 ffffffff8106c62a ffffffffa071407c
[ 201.106728] Call Trace:
[ 201.106737] [<ffffffff81522198>] ? dump_stack+0x40/0x50
[ 201.106740] [<ffffffff8106c5b1>] ? warn_slowpath_common+0x81/0xb0
[ 201.106742] [<ffffffff8106c62a>] ? warn_slowpath_fmt+0x4a/0x50
[ 201.106765] [<ffffffffa06ae349>] ? hsw_enable_pc8+0x659/0x7c0 [i915]
[ 201.106776] [<ffffffffa0643ee0>] ? intel_suspend_complete+0xe0/0x6e0 [i915]
[ 201.106786] [<ffffffffa0644501>] ? i915_drm_suspend_late+0x21/0x90 [i915]
[ 201.106797] [<ffffffffa0644690>] ? i915_pm_poweroff_late+0x40/0x40 [i915]
[ 201.106802] [<ffffffff813fa7ba>] ? dpm_run_callback+0x4a/0x100
[ 201.106805] [<ffffffff813fb010>] ? __device_suspend_late+0xa0/0x180
[ 201.106809] [<ffffffff813fb10e>] ? async_suspend_late+0x1e/0xa0
[ 201.106811] [<ffffffff8108b973>] ? async_run_entry_fn+0x43/0x160
[ 201.106813] [<ffffffff81083a5d>] ? process_one_work+0x14d/0x3f0
[ 201.106815] [<ffffffff81084463>] ? worker_thread+0x53/0x480
[ 201.106818] [<ffffffff81084410>] ? rescuer_thread+0x300/0x300
[ 201.106821] [<ffffffff81089191>] ? kthread+0xc1/0xe0
[ 201.106824] [<ffffffff810890d0>] ? kthread_create_on_node+0x180/0x180
[ 201.106827] [<ffffffff81527898>] ? ret_from_fork+0x58/0x90
[ 201.106830] [<ffffffff810890d0>] ? kthread_create_on_node+0x180/0x180
[ 201.106832] ---[ end trace 8e339004db298839 ]---
[ 201.130052] PM: late suspend of devices complete after 23.960 msecs
[ 201.130725] ehci-pci 0000:00:1d.0: System wakeup enabled by ACPI
[ 201.130885] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[ 201.146986] PM: noirq suspend of devices complete after 16.930 msecs
[ 201.147591] ACPI: Preparing to enter system sleep state S3
[ 201.147942] PM: Saving platform NVS memory
[ 201.147948] Disabling non-boot CPUs ...
[ 201.147999] intel_pstate CPU 1 exiting
[ 201.149324] kvm: disabling virtualization on CPU1
[ 201.149337] smpboot: CPU 1 is now offline
[ 201.149640] intel_pstate CPU 2 exiting
[ 201.151096] kvm: disabling virtualization on CPU2
[ 201.151108] smpboot: CPU 2 is now offline
[ 201.152017] intel_pstate CPU 3 exiting
[ 201.153250] kvm: disabling virtualization on CPU3
[ 201.153256] smpboot: CPU 3 is now offline
[ 201.156229] ACPI: Low-level resume complete
[ 201.156307] PM: Restoring platform NVS memory
[ 201.160033] CPU0 microcode updated early to revision 0x1c, date = 2014-07-03
[ 201.160190] Enabling non-boot CPUs ...
[ 201.160241] x86: Booting SMP configuration:
[ 201.160243] smpboot: Booting Node 0 Processor 1 APIC 0x1
[ 201.172665] kvm: enabling virtualization on CPU1
[ 201.174982] CPU1 is up
[ 201.175013] smpboot: Booting Node 0 Processor 2 APIC 0x2
[ 201.187569] CPU2 microcode updated early to revision 0x1c, date = 2014-07-03
[ 201.188796] kvm: enabling virtualization on CPU2
[ 201.191130] CPU2 is up
[ 201.191158] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 201.203297] kvm: enabling virtualization on CPU3
[ 201.205679] CPU3 is up
[ 201.210414] ACPI: Waking up from system sleep state S3
[ 201.224617] ehci-pci 0000:00:1d.0: System wakeup disabled by ACPI
[ 201.332523] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
[ 201.332634] PM: noirq resume of devices complete after 121.623 msecs
[ 201.372718] PM: early resume of devices complete after 40.058 msecs
[ 201.372892] rtlwifi: rtlwifi: wireless switch is on
[ 201.373270] sd 0:0:0:0: [sda] Starting disk
[ 201.373271] sd 1:0:0:0: [sdb] Starting disk
[ 201.445954] rtc_cmos 00:01: System wakeup disabled by ACPI
[ 201.692510] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 201.694719] ata2.00: configured for UDMA/133
[ 201.694724] ahci 0000:00:1f.2: port does not support device sleep
[ 201.836724] usb 2-4: reset high-speed USB device number 2 using xhci_hcd
[ 201.890158] psmouse serio1: synaptics: queried max coordinates: x [..5702], y [..4730]
[ 201.930768] psmouse serio1: synaptics: queried min coordinates: x [1242..], y [1124..]
[ 202.076784] usb 2-5: reset full-speed USB device number 3 using xhci_hcd
[ 202.205100] usb 2-5: ep 0x2 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 202.316799] usb 2-7: reset full-speed USB device number 5 using xhci_hcd
[ 202.444945] usb 2-7: No LPM exit latency info found, disabling LPM.
[ 202.556817] usb 2-8: reset full-speed USB device number 6 using xhci_hcd
[ 202.908691] usb 2-6: reset high-speed USB device number 4 using xhci_hcd
[ 203.932602] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[ 204.044890] ata1.00: configured for UDMA/133
[ 206.228698] PM: resume of devices complete after 4855.892 msecs
[ 206.380738] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.383152] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.385775] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.388066] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.390415] acpi device:30: Cannot transition to power state D3cold for parent in (unknown)
[ 206.393078] pci_bus 0000:01: Allocating resources
[ 206.393098] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.395470] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.397927] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[ 206.518516] Restarting kernel threads ... done.
[ 206.518812] PM: Basic memory bitmaps freed
[ 206.518816] Restarting tasks ... done.
There is one more occasional Kernel Oops (below), which I believe again has to do with Intel.
In my case, the laptop came with the Realtek Wireless device (details above in lspci output). Note: The machine has no wired interface.
While the Intel Wifi devices shipped with this laptop have their own share of problems, this device (rtl8723be) works out of the box. But only for a while. There is no certain pattern on what triggers the bug, but once triggered, the network just freezes. Nothing is logged.
If your Yoga 2 13 came with the RTL chip, the following workaround may help avoid the network issues.
Almost every boot, eventually, the kernel reports MCE errors. Not something I understand well, but so far, it hasn't caused any visible issues. And from what I have googled so far, nobodyseemstohavefixeditanywhere
So, with fingers crossed, lets just hope this never translates into a real problem.
What the kernel reports of the CPU's capabilities.
mcelog: failed to prefill DIMM database from DMI data
Hardware event. This is not a software error.
MCE 0
CPU 0 BANK 5
MISC 38a0000086 ADDR fef81880
TIME 1432455005 Sun May 24 13:40:05 2015
MCG status:
MCi status:
Error overflow
Uncorrected error
MCi_MISC register valid
MCi_ADDR register valid
Processor context corrupt
MCA: corrected filtering (some unreported errors in same region)
Generic CACHE Level-2 Generic Error
STATUS ee0000000040110a MCGSTATUS 0
MCGCAP c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 69
Hardware event. This is not a software error.
MCE 1
CPU 0 BANK 6
MISC 78a0000086 ADDR fef81780
TIME 1432455005 Sun May 24 13:40:05 2015
MCG status:
MCi status:
Uncorrected error
MCi_MISC register valid
MCi_ADDR register valid
Processor context corrupt
MCA: corrected filtering (some unreported errors in same region)
Generic CACHE Level-2 Generic Error
STATUS ae0000000040110a MCGSTATUS 0
MCGCAP c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 69
Hardware event. This is not a software error.
MCE 2
CPU 0 BANK 5
MISC 38a0000086 ADDR fef81880
TIME 1432455114 Sun May 24 13:41:54 2015
MCG status:
MCi status:
Error overflow
Uncorrected error
MCi_MISC register valid
MCi_ADDR register valid
Processor context corrupt
MCA: corrected filtering (some unreported errors in same region)
Generic CACHE Level-2 Generic Error
STATUS ee0000000040110a MCGSTATUS 0
MCGCAP c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 69
Hardware event. This is not a software error.
MCE 3
CPU 0 BANK 6
MISC 78a0000086 ADDR fef81780
TIME 1432455114 Sun May 24 13:41:54 2015
MCG status:
MCi status:
Uncorrected error
MCi_MISC register valid
MCi_ADDR register valid
Processor context corrupt
MCA: corrected filtering (some unreported errors in same region)
Generic CACHE Level-2 Generic Error
STATUS ae0000000040110a MCGSTATUS 0
MCGCAP c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 69
I was first elected to the Software in the Public Interest board back in 2009. I was re-elected in 2012. This July I am up for re-election again. For a variety of reasons I ve decided not to stand; mostly a combination of the fact that I think 2 terms (6 years) is enough in a single stretch and an inability to devote as much time to the organization as I d like. I mentioned this at the May board meeting. I m planning to stay involved where I can.
My main reason for posting this here is to cause people to think about whether they might want to stand for the board. Nominations open on July 1st and run until July 13th. The main thing you need to absolutely commit to is being able to attend the monthly board meeting, which is held on IRC at 20:30 UTC on the second Thursday of the month. They tend to last at most 30 minutes. Of course there s a variety of tasks that happen in the background, such as answering queries from prospective associated projects or discussing ongoing matters on the membership or board lists depending on circumstances.
It s my firm belief that SPI do some very important work for the Free software community. Few people realise the wide variety of associated projects. SPI offload the boring admin bits around accepting donations and managing project assets (be those machines, domains, trademarks or whatever), leaving those projects able to concentrate on the actual technical side of things. Most project members don t realise the involvement of SPI, and that s largely a good thing as it indicates the system is working. However it also means that there can sometimes be a lack of people wanting to stand at election time, and an absence of diversity amongst the candidates.
I m happy to answer questions of anyone who might consider standing for the board; #spi on irc.oftc.net is a good place to ask them - I am there as Noodles.
In January 2014, we launched the rtc.debian.org service for the Debian community. An equivalent service has been in testing for the Fedora community at FedRTC.org.
Some key points about the Fedora service:
The web front-end is just HTML, CSS and JavaScript. PHP is only used for account creation, the actual WebRTC experience requires no server-side web framework, just a SIP proxy.
The web code is all available in a Github repository so people can extend it.
The server is built entirely with packages from CentOS 7 + EPEL 7, except for the SIP proxy itself. The SIP proxy is reSIProcate, which is available as a Fedora package and builds easily on RHEL / CentOS.
Testing it with WebRTC
Create an RTC password and then log in. Other users can call you. It is federated, so people can also call from rtc.debian.org or from freephonebox.net.
Testing it with other SIP softphones
You can use the RTC password to connect to the SIP proxy from many softphones, including Jitsi or Lumicall on Android.
Copy it
The process to replicate the server for another domain is entirely described in the Real-Time Communications Quick Start Guide.
Discuss it
The FreeRTC mailing list is a great place to discuss any issues involving this site or free RTC in general.
WebRTC opportunities expanding
Just this week, the first batch of Firefox OS televisions are hitting the market. Every one of these is a potential WebRTC client that can interact with free communications platforms.