{"id":97272,"date":"2019-07-26T08:00:21","date_gmt":"2019-07-26T08:00:21","guid":{"rendered":"https:\/\/fedoramagazine.org\/?p=28543"},"modified":"2019-07-26T08:00:21","modified_gmt":"2019-07-26T08:00:21","slug":"manage-your-passwords-with-bitwarden-and-podman","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2019\/07\/26\/manage-your-passwords-with-bitwarden-and-podman\/","title":{"rendered":"Manage your passwords with Bitwarden and Podman"},"content":{"rendered":"<p>You might have encountered a few advertisements the past year trying to sell you a password manager. Some examples are <a href=\"https:\/\/www.lastpass.com\">LastPass<\/a>, <a href=\"https:\/\/1password.com\/\">1Password<\/a>, or <a href=\"https:\/\/www.dashlane.com\/\">Dashlane<\/a>. A password manager removes the burden of remembering the passwords for all your websites. No longer do you need to re-use passwords or use easy-to-remember passwords. Instead, you only need to remember one single password that can unlock all your other passwords for you.<\/p>\n<p>This can make you more secure by having one strong password instead of many weak passwords. You can also sync your passwords across devices if you have a cloud-based password manager like LastPass, 1Password, or Dashlane. Unfortunately, none of these products are open source. Luckily there are open source alternatives available.<\/p>\n<p> <span id=\"more-28543\"><\/span> <\/p>\n<h2>Open source password managers<\/h2>\n<p>These alternatives include Bitwarden, <a href=\"https:\/\/lesspass.com\/\">LessPass<\/a>, or <a href=\"https:\/\/keepass.info\/\">KeePass<\/a>. Bitwarden is <a href=\"https:\/\/bitwarden.com\/\">an open source password manager<\/a> that stores all your passwords encrypted on the server, which works the same way as LastPass, 1Password, or Dashlane. LessPass is a bit different as it focuses on being a stateless password manager. This means it derives passwords based on a master password, the website, and your username rather than storing the passwords encrypted. On the other side of the spectrum there&#8217;s KeePass, a file-based password manager with a lot of flexibility with its plugins and applications. <\/p>\n<p>Each of these three apps has its own downsides. Bitwarden stores everything in one place and is exposed to the web through its API and website interface. LessPass can&#8217;t store custom passwords since it&#8217;s stateless, so you need to use their derived passwords. KeePass, a file-based password manager, can&#8217;t easily sync between devices. You can utilize a cloud-storage provider together with <a href=\"https:\/\/en.wikipedia.org\/wiki\/WebDAV\">WebDAV<\/a> to get around this, but a lot of clients do not support it and you might get file conflicts if devices do not sync correctly.<\/p>\n<p>This article focuses on Bitwarden. <\/p>\n<h2>Running an unofficial Bitwarden implementation<\/h2>\n<p>There is a community implementation of the server and its API called <a href=\"https:\/\/github.com\/dani-garcia\/bitwarden_rs\/\">bitwarden_rs<\/a>. This implementation is fully open source as it can use SQLite or MariaDB\/MySQL, instead of the proprietary Microsoft SQL Server that the official server uses.<\/p>\n<p>It&#8217;s important to recognize some differences exist between the official and the unofficial version. For instance, the <a href=\"https:\/\/blog.bitwarden.com\/bitwarden-completes-third-party-security-audit-c1cc81b6d33\">official server has been audited by a third-party<\/a>, whereas the unofficial one hasn&#8217;t. When it comes to implementations, the unofficial version lacks <a href=\"https:\/\/github.com\/dani-garcia\/bitwarden_rs\/wiki#missing-features\">email confirmation and support for two-factor authentication using Duo or email codes<\/a>. <\/p>\n<p>Let&#8217;s get started running the server with SELinux in mind. Following the documentation for bitwarden_rs you can construct a Podman command as follows:<\/p>\n<pre class=\"wp-block-preformatted\">$ podman run -d \\ <br \/> --userns=keep-id \\<br \/> --name bitwarden \\<br \/> -e SIGNUPS_ALLOWED=false \\<br \/> -e ROCKET_PORT=8080 \\<br \/> -v \/home\/egustavs\/Bitwarden\/bw-data\/:\/data\/:Z \\<br \/> -p 8080:8080 \\<br \/> bitwardenrs\/server:latest<\/pre>\n<p>This downloads the bitwarden_rs image and runs it in a user container under the user&#8217;s namespace. It uses a port above 1024 so that non-root users can bind to it. It also changes the volume&#8217;s SELinux context with <em>:Z<\/em> to prevent permission issues with read-write on <em>\/data<\/em>.<\/p>\n<p>If you host this under a domain, it&#8217;s recommended to put this server under a reverse proxy with Apache or Nginx. That way you can use port 80 and 443 which points to the container&#8217;s 8080 port without running the container as root.<\/p>\n<h2>Running under systemd<\/h2>\n<p>With Bitwarden now running, you probably want to keep it that way. Next, create a unit file that keeps the container running, automatically restarts if it doesn&#8217;t respond, and starts running after a system restart. Create this file as <em>\/etc\/systemd\/system\/bitwarden.service<\/em>:<\/p>\n<pre class=\"wp-block-preformatted\">[Unit]<br \/>Description=Bitwarden Podman container<br \/>Wants=syslog.service<br \/><br \/>[Service]<br \/>User=egustavs<br \/>Group=egustavs<br \/>TimeoutStartSec=0<br \/>ExecStart=\/usr\/bin\/podman run 'bitwarden'<br \/>ExecStop=-\/usr\/bin\/podman stop -t 10 'bitwarden'<br \/>Restart=always<br \/>RestartSec=30s<br \/>KillMode=none<br \/><br \/>[Install]<br \/>WantedBy=multi-user.target<\/pre>\n<p>Now, enable and start it <a href=\"https:\/\/fedoramagazine.org\/howto-use-sudo\/\">using <\/a><em><a href=\"https:\/\/fedoramagazine.org\/howto-use-sudo\/\">sudo<\/a><\/em>:<\/p>\n<pre class=\"wp-block-preformatted\">$ <strong>sudo systemctl enable bitwarden.service &amp;&amp; sudo systemctl start bitwarden.service<\/strong><br \/>$ <strong>systemctl status bitwarden.service<\/strong><br \/>bitwarden.service - Bitwarden Podman container<br \/> Loaded: loaded (\/etc\/systemd\/system\/bitwarden.service; enabled; vendor preset: disabled)<br \/> Active: active (running) since Tue 2019-07-09 20:23:16 UTC; 1 day 14h ago<br \/> Main PID: 14861 (podman)<br \/> Tasks: 44 (limit: 4696)<br \/> Memory: 463.4M<\/pre>\n<p>Success! Bitwarden is now running under system and will keep running.<\/p>\n<h2>Adding LetsEncrypt<\/h2>\n<p>It&#8217;s strongly recommended to run your Bitwarden instance through an encrypted channel with something like LetsEncrypt if you have a domain. Certbot is a bot that creates LetsEncrypt certificates for us, and they have a <a href=\"https:\/\/certbot.eff.org\/instructions\">guide for doing this through Fedora<\/a>.<\/p>\n<p>After you generate a certificate, you can follow the <a href=\"https:\/\/github.com\/dani-garcia\/bitwarden_rs\/wiki\/Enabling-HTTPS\">bitwarden_rs guide about HTTPS<\/a>. Just remember to append <em>:Z<\/em> to the LetsEncrypt volume to handle permissions while not changing the port.<\/p>\n<hr class=\"wp-block-separator\" \/>\n<p><em>Photo by&nbsp;<\/em><a href=\"https:\/\/unsplash.com\/@cmdrshane?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\"><em>CMDR Shane<\/em><\/a><em>&nbsp;on&nbsp;<\/em><a href=\"https:\/\/unsplash.com\/search\/photos\/password?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\"><em>Unsplash<\/em><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might have encountered a few advertisements the past year trying to sell you a password manager. Some examples are LastPass, 1Password, or Dashlane. A password manager removes the burden of remembering the passwords for all your websites. No longer do you need to re-use passwords or use easy-to-remember passwords. Instead, you only need to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[630,319,631,107,632,539,45,633,46,309,47,456,634,540,609,52,44,635],"class_list":["post-97272","post","type-post","status-publish","format-standard","hentry","category-fedora-os","tag-1password","tag-alternative","tag-bitwarden","tag-containers","tag-dashlane","tag-docker","tag-fedora","tag-lastpass","tag-magazine","tag-memory","tag-news","tag-open-source","tag-passwords","tag-podman","tag-secure","tag-security","tag-using-software","tag-vault"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/97272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=97272"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/97272\/revisions"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=97272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=97272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=97272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}