Home Blog Page 486

Tips for Customizing Your New Linux Installation

I recently installed the latest release of Fedora 26 from scratch on a brand new laptop. If you’ve been using Linux for a while, you may opt to do upgrades instead of fresh installs to keep your preferences and configurations intact. After all, who wants to go searching for customizations every time a new version of your favorite distribution (in my case, Fedora) comes out?

Every once in a while, however, I do a fresh Linux install to keep up with any new options and capabilities that may have been added. In this article, I will share how I configured the latest Fedora 26 on my laptop to meet my needs—and how you can, too.

Read more at OpenSource.com

Artifex v. Hancom: Open Source is Now an Enforceable Contract

By Jeff Luszcz, Vice President of Product Management at Flexera Software

The U.S. District Court recently ruled in favor of Artifex – developer of Ghostscript which is an open-source PDF interpreter and against Hancom Office – a South Korean developer of  ”office” apps.  The Northern District of California said that General Public License (GPL) can be treated like a legal contract, and developers can sue if the obligations of these licenses are not followed.  This ruling provides strong legal support to the enforceability of open source licenses.

At the heart of the matter is how Hancom used the Ghostscript library.  Ghostscript is a dual-licensed open source library.  This means it can be used under the terms of either an open source GPL, or under the terms of a classic commercial license.  Hancom incorporated the Ghostscript library into its product.  By not paying for a commercial license, the terms that Hancom would have available to them would be the terms of the GPL.  The GPL would require them to open source their product if it was linked to the Ghostscript library, and they then distributed the application.  Hancom did not provide the source code to their product (and did not elect to purchase a commercial license), putting them in conflict with the license that Ghostscript is distributed under.

Due to this, Artifex sued them at the end of last year, and on April 25, the Federal Court ruled in Artifex’s favor stating that the “GPL provides that Ghostscript users agrees to its terms, if the users do not obtain a commercial license.”

Hidden Risk: The Law…

There’s an old adage in the legal profession: Ignorance of the law is no defense.  So software companies need to beware.  Most aren’t aware of their open source components and compliance status – the risk they face as a result is significant.

As much as 50 percent of the code used in all software, including Internet of Things devices, is comprised of open source software.  While open source provides a convenient short cut for software developers to be more agile and efficient – there’s also a hidden risk: The law.

While open source components are, by definition free and available for anyone to use – there are limitations.  Most open source components have licensing obligations that developers must comply with.  And depending on the component – penalties for failure to comply with the open source license can be severe.  For example, in some instances a software company could be prevented from selling the product in which the open source component has been incorporated.  In other extreme examples, the entire software product containing the open source component could be required to be released as open source in order to come into compliance.

Education is the Answer

While the law is established enabling enforcement of open source licenses – most software developers are unaware of them.  Adding to the risk, most CEOs and general counsel are unaware of the open source components their developers are using.  And they don’t have automated means to scan their code for open source and ensure compliance with licensing terms.  CEOs and General Counsel need to educate themselves about open source software license compliance risk, then ensure their development teams have the training, processes and automation in place to ensure continual IP and legal compliance.

The open source movement has significantly changed how we design and build software.  While Open Source Software (OSS) has been around for decades, commercial software companies have had their traditional software design process flipped upside down in the last ten years.  When classic commercial software packages were first created years ago, there was very little third-party compliance that was required.  Commercial packages would be purchased, small pieces of source code from books would be used and possibly some quasi “open source” toolkits or libraries that were in limited distribution would be brought in.

Starting in the late 1980s and coming into its own in the 1990s and 2000s, open source components have become the backbone of the software industry.  The typical commercial product contains hundreds of high quality open source components, though data shows that only a small percentage of these components are having their open source licensing obligations followed.  Development practices have outpaced internal processes to manage the legal obligations and as a side effect, most companies are out of compliance.

Clear Disconnect

In interviews and discussions with legal teams and development teams, it becomes clear what has led to this disconnect.  The legal teams are under the mistaken understanding that developers are aware of the requirements of using open source libraries, and are taking care of them as they select components and use them.  Development is looking for guidance and policy, but at the same time is often under immense time pressure to get products out of the door.  While there may be high-level corporate policies about open source usage, it is very rare for development teams to have a hard requirement that fulfilling open source obligations is a gate for shipping product.

