|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + "description lang=en": "Deploy authd at scale with cloud-init." |
| 5 | +--- |
| 6 | + |
| 7 | +# Reference snippets for cloud-init provisioning |
| 8 | + |
| 9 | +[Cloud-init](https://cloudinit.readthedocs.io/en/latest/) is an |
| 10 | +industry-standard method for cloud instance initialization. It can also be used |
| 11 | +to provision client machines during Ubuntu installation. |
| 12 | + |
| 13 | +This page provides example snippets, which can be used in your own cloud config |
| 14 | +YAML files to deploy and configure authd on Ubuntu at scale. |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +Define the necessary environmental variables: |
| 19 | + |
| 20 | +```text |
| 21 | +{% set ISSUER_ID = '<your_issuer_id>' %} |
| 22 | +{% set CLIENT_ID = '<your_client_id>' %} |
| 23 | +``` |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +Ensure packages are updated: |
| 28 | + |
| 29 | +```yaml |
| 30 | +package_update: true |
| 31 | +package_upgrade: true |
| 32 | +``` |
| 33 | +
|
| 34 | +Install the authd deb: |
| 35 | +
|
| 36 | +```yaml |
| 37 | +apt: |
| 38 | + sources: |
| 39 | + source1: |
| 40 | + source: 'ppa:ubuntu-enterprise-desktop/authd' |
| 41 | + |
| 42 | +packages: |
| 43 | + - authd |
| 44 | + - gnome-shell # only needed for GDM login |
| 45 | + - yaru-theme-gnome-shell # only needed for GDM login |
| 46 | +``` |
| 47 | +
|
| 48 | +Then install the broker: |
| 49 | +
|
| 50 | +
|
| 51 | +:::::{tab-set} |
| 52 | +:sync-group: broker |
| 53 | +
|
| 54 | +::::{tab-item} Google IAM |
| 55 | +:sync: google |
| 56 | +
|
| 57 | +```yaml |
| 58 | +snap: |
| 59 | + commands: |
| 60 | + - ['install', 'authd-google'] |
| 61 | +``` |
| 62 | +
|
| 63 | +:::: |
| 64 | +
|
| 65 | +::::{tab-item} Microsoft Entra ID |
| 66 | +:sync: msentraid |
| 67 | +
|
| 68 | +```yaml |
| 69 | +snap: |
| 70 | + commands: |
| 71 | + - ['install', 'authd-msentraid'] |
| 72 | +``` |
| 73 | +
|
| 74 | +:::: |
| 75 | +::::: |
| 76 | +
|
| 77 | +
|
| 78 | +```{tip} |
| 79 | +For more information on installing authd and its brokers, read the |
| 80 | +[installation guide](howto::install). |
| 81 | +``` |
| 82 | + |
| 83 | +## Configuration |
| 84 | + |
| 85 | +Configure authd and the broker, ensuring that you edit the allowed suffixes, |
| 86 | +and restart the services for the changes to take effect. |
| 87 | + |
| 88 | +:::::{tab-set} |
| 89 | +:sync-group: broker |
| 90 | + |
| 91 | +::::{tab-item} Google IAM |
| 92 | +:sync: google |
| 93 | + |
| 94 | +```yaml |
| 95 | +write_files: |
| 96 | + - path: /etc/ssh/sshd_config.d/authd.conf |
| 97 | + content: | |
| 98 | + UsePAM yes |
| 99 | + KbdInteractiveAuthentication yes |
| 100 | +
|
| 101 | +runcmd: |
| 102 | + - sed -i 's|<CLIENT_ID>|{{ CLIENT_ID }}|g; s|<ISSUER_ID>|{{ ISSUER_ID }}|g' /var/snap/authd-google/current/broker.conf |
| 103 | + - echo 'ssh_allowed_suffixes = @test.google.com' >> /var/snap/authd-google/current/broker.conf |
| 104 | + - sed -i 's/^\(LOGIN_TIMEOUT\t\t\)[0-9]\+/\1360/' /etc/login.defs |
| 105 | + - mkdir -p /etc/authd/brokers.d/ |
| 106 | + - cp /snap/authd-google/current/conf/authd/google.conf /etc/authd/brokers.d/ |
| 107 | + - snap restart authd-google |
| 108 | + - systemctl restart authd |
| 109 | + - snap restart authd-google |
| 110 | + - systemctl restart ssh |
| 111 | +``` |
| 112 | +
|
| 113 | +:::: |
| 114 | +
|
| 115 | +::::{tab-item} Microsoft Entra ID |
| 116 | +:sync: msentraid |
| 117 | +
|
| 118 | +
|
| 119 | +```yaml |
| 120 | +write_files: |
| 121 | + - path: /etc/ssh/sshd_config.d/authd.conf |
| 122 | + content: | |
| 123 | + UsePAM yes |
| 124 | + KbdInteractiveAuthentication yes |
| 125 | +
|
| 126 | +runcmd: |
| 127 | + - sed -i 's|<CLIENT_ID>|{{ CLIENT_ID }}|g; s|<ISSUER_ID>|{{ ISSUER_ID }}|g' /var/snap/authd-msentraid/current/broker.conf |
| 128 | + - echo 'ssh_allowed_suffixes = @test.onmicrosoft.com' >> /var/snap/authd-msentraid/current/broker.conf |
| 129 | + - sed -i 's/^\(LOGIN_TIMEOUT\t\t\)[0-9]\+/\1360/' /etc/login.defs |
| 130 | + - mkdir -p /etc/authd/brokers.d/ |
| 131 | + - cp /snap/authd-msentraid/current/conf/authd/msentraid.conf /etc/authd/brokers.d/ |
| 132 | + - snap restart authd-msentraid |
| 133 | + - systemctl restart authd |
| 134 | + - snap restart authd-msentraid |
| 135 | + - systemctl restart ssh |
| 136 | +``` |
| 137 | +
|
| 138 | +:::: |
| 139 | +
|
| 140 | +::::: |
| 141 | +
|
| 142 | +
|
| 143 | +```{tip} |
| 144 | +For more information on configuring authd, read the [configuration |
| 145 | +guide](ref::config). |
| 146 | +``` |
| 147 | + |
| 148 | +## Authentication |
| 149 | + |
| 150 | +Once the script is deployed, user login should be possible with authd. |
| 151 | + |
| 152 | +For example, [using SSH](../howto/login-ssh.md): |
| 153 | + |
| 154 | +```text |
| 155 | +ssh <username>@<host> |
| 156 | +``` |
| 157 | + |
| 158 | +## Additional information |
| 159 | + |
| 160 | +* [Blog on Entra ID authentication on Ubuntu at scale](https://ubuntu.com/blog/entra-id-authentication-on-ubuntu-at-scale-with-landscape) |
| 161 | +* [Video on Entra ID authentication on Ubuntu Desktop at scale](https://www.youtube.com/watch?v=1tYNEby5-hw) |
0 commit comments