{ "info": { "author": "TheDiveO", "author_email": "thediveo@gmx.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries", "Topic :: System :: Operating System Kernels :: Linux" ], "description": "# Linux Kernel Namespace Relations\n\n> **NOTE:** Python 3.5+ supported only\n\nThis Python 3 package allows discovering the following Linux Kernel\nnamespace relationships and properties, without having to delve into\n`ioctl()` hell:\n\n- the _owning_ user namespace of another Linux kernel namespace.\n- the _parent_ namespace of either a user or a PID namespace.\n- type of a Linux kernel namespace: user, PID, network, ...\n- owner user ID of a user namespace.\n\nSee also [ioctl() operations for Linux namespaces](http://man7.org/linux/man-pages/man2/ioctl_ns.2.html)\nfor more background information of the namespace operations exposed by\nthis Python library.\n\n\n# Installation\n\n```bash\n$ pip3 install linuxns-rel\n```\n\n> **NOTE:** the installation automatically detects Debian 9 Stretch and\n> correctly handles installing the PyQt5 package, if it is missing, in\n> at most version 5.10.1 -- as this is the last known working PyQt5\n> release on Debian 9 Stretch.\n\n# API Documentation\n\nPlease head over to our \n[linuxns_rel API documentation](https://thediveo.github.io/linuxns_rel/)\non GitHub Pages.\n\n\n# CLI Examples\n\n> **NOTE:** Debian 9 Stretch users will lack the ability discover the\n> owner user ID of hierarchical namespaces. The reason is that Debian\n> 9 Stretch ships with outdated Linux kernels that lack the required\n> Kernel functionality. Please enjoy this kind of _stability_. (Or is\n> this \"austerity\"?)\n\n## List User Namespaces\n\nYou can either use a simple `lsuserns` or `sudo lsuserns` -- the latter\nensures that you'll see _all_ user namespaces instead of only those you\nhave user access to.\n\n```bash\n$ sudo lsuserns \n```\n\nmay yield something like this, a pretty hierarchy of Linux kernel user\nnamespaces:\n\n```\nuser:[4026531837] process \"init\" owner root (0)\n \u251c\u2500\u2500 user:[4026532465] process \"firefox\" owner foobar (1000)\n \u251c\u2500\u2500 user:[4026532523] process owner foobar (1000)\n \u2502 \u2514\u2500\u2500 user:[4026532524] process owner foobar (1000)\n \u2502 \u2514\u2500\u2500 user:[4026532525] process owner foobar (1000)\n \u2502 \u2514\u2500\u2500 user:[4026532526] process \"bash\" owner foobar (1000)\n \u251c\u2500\u2500 user:[4026532699] process \"firefox\" owner foobar (1000)\n \u251c\u2500\u2500 user:[4026532868] process \"firefox\" owner foobar (1000)\n \u2514\u2500\u2500 user:[4026532467] process owner foobar (1000)\n ```\n\nIf you have either Chromium or/and Firefox running, then these will\nadd some user namespaces in order to sandbox their inner workings. And\nto add in some more hierarchical user namespaces, in another terminal\nsession simply issue the following command:\n\n```bash\n$ unshare -Ur unshare -Ur unshare -Ur unshare -Ur\n```\n\nDebian users may need to `sudo` because their distro's default\nconfiguration prohibits ordinary users to create new user namespaces.\n\n## List PID Namespaces\n\n```bash\n$ sudo lspidns \n```\n\nshows the PID namespace hierarchy, such as:\n\n```\npid:[4026531836] process \"init\" owner user:[4026531837] root (0)\n \u251c\u2500\u2500 pid:[4026532532] process \"sh\" owner user:[4026531837] root (0)\n \u2514\u2500\u2500 pid:[4026532468] process \"chromium-browser --type=zygote\" owner user:[4026532467] foobar (1000)\n \u251c\u2500\u2500 pid:[4026532464] process \"chromium-browser\" owner user:[4026532589] foobar (1000)\n \u251c\u2500\u2500 pid:[4026532466] process \"chromium-browser\" owner user:[4026532589] foobar (1000)\n \u2514\u2500\u2500 pid:[4026532590] process \"chromium-browser\" owner user:[4026532589] foobar (1000)\n```\n\nDon't worry that the PID namespace hierarchy doesn't match the user\nnamespace hierarchy. That's perfectly fine, depending on which programs\nrun. In our example, we didn't create new PID namespaces when using\n`unshare`, so we see only additional PID namespaces created by\nChromium (Firefox doesn't create them though).\n\n## Namespace Graph\n\nOkay, with the famous `graphviz` installed (`apt-get install graphviz`)\nnow simply do:\n\n```bash\n$ sudo -E graphns\n```\n\n> Note: `-E` ensures that the graph viewer will correctly use the your\n> desktop environment theme.\n\n...and you get something fancy with arrows, et cetera, in a cute (_erm_,\n\"qute\") little viewer window:\n\n![hierarchical namespace graph](doc/source/_static/hns-graph.svg)\n\nThe view window supports these actions:\n- mouse drag: move the visible area around inside the view window\n (usefull when either the graph is really large or when zoomed in).\n- mouse wheel: zoom in/out.\n- `+`/`-` keys: zoom in/out.\n- `1` key: reset zoom to 1x.\n- `s` key: save image to an SVG file.\n- `q` key: close and exit the viewer.\n- `h` key: show help on mouse and keys.\n\n# Potentially FAQs\n\n1. Q: Why do `get_userns()` and `get_parentns()` return file objects\n (`TextIO`) instead of filesystem paths?\n\n A: Because that's what the Linux namespace-related `ioctl()`\n functions are giving us: open file descriptors referencing namespaces\n in the special `nsfs` namespace filesystem. There are no paths\n associated with them.\n\n2. Q: What argument types do `get_nstype()`, `get_userns()`,\n `get_parentns()`, and `get_owner_uid()` expect?\n\n A: Choose your weapon:\n - a filesystem path (name), such as `/proc/self/ns/user`,\n - an open file object (`TextIO`), such as returned by `open()`,\n - an open file descriptor, such as returned by `fileno()` methods.\n\n3. Q: Why does `get_parentns()` throw an PermissionError?\n\n A: There are multiple causes:\n - you didn't specify a PID or user namespace,\n - the parent namespace either doesn't exist,\n - or the parent namespace is inaccessible to you,\n - oh, you really have no access to the namespace reference.\n\n4. Q: Why does `get_userns()` throw an PermissionError?\n\n A: You don't have access to the owning user namespace.\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/TheDiveO/linuxns_rel", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "linuxns-rel", "package_url": "https://pypi.org/project/linuxns-rel/", "platform": "", "project_url": "https://pypi.org/project/linuxns-rel/", "project_urls": { "Homepage": "https://github.com/TheDiveO/linuxns_rel" }, "release_url": "https://pypi.org/project/linuxns-rel/1.0.4/", "requires_dist": [ "psutil", "asciitree", "graphviz", "PyQt5", "coverage; extra == 'dev'", "sphinx; extra == 'dev'", "sphinx-rtd-theme; extra == 'dev'" ], "requires_python": "", "summary": "Linux namespace relationships library", "version": "1.0.4" }, "last_serial": 4169685, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "d4d88682104392021823b0637bdc3b20", "sha256": "629b1e485a27d37d5a49119d5883808a9e5d454427309f53a86e8f8efe7c5fa1" }, "downloads": -1, "filename": "linuxns_rel-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d4d88682104392021823b0637bdc3b20", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9542, "upload_time": "2018-07-15T17:57:06", "url": "https://files.pythonhosted.org/packages/a5/6e/42d60e5dae57c35bceccdbb85ddd8836c0661eb463b4b6f53805cddefe39/linuxns_rel-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb2624b85da3673538c690abacdf796d", "sha256": "73e5cb09cc98a00303d2ae593d37a7d7d736360fc75d8b48cf5dc5672ce8b792" }, "downloads": -1, "filename": "linuxns-rel-0.9.0.tar.gz", "has_sig": false, "md5_digest": "fb2624b85da3673538c690abacdf796d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8467, "upload_time": "2018-07-15T17:57:07", "url": "https://files.pythonhosted.org/packages/6f/eb/a0d29f9386a410e94c96b3b8ead5efdb8b7779a6b752916968c32ff77cd4/linuxns-rel-0.9.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "991f7f14c264bae2860cc996c19673f2", "sha256": "4d5cf242a0d5945300728322a6fd9cde7287ce57ae6fe6e20051a0cb167937b2" }, "downloads": -1, "filename": "linuxns_rel-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "991f7f14c264bae2860cc996c19673f2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11666, "upload_time": "2018-07-16T17:15:04", "url": "https://files.pythonhosted.org/packages/b3/bb/49ca3884a8a8a1b39b501ae271748c46ebead2c518884f4147f559f7519b/linuxns_rel-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9155b3d66d4d8bceeb9502d1e2286c56", "sha256": "0db0f8ca08d74597066062556d63a55a761827452fa3a9f1ffc05023347b0550" }, "downloads": -1, "filename": "linuxns-rel-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9155b3d66d4d8bceeb9502d1e2286c56", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10360, "upload_time": "2018-07-16T17:15:05", "url": "https://files.pythonhosted.org/packages/09/77/07d400244ade8d1cb98a20f6ee90078ae191aa6c1df459c163a6263a5273/linuxns-rel-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c6c1c7debff255777bae9199eb6db40a", "sha256": "c537492610799ade1b94d7acbee5cb59226abff46c8d03645a537380de6b8ff1" }, "downloads": -1, "filename": "linuxns_rel-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c6c1c7debff255777bae9199eb6db40a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13866, "upload_time": "2018-07-21T18:34:49", "url": "https://files.pythonhosted.org/packages/56/d3/0c20c0b97b210f5267c1aae178a4a9fcf3dd5d48635fd4476345ba183cdc/linuxns_rel-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8964785fffb503adf8082d8093305c41", "sha256": "5106e5e81d3edabd752aea33b9252b3cc5ec4b8fe58d0b1e52454a6a56add59d" }, "downloads": -1, "filename": "linuxns-rel-1.0.1.tar.gz", "has_sig": false, "md5_digest": "8964785fffb503adf8082d8093305c41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12330, "upload_time": "2018-07-21T18:34:50", "url": "https://files.pythonhosted.org/packages/6e/c8/8268d50d4e65803f90d6bd9b093e185aafb0f54b4c057405e66bd4d8ee72/linuxns-rel-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "68fc9a08e2ec45a642b0d3b12b7ad2f2", "sha256": "af5c43e862e94dddb709cbe2d0801662c7533d65468e31787b53087fb17917da" }, "downloads": -1, "filename": "linuxns_rel-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "68fc9a08e2ec45a642b0d3b12b7ad2f2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17264, "upload_time": "2018-08-04T17:14:46", "url": "https://files.pythonhosted.org/packages/3b/be/c8cfb428d5fc57d928d9cf64d07e3371e0e0734a2155b9296420c8fd1c14/linuxns_rel-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "05809c5950218e1a48deb35e7d2d68e3", "sha256": "c46dd10081402af33f1325491af903ee07b6ff3bf5bde542cd1b15015ffa3bf6" }, "downloads": -1, "filename": "linuxns-rel-1.0.2.tar.gz", "has_sig": false, "md5_digest": "05809c5950218e1a48deb35e7d2d68e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14593, "upload_time": "2018-08-04T17:14:47", "url": "https://files.pythonhosted.org/packages/1f/aa/1b100473ae92732c06391737ad29613986fa46badfdee9c17e64934c4e54/linuxns-rel-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "1b1de9fc7a27b80f2046ea696c97d35e", "sha256": "3ba02f0abdc4884eff7de4fd2512623dd97f846df953859de9a54ddc43ba97d6" }, "downloads": -1, "filename": "linuxns_rel-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "1b1de9fc7a27b80f2046ea696c97d35e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17835, "upload_time": "2018-08-06T15:57:31", "url": "https://files.pythonhosted.org/packages/a1/e4/fc98bae0042b826320ed3f6c16506c53181daea137d9860f7c8aeb6e828d/linuxns_rel-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6166c678c2656ee085434217a1e3133", "sha256": "479f9aa8dc96c68d60788fac27e6f971a1076399fc1d98ffee8399011aba4080" }, "downloads": -1, "filename": "linuxns-rel-1.0.3.tar.gz", "has_sig": false, "md5_digest": "f6166c678c2656ee085434217a1e3133", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15065, "upload_time": "2018-08-06T15:57:32", "url": "https://files.pythonhosted.org/packages/d8/80/f8355f6d0c9f7619e9c13999c98cbd4de968075f4e17c9afba39a127066c/linuxns-rel-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "8020dca83968d5d2a8875468041b1876", "sha256": "c5d4beb815ed31ef5624c2acebea98b779d845ffedf63ca970236875096a8b3a" }, "downloads": -1, "filename": "linuxns_rel-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8020dca83968d5d2a8875468041b1876", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18087, "upload_time": "2018-08-14T14:41:31", "url": "https://files.pythonhosted.org/packages/4f/f4/ed0fa4faaac500cd19daa3708d7c1dd8b8ac3e830ca05a3291679fd64183/linuxns_rel-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b13adc86a747fbdeb6ab8435836267b5", "sha256": "ef1265448d0a0cd76fb8d40e4165ae397448c7c5c58175101d07a6050c95b2f0" }, "downloads": -1, "filename": "linuxns-rel-1.0.4.tar.gz", "has_sig": false, "md5_digest": "b13adc86a747fbdeb6ab8435836267b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15550, "upload_time": "2018-08-14T14:41:33", "url": "https://files.pythonhosted.org/packages/5e/a5/a04014676cc9a242bb57f0cc8f97efe815ddf6ed9fdef18c886754fdd497/linuxns-rel-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8020dca83968d5d2a8875468041b1876", "sha256": "c5d4beb815ed31ef5624c2acebea98b779d845ffedf63ca970236875096a8b3a" }, "downloads": -1, "filename": "linuxns_rel-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8020dca83968d5d2a8875468041b1876", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18087, "upload_time": "2018-08-14T14:41:31", "url": "https://files.pythonhosted.org/packages/4f/f4/ed0fa4faaac500cd19daa3708d7c1dd8b8ac3e830ca05a3291679fd64183/linuxns_rel-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b13adc86a747fbdeb6ab8435836267b5", "sha256": "ef1265448d0a0cd76fb8d40e4165ae397448c7c5c58175101d07a6050c95b2f0" }, "downloads": -1, "filename": "linuxns-rel-1.0.4.tar.gz", "has_sig": false, "md5_digest": "b13adc86a747fbdeb6ab8435836267b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15550, "upload_time": "2018-08-14T14:41:33", "url": "https://files.pythonhosted.org/packages/5e/a5/a04014676cc9a242bb57f0cc8f97efe815ddf6ed9fdef18c886754fdd497/linuxns-rel-1.0.4.tar.gz" } ] }