This disconnect is very clear when a company building a software product is required to produce an independently verified disclosure of all the open source and commercial code it uses.  This is very common request during mergers and acquisitions, during Original Equipment Manufacturer relationships and at the request of large enterprise companies.  Organizations are very surprised to see a 20 times or more difference between what they think they are using, and what they are really using.  They are typically out of compliance with each of those previously unknown components.

Acquirers and customers typically require technology companies to come into quick compliance from a legal perspective, as well as a vulnerability perspective.  This means that the technology provider is required to update their software in order to fulfill the obligations of the open source they are using.  The required actions include putting proper license notices and copyright statements in documentation and About Boxes, changing how libraries are linked or used and providing source code for certain components or the entire software product.  These actions are not always easy or possible to perform.

General Public Licenses

A problem that can affect these companies when working under someone else’s time constraints is that it is not always possible to come into compliance with the open source obligations in an already shipping product.  The product may depend on certain libraries that require obligations that are contrary to the company’s business model.  For instance, it is very common to encounter components in use that are licensed under the GPL.  The GPL is a popular and well-regarded license, and is the license used by well-known projects such as the Linux Kernel.  This license requires any source code linked to it to be provided to the end user, if used in a distributed product.  This includes the company’s own source code they wish to keep closed source or proprietary.  Shipped and linking to source under the GPL, while wanting to keep some of that source code proprietary leads to a legal conflict.  In many cases, coming into compliance requires the removal or rewriting of these libraries and features that depend on them.

The recent Versata/Ameriprise court case in the United States, showed the implications of having an unexpected open source component that was not having its obligations fulfilled.  This caused confusion and legal issues for end users, as well as tying up the original software producer in court.  It is not unexpected that more companies will look to undisclosed open source dependences as a defense in unrelated business lawsuits.

Other recent court cases in the United States and Europe have made it clear that companies are responsible for compliance when their software product is distributed.  This can lead to legal surprises due to unmanaged dependencies their developers have selected, as well as open source components introduced by their suppliers as part of their software supply chain.  What this means is that a company is responsible for the compliance for the choices their developers make, as well as the developers that work for the companies providing them Software Development Kits, components, operating systems and other executables.

If it is not clear who will be providing the proper compliance tasks, it often falls to the last organization in the chain to provide the notices, source and other required obligations.  This is a difficult and expensive task and often requires information that only previous members of the supply chain are privy to.  More and more companies are writing open source compliance requirements into supplier agreements, in order to receive any pass-through obligations such as license text and source bundles as well to encourage the proper and timely management of third-party dependencies.  This contract language helps make the case to the supply chain that they should take open source compliance seriously.  Additionally, these agreements may explicitly discuss vulnerability reporting and procedures for handling alerts and upgrades.

Don’t be Vulnerable

Another side effect of not keeping track of third-party components, is that you are not able to respond to reported vulnerabilities or patches required to keep these components up-to-date and secure.  This has the side effect of making products vulnerable to outside attacks.  These attacks can lead to data loss or financial damages.  Legal teams are finding themselves more and more involved with security response, and the legal and financial repercussions of these attacks.  In response, legal teams are putting in place policies around component updating as part of their efforts to reduce risk to their company.

Companies that manage open source components will often put in place an Open Source Review Board (OSRB).  The members of this group come from various teams who can help manage the use of third party and open source software in the organization.  This group typically contains representatives from the Legal, Engineering, Security and Business teams at an organization.  They are responsible for setting policy, educating other employees and being a source of open source knowledge for the company.  The policy they set can be implemented by the various engineering teams, and any new situations can be escalated back to the OSRB when required.

By taking the lead, legal teams can reduce risk for their organizations, and at the same time allow their companies to be good open source citizens.  Even if there was not the power of copyright standing behind the open source licenses we use, the open source development ecosystem depends on the users of open source to respect the philosophy licenses they use and give back where possible as well.  As more companies start to understand their true dependency on open source, we should expect more financial and technical support back to these projects.  Better compliance allows us to deliver higher quality, more secure and better supported products as well as helping to support a stronger open source ecosystem.

