1Password: Difference between revisions

m add summary of program to top of page
Jopejoe1 (talk | contribs)
Format an clean up the nix code
 
(9 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[https://1password.com/ 1Password] is a password manager.
[https://1password.com/ 1Password] is a password manager.


= Using 1Password on NixOS =
== NixOS ==
If you're using NixOS, you can enable 1Password and its GUI by:
 
=== Installation ===
 
If you're using [[NixOS]], you can enable 1Password and its GUI with:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{ config, lib, pkgs, ... }:
{
  lib,
  ...
}:
 
{
{
   # Enable the unfree 1Password packages
   # Enable the unfree 1Password packages
   nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
   nixpkgs.config.allowUnfreePredicate =
    "1password-gui"
    pkg:
    "1password"
    builtins.elem (lib.getName pkg) [
  ];
      "1password-cli"
      "1password-gui"
      "1password"
    ];
   # Alternatively, you could also just allow all unfree packages
   # Alternatively, you could also just allow all unfree packages
   # nixpkgs.config.allowUnfree = true;
   # nixpkgs.config.allowUnfree = true;
Line 21: Line 31:
     polkitPolicyOwners = [ "yourUsernameHere" ];
     polkitPolicyOwners = [ "yourUsernameHere" ];
   };
   };
  ...
}
}
</nowiki>}}
</nowiki>}}
Line 27: Line 36:




== Unlocking Browser Extensions ==
=== Unlocking browser extensions ===


{{warning|1=This only works for browsers that are installed via NixOS -- Browsers installed via flatpak are not supported}}
{{warning|1=This only works for browsers that are installed via [[NixOS]]. Browsers installed via [[Flatpak]] are not supported.}}


The 1Password app can unlock your browser extension using a special NativeMessaging process.  This streamlines your 1Password experience: Once you unlock 1Password from your tray icon, your browser extensions will be unlocked as well.   
The 1Password app can unlock your browser extension using a special [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging native messaging] process.  This streamlines your 1Password experience: Once you unlock 1Password from your tray icon, your browser extensions will be unlocked as well.   


This is automatically configured for Firefox, Chrome, and Brave browsers.  However, Vivaldi and other custom Chrome-based browsers may not unlock when you unlock 1Password.  If you find this to be the case, the solution is to set the  <code>/etc/1password/custom_allowed_browsers</code> file as follows:
This is automatically configured for [[Firefox]], [[Chrome]], and [[Brave]] browsers.  However, [[Vivaldi]] and other custom Chrome-based browsers may not unlock when you unlock 1Password.  If you find this to be the case, the solution is to set the  <code>/etc/1password/custom_allowed_browsers</code> file as follows:


* First, use <code>ps aux</code> to find the application name for the browser.  For Vivaldi, this is <code>vivaldi-bin</code>
* First, use <code>ps aux</code> to find the application name for the browser.  For Vivaldi, this is <code>vivaldi-bin</code>
* Add that binary name to <code>/etc/1password/custom_allowed_browsers</code>  
* Add that binary name to <code>/etc/1password/custom_allowed_browsers</code>:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
    environment.etc = {
{
      "1password/custom_allowed_browsers" = {
  environment.etc = {
        text = ''
    "1password/custom_allowed_browsers" = {
          vivaldi-bin
      text = ''
          wavebox
        vivaldi-bin
        '';
        wavebox
        mode = "0755";
      '';
      };
      mode = "0755";
     };
     };
  };
}
</syntaxhighlight>
</syntaxhighlight>


=== Unlocking with System Authentication ===


== 1Password, SSH keys and Home Manager ==
1Password allows [https://support.1password.com/system-authentication-linux/ unlocking with system authentication]. This means fingerprints or login passwords may be used in addition to the master password. This must be enabled under the Security preferences tab of 1Password as outlined in the 1Password documentation, but also requires a few other system tools to work.


If 1Password manages your SSH keys and you use [https://nix-community.github.io/home-manager/index.xhtml Home Manager], you may also configure your <code>~/.ssh/config</code> file using Nix:
For the graphical authentication prompt to work, a user [[Polkit#Authentication_agents|Polkit authentication agent]] must be started. The authentication agent may automatically be started under Gnome, KDE, or other DE at login, but may need to be explicitly enabled for other window managers.
 
For fingerprint unlocking to work, [[Fingerprint scanner|fingerprint scanning]] to be enabled and allowed for typical system authentication.
 
== Home Manager ==
 
{{warning|1=Non-[[NixOS]] installs [https://www.1password.community/discussions/1password/sandboxed-application-cant-communicate-with-browser-extension/91984/replies/92015 will not link with browser extensions or system authentication] }}
 
=== Installation ===
 
Add the following to your [[Home Manager]] configuration:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
_: let
{
   # onePassPath = "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock";
  pkgs,
  onePassPath = "~/.1password/agent.sock";
  ...
in {
}:
 
{
  home.packages = [
    pkgs._1password
    pkgs._1password-gui
  ];
}
</syntaxhighlight>
 
=== SSH key management ===
 
1Password [https://developer.1password.com/docs/ssh/ can manage SSH keys].
 
==== Configuring SSH ====
 
If 1Password manages your [[SSH]] keys and you use [[Home Manager]], you may also configure your <code>~/.ssh/config</code> file using Nix:
 
{{note|In order to start the 1Password SSH agent, you must open the 1Password settings, go to the Developer section and check the checkbox "Use the SSH agent".}}
 
<syntaxhighlight lang="nix">
{
  config,
  pkgs,
  ...
}:
 
let
   onePassPath =
    if pkgs.stdenv.isDarwin then
      "${config.home.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
    else
      "${config.home.homeDirectory}/.1password/agent.sock";
in
{
  home.sessionVariables.SSH_AUTH_SOCK = onePassPath;
 
  # or, alternatively, set it in `.ssh/config` which has higher precedence:
   programs.ssh = {
   programs.ssh = {
     enable = true;
     enable = true;
Line 70: Line 129:
</syntaxhighlight>
</syntaxhighlight>


== 1Password with Git Ssh Signing ==  
==== Configuring Git ====


You can enable git ssh singing with [https://nix-community.github.io/home-manager/index.xhtml Home Manager]:
You can enable [[Git]]'s [[SSH]] signing with [[Home Manager]]:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{
  lib,
  pkgs,
  ...
}:
{
{
   programs.git = {
   programs.git = {
Line 97: Line 161:
</syntaxhighlight>
</syntaxhighlight>


= On non-NixOS installs =
{{warning|1=non-NixOS installs [https://1password.community/discussion/comment/655813/#Comment_655813 will not link with browser extensions or system authentication] }}
Home Manager
<syntaxhighlight lang="nix">
  home.packages = [
    pkgs._1password
    pkgs._1password-gui
  ];
</syntaxhighlight>


[[Category:Software]]
[[Category:Applications]]