2FAuth

2FAuth is a web based self-hosted alternative to One Time Passcode (OTP) generators like Google Authenticator, designed for both mobile and desktop.

Not yet tested security Based on TrueNAS app v1.3.16 (2FAuth 8.0.2)
  1. 1
    Copy the script below
  2. 2
    In HexOS, open Apps, find 2FAuth and choose Custom Install
  3. 3
    Paste, then press Install — full guide with screenshots
twofactor-auth.json
Download
1{
12  "version": 5,
23  "script": {
4    "version": "0.1.0",
5    "changeLog": "Auto-generated draft from TrueNAS twofactor-auth 1.3.16"
6  },
37  "installation_questions": [
8    {
9      "question": "Site owner email",
10      "type": "text",
11      "key": "site_owner_email",
12      "required": true
13    }
14  ],
15  "requirements": {
416    "locations": ["ApplicationsPerformance"],
517    "specifications": ["2CORE"],
618    "permissions": ["READ_WRITE_LOCATIONS"],
719    "ports": [30081]
20  },
821  "ensure_directories_exists": [
22    {"path": "$LOCATION(ApplicationsPerformance)"},
23    {"path": "$LOCATION(ApplicationsPerformance)/twofactor-auth"},
24    {
25      "path": "$LOCATION(ApplicationsPerformance)/twofactor-auth/config",
26      "snapshot": {"id": "config"}
27    }
28  ],
29  "app_values": {
30    "twofactor_auth": {
931      "app_key": "$RANDOM_STRING(32)",
1032      "app_url": "http://$SERVER_LAN_IP:30081",
1133      "site_owner_email": "$QUESTION(site_owner_email)"
34    },
35    "storage": {
1236      "config": "$HOST_PATH($LOCATION(ApplicationsPerformance)/twofactor-auth/config)"
37    },
38    "network": {
1339      "web_port": {"bind_mode": "published", "port_number": 30081}
40    },
1441    "resources": {"limits": {"cpus": 2, "memory": "$MEMORY(10%, 4096)"}}
42  }
43}

What this script does

Hover or tap a box to see the lines it explains.

  1. Script format

    Tells HexOS this is a version 5 install script, so it knows how to read the rest.

    Line 2

  2. Script revision

    This copy of the script is revision 0.1.0. Latest change: “Auto-generated draft from TrueNAS twofactor-auth 1.3.16”.

    Lines 3–6

  3. Questions you'll be asked

    Before installing, HexOS will ask you for: Site owner email. Your answers are slotted into the settings further down wherever you see $QUESTION(...).

    Lines 7–14

  4. Storage locations it needs

    The app uses these HexOS storage locations: App storage (fast). If one isn't set up yet, HexOS will ask you to pick a place for it.

    Line 16

  5. Minimum hardware

    Recommended minimum: 2 CPU cores.

    Line 17

  6. Permission to use your folders

    Allows the app to read and write files inside the storage locations listed above — and nowhere else.

    Line 18

  7. Network ports

    The app needs port 30081 to be free on your server. A port is like an apartment number for your server's address.

    Line 19

  8. Folders created on install

    Creates the folders the app needs before it starts: App storage (fast) › twofactor-auth and App storage (fast) › twofactor-auth › config. Folders marked “snapshot” are included in HexOS snapshots, so you can roll them back.

    Lines 21–28

  9. Auto-generated app key

    HexOS makes up a long random app key during install. It's only used inside 2FAuth, so you never need to know it.

    Line 31

  10. Your server's address (app url)

    Automatically set to your server's address on your home network (http://your-server-ip:30081).

    Line 32

  11. Your answer: site owner email

    Filled in with what you typed for “site owner email” when you installed.

    Line 33

  12. Where the app's settings is saved

    Where the app's settings is saved on your server: App storage (fast) › twofactor-auth › config.

    Line 36

  13. Web port: 30081

    The app's web page is published on port 30081. You don't need to remember it — clicking the app's card in HexOS takes you there.

    Line 39

  14. Resource limits

    Caps how much of your server the app can use: 2 CPU cores and 10% of your server's memory, but never more than 4 GB. This keeps one busy app from slowing everything else down.

    Line 41