Real-Time Linux Summit, KVM Forum, Fossology, and More Happening Along With ELC Europe in Prague

The Embedded Linux Conference Europe is just around the corner. This year’s event — which is co-located with Open Source Summit Europe — will take place Oct. 23-26 in Prague, Czech Republic. In addition to the previously announced session highlights, there are several other co-located events to look forward to.

Real-Time Summit

The Real-Time Summit, organized by the Linux Foundation Real-Time Linux (RTL) collaborative project, gathers developers and users of the PREEMPT_RT patch. The aim is to facilitate discussion between developers, tooling experts, and users. More details of the agenda will be available soon.

Date: Thursday, Oct. 19 – Sunday, Oct. 22

Location: Czech Technical University

Preliminary Agenda:

Day 1 – RTLWS Dual Track – paper required

Day 2 – RTLWS

Day 3 – RT-Summit Single Track

Day 4 – Free Day with Prague tour from local students

Registration Cost:

  • Standard: $225 USD (from August 21 through September 17)

  • Late: $280 USD (from September 18 through event)

  • Students: $35 USD (student ID will be required at the event)

You can add the Real-Time Summit to your existing Open Source Summit Europe + ELCE Registration or register for the Real-Time Summit separately here.

KVM Forum

KVM is an industry leading open source hypervisor that provides an ideal platform for datacenter virtualization, virtual desktop infrastructure, and cloud computing. The KVM Forum is an annual technical conference that brings together the community of developers and users that define the KVM ecosystem.

Discussions will include the current state of affairs and plan for the future of KVM, its surrounding infrastructure, and management tools. Wednesday’s KVM content will be presented as a dedicated KVM track within the Open Source Summit lineup. Thursday and Friday will consist of keynotes and concurrent breakout sessions to dive deeper into content.

Dates: Wednesday, Oct. 25 – Friday, Oct. 27

Location: Hilton Prague

Registration Cost (KVM Forum Registration Only):

  • Standard: $475 USD (from August 28 through September 24)

  • Late: $525 USD (from September 25 through the event)

Register for KVM Forum.

If you’re already planning to attend Open Source Summit, reduced pricing is available.

  • Standard: $325 USD (from August 28 through September 24) + OSS Fee

  • Late: $375 USD (from September 25 through the event) + OSS Fee

Register here for KVM Forum + ELCE.

FOSSology – Hands On Training

FOSSology is an open source license compliance software system and toolkit. The toolkit lets you run license, copyright, and export control scans from the command line. The system offers a database and Web user interface that provides you with a compliance workflow.

This course will be valuable to anyone concerned with and involved in Open Source Management, including operational and legal executives, software development managers, open source program managers, and developers.

Date: Thursday, Oct. 26

Location: Hilton Prague

Registration Cost: $100 USD

Add FOSSology – Hands On Training to your existing Open Source Summit Europe + ELCE Registration.

Tracing Summit

The Tracing Summit, which is organized by the Diagnostic and Monitoring Workgroup, gathers people involved in development and end-users of tracing tools as well as trace analysis tools. The aim of this event is to provide room for discussion in the various areas that benefit from tracing, namely parallel, distributed and/or real-time systems, as well as kernel development. Half of the day is reserved for presentations and the other half for discussions between users and developers of the tracing infrastructures.

Date: Friday, Oct. 27

Location: Hilton Prague

Registration Cost: Complimentary

Add the Tracing Summit to your existing Open Source Summit Europe + ELCE Registration.

View the complete schedule for Embedded Linux Conference here. Linux.com readers receive an additional $40 off with code OSSEULDC20. Register Now!

Building Healthy Open Source Communities

Community — what a profound difference it can make for projects, businesses and organizations of all types. I’ve spent my entire career helping organizations build communities, ranging from internal communities to developer communities, with a strong focus on open source communities. The goal in fostering a healthy community around open source is to engage consumers, customers, and others and encourage them to contribute. With these thoughts in mind, let us consider a few of the important first steps in setting a community strategy, and then I want to tell you about a very special community-focused event that is coming up.

First Steps to Building Open Source Communities

What should a company do when setting an open source community strategy? This is less well understood than it should be. First, it is critical to understand the business value that can be derived from building a community. Just as diversity within an organization can drive tangibly better business results, a healthy community can too.

