From d4fd928577c6e7785b905c9bc962a4cb7cc028e3 Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Sun, 11 Aug 2019 12:21:15 +0200 Subject: [PATCH] Update everything, add scaleway password reset --- source/_static/custom.css | 13 +++-- source/blog/automaticcrm-iso.rst | 72 ++++++++++++++----------- source/blog/scaleway-restore-access.rst | 33 ++++++++++++ source/conf.py | 13 +++-- source/index.rst | 4 +- tox.ini | 2 +- 6 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 source/blog/scaleway-restore-access.rst diff --git a/source/_static/custom.css b/source/_static/custom.css index 710021c..d2e42c9 100644 --- a/source/_static/custom.css +++ b/source/_static/custom.css @@ -16,15 +16,15 @@ letter-spacing: 0px; } +.yue p { + hyphens: none; +} + .t-sidebar { background: #111111; font-size: 0.8em; } -.t-sidebar .inner { - width: auto; -} - .yue pre { font-family: andale; } @@ -69,3 +69,8 @@ a.atom { width: 30px; font-family: andale; } + +div.t-content > div.t-body > div.section:last-child { + color:#9a9a9a; + margin-top: 40px; +} diff --git a/source/blog/automaticcrm-iso.rst b/source/blog/automaticcrm-iso.rst index 6cddc35..ab43f63 100644 --- a/source/blog/automaticcrm-iso.rst +++ b/source/blog/automaticcrm-iso.rst @@ -4,26 +4,24 @@ :author: vladan :location: Belgrade -=========================== -AutomaticCRM Ubuntu Desktop -=========================== +========================= +Custom Ubuntu Desktop ISO +========================= -Below are the steps taken to create the Ubuntu 18.04.2 installer for the needs -of AutomaticCRM according to the requirements ... +Last week I got a task to create an Ubuntu ISO installer that should install +everything automatically, plus some other requirements listed below. This post +contains the steps taken to create the Ubuntu 18.04.2 installer according to +these requirements ... - Operating system - - * Only one domain is allowed ( dev.automaticcrm.ai ) in network adapter - * No print screen functionality - * No usb memory functionality - * No access to the filesystem - * No apps except browser + * `Only one domain is allowed`_ + * `No print screen functionality`_ + * `No usb memory functionality`_ + * `No access to the filesystem`_ + * `No apps except browser`_ - -Steps to set up the build environment -===================================== - +Set up the build environment +============================ .. code-block:: bash @@ -35,15 +33,23 @@ Steps to set up the build environment Set up the rootfs ================= +Create an nspawn container from the rootfs. + .. code-block:: bash unsquashfs disk/casper/filesystem.squashfs sudo systemd-nspawn \ --directory squashfs-root/ \ - --bind ~/dev/automaticcrm/deb:/opt/deb + --bind ~/dev/automaticcrm/deb:/opt/deb \ --bind /etc/resolv.conf /bin/bash -Once in the shell, run these commands: +No print screen functionality +----------------------------- + +... and other unneeded software. + +Once in the shell, run these commands to remove some extra software and install +Chrome. .. code-block:: bash @@ -67,9 +73,8 @@ Once in the shell, run these commands: dpkg -i /opt/deb/google-chrome-stable_current_amd64.deb - -Restrict domains -================ +Only one domain is allowed +-------------------------- To redirect all domains to localhost, except dev.automaticcrm.ai, create the file ``/etc/dnsmasq.d/autocrm.conf`` with these lines: @@ -77,7 +82,7 @@ file ``/etc/dnsmasq.d/autocrm.conf`` with these lines: .. code-block:: ini address=/#/127.0.0.1 - server=/dev.automaticcrm.ai/8.8.8.8 + server=/DOMAIN/8.8.8.8 Add this line to /etc/dnsmasq.conf @@ -85,9 +90,15 @@ Add this line to /etc/dnsmasq.conf conf-dir=/etc/dnsmasq.d +No usb memory functionality +--------------------------- -Run Chrome ONLY -=============== +.. code-block:: bash + + printf "nblacklist uas\nblacklist usb_storage\n" >> /etc/modprobe.d/blacklist.conf + +No apps except browser +---------------------- Override the path for all users. @@ -99,7 +110,7 @@ Chrome in fullscreen mode: [Desktop Entry] Name=Ubuntu Comment=This session logs you into Ubuntu - Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/google-chrome --kiosk https://dev.automaticcrm.ai + Exec=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/google-chrome --kiosk https://DOMAIN Type=Application DesktopNames=ubuntu:AutomaticCRM X-Ubuntu-Gettext-Domain=gnome-session-3.0 @@ -109,13 +120,11 @@ Chrome in fullscreen mode: If you want to change the domain, edit this file and also enable it in the dnsmqsq config above. -Remove USB drivers -================== - -.. code-block:: bash - - printf "\n#AutomaticCRM disabled modules\nblacklist uas\nblacklist usb_storage\n" >> /etc/modprobe.d/blacklist.conf +No access to the filesystem +--------------------------- +Chrome opens in kiosk mode right after login, so there's no access to anything +whatsoever. Create the ISO ============== @@ -145,6 +154,7 @@ Recreate installation files and pack the ISO. -boot-info-table \ -o automaticcrm-ubuntu-18.04.2.iso livecd/ + Test the installation in a vm ============================= diff --git a/source/blog/scaleway-restore-access.rst b/source/blog/scaleway-restore-access.rst new file mode 100644 index 0000000..e4d3604 --- /dev/null +++ b/source/blog/scaleway-restore-access.rst @@ -0,0 +1,33 @@ +.. post:: 2019.08.11 + :tags: howto,scaleway,hosting,password + :category: hosting + :author: vladan + :location: Belgrade + +=============================== +Reset lost password on Scaleway +=============================== + +`These are the supported boot options +`_ on +Scaleway, managed through instance tags. + +The [serial] console doesn't work with Firefox, so install Chromium. + +.. important:: + + Use bootscript for this, not local boot. + +Instances -> Select Your Instance -> Advanced Settings. + +Make sure only ``INITRD_POST_SHELL=1`` is present in tags. + +Reboot instance. You'll get a shell with the volume mounted in ``/newroot``. + +.. code-block:: bash + + chroot /newroot + passwd root + +Exit the chroot shell and the post initrd shell, the boot should continue to +the VM. diff --git a/source/conf.py b/source/conf.py index fa28ec0..3cf7e4d 100644 --- a/source/conf.py +++ b/source/conf.py @@ -16,9 +16,9 @@ # -- Project information ----------------------------------------------------- -project = 'dev notes' -copyright = 'No Rights Reserved' -author = 'Vladan Popovic' +copyright = "No Rights Reserved" +author = "Vladan Popovic" +project = author + "'s notes" # -- General configuration --------------------------------------------------- @@ -50,6 +50,7 @@ html_theme = 'sphinx_typlog_theme' import sphinx_typlog_theme html_theme_path = [sphinx_typlog_theme.get_path()] pygments_style = 'default' +html_title = project # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -63,13 +64,17 @@ html_sidebars = { 'localtoc.html', 'relations.html', 'searchbox.html', + 'sourcelink.html', 'atom.html', + 'recentposts.html', + 'categories.html', + 'archives.html', ] } # Blog (ablog) config blog_authors = { - 'vladan': ('Vladan Popovic', 'https://dev.vp.mk'), + 'vladan': ('Vladan Popovic', 'https://notes.vp.mk'), } blog_languages = { 'en': ('English', None), diff --git a/source/index.rst b/source/index.rst index e399a2b..48cd763 100644 --- a/source/index.rst +++ b/source/index.rst @@ -12,8 +12,8 @@ Recent posts .. postlist:: 5 :author: vladan - :date: %A, %B %d, %Y + :date: %A, %d.%m.%Y :format: {title} by {author} on {date} - :list-style: circle + :list-style: disk :excerpts: :sort: diff --git a/tox.ini b/tox.ini index c336556..2dcb2e8 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ deps = sphinx-typlog-theme ablog commands = - sphinx-autobuild -b html source/ build/html/ + sphinx-autobuild -E -b html source/ build/html/ [testenv:cv] whitelist_externals = /usr/bin/pandoc