Skip to content

Commit 702fe9e

Browse files
committed
feat: Add OPKSSH for OIDC integration
1 parent 2a669fa commit 702fe9e

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

‎README.rst‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@ Usage
99

1010
When you create an AWS Lightsail instance, cut & paste following lines to the
1111
"Launch script" field. It may take a while until Ansible completes its tasks. To
12-
monitor the progress, ``$ tail -f /var/log/cloud-init-output.log``. Ansible also
13-
creates a fresh disabled user with no login password. To enable it, ``$ sudo
14-
passwd <USER_NAME>`` and enter a new password for the user.
12+
monitor the progress, ``$ tail -f /var/log/cloud-init-output.log``.
13+
14+
As part of the setup, Ansible creates a fresh unprivileged user with no login
15+
password. It also installs the `OPKSSH`_ extension to enable authentication via
16+
Google SSO. For detailed usage and configuration, refer to the `OPKSSH`_
17+
documentation.
18+
1519

1620
.. code:: bash
1721
1822
export USER_NAME=guest
1923
export USER_GECOS="Guest Account"
2024
export USER_EMAIL=guest@morningrouti.ne
2125
curl -sL https://raw.githubusercontent.com/keisrk/morning_routine/main/bootstrap.sh | sh
26+
27+
28+
.. _OPKSSH: https://github.com/openpubkey/opkssh/

‎main.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
roles:
88
- utils
99
- user
10+
- opkssh
1011
- docker
1112
- terraform
1213
- golang
@@ -20,6 +21,7 @@
2021

2122
roles:
2223
- git
24+
- opkssh_user
2325
- rustup
2426
- jvm
2527
- gopath

‎roles/opkssh/tasks/main.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
# Install OPKSSH and configure sshd.
4+
5+
- name: Fetch installer script and store it in this.content
6+
uri:
7+
url: https://raw.githubusercontent.com/openpubkey/opkssh/main/scripts/install-linux.sh
8+
return_content: true
9+
register: this
10+
11+
- name: Execute installer script
12+
command:
13+
cmd: bash
14+
stdin: "{{ this.content }}"
15+
creates: /usr/local/bin/opkssh

‎roles/opkssh_user/tasks/main.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
- name: Create a directory if it does not exist
4+
file:
5+
path: "{{ ansible_env.HOME }}/.opk"
6+
state: directory
7+
mode: "0700"
8+
9+
- name: Place a locally scoped auth_id file
10+
lineinfile:
11+
dest: "{{ ansible_env.HOME }}/.opk/auth_id"
12+
line: "{{ user_name }} {{ user_email }} https://accounts.google.com"
13+
create: true
14+
mode: "0600"

0 commit comments

Comments
 (0)