Read more at The Linux Foundation

MesosCon Europe Features Expert Talks from Netflix, Verizon, Microsoft, and More

MesosCon Europe, taking place Oct. 25-27 in Prague, Czech Republic, is an annual conference organized by the Apache Mesos community that brings together users and developers to share and learn about the project and its growing ecosystem.

This year’s conference schedule will feature a one-day hackathon followed by two days of sessions focused on the Apache Mesos Core and related technologies.

Featured keynote speakers include:

  • Katharina Probst, Engineering Manager, Edge Systems, Netflix, covering applications to reliability and operational insights

  • Eugen Feller, Principal Software Engineer, Verizon discussing implementing a serverless computing platform on Apache Mesos

  • Pierre Cheynier, Operations Engineer, Criteo presenting on operating 600+ Mesos servers on 7 datacenters

Session highlights include:

  • Building FAST Data Solutions with DC/OS on Azure – Rob Bagby, Microsoft

  • Deep Learning with GPU on Mesos with Serverless Computing – Mandeep Gandhi, Adobe Systems

  • More Bang for Your Buck: How Yelp Autoscales Mesos + Marathon on AWS Spot Fleet – Rob Johnson, Yelp

  • Running Distributed TensorFlow on DC/OS – Kevin Klues, 1980

  • A Year with Apache Aurora – Rick Mangi, Chartbeat

The full lineup of all MesosCon Europe speakers and sessions can be viewed here. This conference is co-located with Open Source Summit Europe (separate registration is required).

Registration is discounted by $200 through Sept. 2, and academic rates are available. Applications are also being accepted for diversity and needs-based scholarships.

Blameless Port Mortem Meeting Template

Production incidents may be the worst kind of lean IT waste.

Let’s stop having them!

Paste this as the content of meeting invites to keep everyone informed on what a Blameless Post Mortem is and why we should always conduct them.

Blameless Post Mortem Template

Agenda:

  • Dissect the events as we understand (timeline)

Read more at Dev.to

The Quickie Guide to Continuous Delivery in DevOps

Developers are always under pressure to produce more and release software faster, which encourages the adoption of new concepts and tools. But confusing buzzwords obfuscate real technology and business benefits, particularly when a vendor has something to sell. That makes it hard to determine what works best—for real, not just as a marketing phrase—in the continuous flow of build and deliver processes. This article gives you the basics of continuous delivery to help you sort it all out.

To start with, the terms apply to different parts of the same production arc, each of which are automated to different degrees:

  • Continuous integration means frequently merging code into a central repository. “Frequently” means usually several times a day. Each merge triggers an automated “build and test” instance, a process sometimes called continuous build. But by either name, continuous integration and continuous build do nothing in terms of delivery or deployment. They’re about code management, not what happens to the code afterward.

Read more at HPE

Confluent Brings SQL Querying to Kafka Streaming Data

With ever-increasing volumes of data comes an ever-increasing need to process that data. Confluent has made a business out of helping enterprises handle never ending streams of data with its commercial packaging of Apache Kafka. And now, at Kafka Summit in San Francisco this week, Confluentintroduced a new open source project, called KSQL, that it says will allow users to apply SQL queries against streaming data.

In this move, Confluent is one of a growing number of companies, such as SQLSteam, attempting to apply the bringing the rigors of SQL to the world of real-time data analysis.

Neha Narkhede, CTO and co-founder of Confluent, said that KSQL offers a number of potential use cases to enterprises, from processing data as it comes into an organization to handling extract, transform and load (ETL)-like work on data warehouses and data transfers between systems.

Read more at The New Stack

Linux and Open Source on the Move in Embedded, Says Survey

AspenCore has released the results of an embedded technology survey of its EETimes and Embedded readers. The survey indicates that open source operating systems like Linux and FreeRTOS continue to dominate, while Microsoft Embedded and other proprietary platforms are declining.

Dozens of market studies are happy to tell you how many IoT gizmos are expected to ship by 2020, but few research firms regularly dig into embedded development trends. That’s where reader surveys come in handy. Our own joint survey with LinuxGizmos readers on hacker board trends offer insights into users of Linux and Android community-backed SBCs. The AspenCore survey has a smaller sample (1,234 vs. 1,705), but is broader and more in depth, asking many more questions and spanning developers who use a range of OSes on both MCU and application processors.

The survey, which was taken in March and April of this year, does not perfectly represent of global trends. The respondents are predominantly located in the U.S. and Canada (56 percent) followed by Europe/ENEA (25 percent), and Asia (11 percent). They also tend to be older, with an average of 24 years out of college, and work at larger, established companies with an average size of 3,452 employees and on teams averaging 15 engineers.

As shown by the chart above, Linux was dominant when readers were asked to list all the embedded OSes they used. Some 22 percent chose “Embedded Linux” compared to 20 percent selecting the open source FreeRTOS. The Linux numbers may actually be much higher since the 22 percent figure may only partially overlap with the 13 percent rankings for Debian and Android, the 11 percent ranking for Ubuntu, and 3 percent for Angstrom.

When looking at next year’s plans, FreeRTOS and Embedded Linux jump to 28 percent and 27 percent, respectively. Android also saw a sizable boost to 17 percent while Debian dropped to 12 percent, and Ubuntu and Angstrom stayed constant. The chief losers here are Microsoft Windows Embedded and Windows Compact, which rank 8 percent and 5 percent, respectively, dropping to 6 percent and 4 percent in future plans. Windows 10 IoT did not make the list at all.

As seen in the above graph, open source operating systems offered without commercial support beat commercial OSes by 41 percent to 30 percent. The trend toward open source has been consistent for the last five years of the survey, and plans for future projects suggest it will continue, with 43 percent planning to use open source vs. 28 percent for commercial.

In-house OSes appear to be in a gradual decline while commercial distros based on open source, such as the Yocto-based Wind River Linux and Mentor Embedded Linux, are  growing slightly. The advantages of commercial offerings are said to include better real-time capabilities (45 percent), followed by hardware compatibility, code size/memory usage, tech support, and maintenance, all in the mid 30 percentages. Drawbacks included expense and vendor lock-in.

When asked why respondents chose an OS in general, availability of full source code led at 39 percent, followed by “no royalties” (30 percent), and tech support and HW/SW compatibility, both at 27 percent. Next up was “freedom to customize or modify” and open source availability, both at 25 percent.

Increased interest in Linux and Android was also reflected in a question asking which industry conferences readers attended last year and expected to attend this year. The Linux Foundation’s Embedded Linux Conferences saw one of the larger proportional increases from 5.2 to 8.0 percent while the Android Builders Summit jumped from 2.7 percent to 4.5 percent.

Only 19 percent of respondents purchase off-the-shelf development boards vs. building or subcontracting their own boards. Among that 19 percent, boards from ST Microelectronics and TI are tied for most popular at 10.7 percent, followed by similarly unnamed boards from Xilinx, NXP, and Microchip. The 6-8 ranked entries are more familiar: Arduino (5.6 percent), Raspberry Pi (4.2 percent), and BeagleBone Black (3.4 percent).

When the question was asked slightly differently — What form factor do you work with? – these same three boards were included with categories like 3.5” and ATX. Here, the Arduino (17 percent), RPi (16 percent), and BB Black (10 percent) followed custom design (26 percent) and proprietary (23 percent). When asked which form factor readers planned for this year, the Raspberry Pi jumped to 23 percent. The only proportionally larger increase was ARM’s Mbed development platform which moved from 3 percent to 6 percent.

OS Findings Jibe with VDC Report

The key findings in the 2017 Embedded Market Survey on OS and open source are reflected in large part by the most recent VDC Research study on embedded tech, published last November. (We covered the 2015 report here.) VDC’s Global Market for IoT & Embedded Operating Systems 2016 projected only 2 percent (CAGR) growth for the IoT/embedded OS market through 2020 in large part due to the open source phenomenon.

“Free and/or publicly available, open source operating systems such as Debian-based Linux, FreeRTOS, and Yocto-based Linux continue to lead new stack wins, with nearly half of surveyed embedded engineers expecting to use some type of free, open source OS on their next project,” said VDC Research.

As the VDC chart above indicates, bare metal, in-house, and commercial OSes are on the decline, while open source – and especially free open source – platforms are on the rise. VDC cited the decline of Microsoft’s embedded platforms, and noted market uncertainty due to major chip vendor acquisitions, as well as the future of Wind River’s platforms as the company is fully integrated within Intel.

Other survey findings in chips, wireless, and more

More than a third of the AspenCore 2017 Embedded Market Survey respondents work on industrial automation, followed by a quarter each for consumer electronics and IoT. Half the respondents said that IoT will be important to their companies in 2017.

Some 13 percent of respondents said they use 64-bit chips, up from 8 percent in 2015. The report shows a reader-ranked list of processor vendors, but not the processors themselves. Most appear to be MCU vendors, but many also make higher-end SoCs. The picture is further muddied by rampant acquisition.

The processor leaders are Texas Instruments (31 percent) followed by Freescale (NXP/Qualcomm) and Atmel (Microchip) at 26 percent and Microchip on its own at 25 percent. Then comes STMicro (23 percent), NXP (Qualcomm) at 17 percent, and Intel at 16 percent. In future plans, TI and Freescale extend their lead, while STMicro jumps past Microchip to number three. Xilinx edges past Intel at 21 percent and 18 percent respectively, with Intel’s Altera unit at 17 percent.

When asked which 32-bit chips readers plan to use, the top contenders that run Linux include the Xilinx Zynq and NXP i.MX6, both ranked third at 17 percent behind STM32 and Microchip’s PIC-32. The Atmel SAMxx and TI Sitara families are tied for fifth at 14 percent, and the 32-bit models among Intel’s Atom and Core chips come next at 13 percent. Intel’s Linux-ready Altera FPGA SoCs follow at 12 percent, tied with Arduino. Despite the popularity of the Xilinx and Altera hybrid FPGA/ARM SoCs, use of FPGA chips overall has declined slightly to 30 percent.

C and C++ are by far the most popular programming languages at 56 percent and 22 percent, respectively. C has lost 10 percentage points since 2015, however, while C++ has gained three points. Python saw the largest boost when asked about future plans, jumping from 3 percent to 5 percent expected usage. Git is the top version control software at 38 percent, up from 31 percent two years ago.

The most widely implemented wireless technologies were WiFi (65 percent), Bluetooth (49 percent), cellular (25 percent), and 802.15.4 (ZigBee etc.), which ranked at 14 percent. Interestingly, use of virtualization and hypervisors has dropped to 15 percent, with only 7 percent saying they plan to use the technologies in 2017.

Debugging and “meeting schedules” were the two greatest development challenges cited by readers, both at 23 percent. The leading future challenge was “managing increases in code size and complexity,” at 19 percent.

Half the readers said they were working on embedded vision technology, but slightly less planned to do so this year. Other advanced technologies, including machine learning (25 percent), speech (22 percent), VR (14 percent), and AR (11 percent) all saw big jumps in expected use in 2017, especially with machine learning, which almost doubled to 47 percent.

Connect with the embedded community at Embedded Linux Conference Europe in Prague, October 23-25. Register now! 

Hardening Docker Hosts with User Namespaces

Securing your Docker containers and the hosts upon which they run is key to sustaining reliable and available services. From my professional DevSecOps perspective, securing the containers and the orchestrators (e.g., OpenShift, Docker Swarm, and Kubernetes) is usually far from easy. This is primarily because the goal posts change frequently thanks to the technology evolving at such a rapid pace.

A number of relatively new-world challenges need to be addressed but one thing you can do to make a significant difference is remap your server’s user (UIDs) and group (GIDs) ranges to different user and group ranges within your containers.

With some unchallenging configuration changes, it’s possible to segregate your host’s root user from the root user inside your containers with a not-so-new feature called User Namespaces. This feature has been around since Docker 1.10, which was released sometime around February 2016. I say that it’s a not-so-new feature because anybody that has been following the containerization and orchestration space will know that a feature more than six months old is considered all but an antique!

The lowdown

To get us started, I’ll run through the hands-on methodology of running host-level, or more accurately kernel-level, User Namespaces.

First, here’s a quick reminder of the definitions of two commonly related pieces of terminology when it comes to securing your Docker containers, or many other vendors’ containers for that matter. You might have come across cgroups. These allow a process to be locked down from within the kernel. When I say locked down, I mean we can limit its capacity to take up system resources. That applies to CPU, RAM, and IO, among many aspects of a system.

These are not to be confused with namespaces which control the visibility of a process. You might not want a process to see all of your network stack or other processes running inside the process table for example.

I’ll continue to use Docker as our container runtime example as it’s become so undeniably popular. What we will look at in this article is the remapping of users and groups inside a container with the host’s own processes. For clarity, the “host” being the server that the Docker daemon is running on. And, by extension we will affect the visibility of the container’s processes in order to protect our host.

That remapping of users and groups is known as manipulating User Namespaces to affect a user’s visibility of other processes on the system.

If you’re interested in some further reading then you could do worse than look at the manual on User Namespaces.  The man page explains: “User namespaces isolate security-related identifiers and attributes, in particular, user IDs and group IDs…”.

It goes on to say that: “process’s user and group IDs can be different inside and outside a user namespace. In particular, a process can have a normal unprivileged user ID outside a user namespace while at the same time having a user ID of 0 inside the namespace; in other words, the process has full privileges for operations inside the user namespace, but is unprivileged for operations outside the namespace.”

Figure 1 offers some further insight in the segregation that we’re trying to achieve with User Namespaces. You could do worse than look at this page for some more detailed information.

L-qCAb80kItvm-g496jALnZjxZ9IVzXywsSCJQ0k

Figure 1: An illustrative view of User Namespaces (Image source: https://endocode.com/blog/2016/01/22/linux-containers-and-user-namespaces)

Seconds out

Let’s clarify what we’re trying to achieve. Our aim is actually very simple; we want to segregate our host’s superuser (the root user which is always UID 0) away from a container’s root user.

The magical result of making these changes is that even if the container’s application runs as the root user and uses UID 0 then in reality the superuser UID only matters inside the container and no longer correlates to the superuser on your host.

Why is this a good thing you may ask? Well, if your container’s application is compromised, then you are safe in the knowledge that an attacker will still have to elevate their privileges if they escape from the container to take control of other services (running as containers) on your host and then ultimately your host itself.

Add a daemon option

It’s important to first enable your Docker daemon option, namely –userns-remap.

It’s worth pointing out at this stage that the last time I checked you will need to use Kubernetes v1.5+ to avoid breaking network namespaces with User Namespaces. Kubernetes simply won’t fire up from what I saw, complaining about Network Namespace issues.

Also, let me reiterate the fact that adding options to your Docker daemon might have changed recently due to a version change. If you’re using a version more than a month old then please accept my sympathies. There is a price for a continued rate of evolution; backward compatibility or a new way of doing things sometimes causes some eye strain. To my mind, there’s little to complain about, however; the technology is fantastic.

It’s for the reason of version confusion that I’ll show you the current way that I add this option to my Docker daemon and as a result your petrol-consumption may of course vary; different versions and different flavors needing additional tweaks. When there’s confusion about versions don’t be concerned if you know of a more efficient way of doing something. In other words, feel free to skip the parts that you know.

And so it begins

The first step is asking our Docker daemon to use for a JSON config file from now on (instead of a text file key=value, Unix-style config) and to do so we’ll add a DOCKER_OPTS to the file /etc/default/docker. It should make adding many options a bit easier in the medium term and stops you from editing systemd unit files with clumsy options.

Inside the file mentioned, we simply add the following line which, erm, points to another config file from now on:

DOCKER_OPTS="--config-file=/etc/docker/daemon.json"

I’m sure you’ve guessed that our newly created /etc/docker/daemon.json file needs to contain formatted JSON. And, in this case, I’ve stripped out other config for simplicity and just added a userns-remap option as follows.

{

  "userns-remap": "default"

}

For older versions (and different Linux distributions) or personal preference, you can probably add this config change directly into /etc/default/docker as DOCKER_OPTS=”–user-remap=default” and not use the JSON config file.

Equally, we can probably fire our Docker daemon up even without a service manager like systemd as shown below.

$ dockerd --userns-remap=default

I hope one of these ways of switching on this option works for you. Google is, as ever, your friend otherwise.

Eleventy-one

At this stage, note that so far I have taken the lazy option in the examples above and simply said “default” for our remapped user. We’ll come back to that in a second — fear not.

You can now jump to the only other mandatory config required to enable User Namespaces, courtesy of our friendly, neighborhood kernel.

Even if you stick to using “default” as I did above you should add these entries to the following files. On Red Hat derivatives, do this before restarting your Docker daemon with the added option shown above. On some distros these files don’t exist yet, so create them (using the echo command as below will do it) if they don’t already.

echo "dockremap:123000:65536" >> /etc/subuid

echo "dockremap:123000:65536" >> /etc/subgid

Restarting your daemon on modern Linux versions looks like this (a reminder that RHEL might be using the docker-latest service and Ubuntu might have required apt install docker.io to install the daemon in the first place amongst other gotchas).

$ systemctl restart docker

Crux of the matter

By adding the “subordinate” dockremap user and group entries to the files above, we are saying that we want to remap container user IDs and group IDs to the host range starting at 123,000. We can in theory use 65,536 above that starting range, but in practice this differs. In “current” versions, Docker actually only maps the first, single UID. Docker has said this will hopefully change in the future.

I mentioned that I’d explain the “default” user setting we used. That value tells the Docker internals to use the username and groupname dockremap as we’ve seen. You can use arbitrary names, but make sure your /etc/subuid and /etc/subgid files reflect the new name before then restarting your daemon.

Other changes

Note that you’ll have to re-pull your container images as they will now live in a new local subdirectory on your host.

If you look under the directory /var/lib/docker you will note our image storage directory is named after our now familiar UID.GID number-formatted range as follows:

$ ls /var/lib/docker

drwx------.  9 dockremap   dockremap   4096 Nov 11 11:11 123000.123000/

From here, if you enter your container with a command like this one shown below then you should see that your application is still running as the root user and using UID 0.

$ docker exec -it f73f181d3e bash

On the host, you can run the ps command and see that although the container thought it was using UID 0 (or the root user), actually it’s running as our 123,000 UID.

$ ps -ef | grep redis

If it helps, the command that I use on the host and directly inside containers to get the corresponding numbered UID for comparison with the username — which is displayed by most ps commands — is as follows:

$ ps -eo uid,gid,args

Limitations

As with all added security, there are tradeoffs; however, these aren’t too onerous in the case of User Namespaces.

To start, note that you won’t be able to open up your containers using –net=host or share PIDs with -pid=host if you use the above config.

Also, be warned that you can’t use a –read-only container, which is effectively a stateless container with User Namespaces.

Additionally, the super-lazy and highly dangerous privileged mode won’t work with this set up either. Also, you will need to make sure that any filesystems that you mount, such as NFS drives, can allow access to the UIDs and GIDs that you use.

One final gotcha is that Red Hat derivatives, such as CentOS, need to open up the kernel settings via the boot loader to enable User Namespaces. You can achieve this as so using grubby:

$ grubby --args="user_namespace.enable=1" 
  --update-kernel="$(grubby --default-kernel)"

Having done so, reboot your server for the to take effect. To disable that setting, you can use this command line:

$ grubby --remove-args="user_namespace.enable=1" 
  --update-kernel="$(grubby --default-kernel)";

The End

I suggest that these simple changes are well worth the effort in relation to bolstering your Docker host’s security.

The last thing that anybody wants is an attacker to sit idle with superuser access on a host for months learning about the weak links in your set up. Also known as an Advanced Persistent Threat, it would be very unwelcome and, of course, might happen entirely without your knowledge. All it takes is for the person who built an image that you pulled off Docker Hub to forget to upgrade a vulnerable library. On that ever so cheery note: Stay vigilant!

Learn more about essential sysadmin skills: Download the Future Proof Your SysAdmin Career ebook now.

Chris Binnie’s latest book, Linux Server Security: Hack and Defend, shows how hackers launch sophisticated attacks to compromise servers, steal data, and crack complex passwords, so you can learn how to defend against these attacks. In the book, he also talks you through making your servers invisible, performing penetration testing, and mitigating unwelcome attacks. You can find out more about DevSecOps and Linux security via his website (http://www.devsecops.cc).