Skip to content

Commit 44930e6

Browse files
authored
Support ssh keys authorization to nodes (#41)
* Add ssh keys fingerprints to cEdge bootstrap configuration * Add ssh public keys to control nodes * Update README
1 parent 1c83878 commit 44930e6

File tree

16 files changed

+66
-0
lines changed

16 files changed

+66
-0
lines changed

roles/aws_controllers/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The following variables must be set prior to executing the role:
5757
- `az_subnets`: A list of subnet definitions for the Azure Virtual Network.
5858
- `admin_username`: Administrator username for the SD-WAN controller instances.
5959
- `admin_password`: Administrator password for the SD-WAN controller instances.
60+
- `admin_ssh_keys`: List of SSH public keys authorized for admin login.
6061

6162
## Example Playbook
6263

roles/aws_controllers/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ aws_resources_prefix: "{{ organization_name }}"
2727
# Cloud-init general configurations
2828
admin_username: admin
2929
admin_password: null # pragma: allowlist secret
30+
admin_ssh_keys: []
3031
vbond_port: 12346
3132
default_vbond_ip: 192.168.1.199 # default ips from official Cisco guides
3233
# vpn0_interface_color: default

roles/aws_controllers/templates/userdata_vbond.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,11 @@ write_files:
7878
</vpn-instance>
7979
</vpn>
8080
</config>
81+
{% if admin_ssh_keys %}
82+
- path: /home/admin/.ssh/authorized_keys
83+
content: |
84+
{% for k in admin_ssh_keys %}
85+
{{ k }}
86+
{% endfor %}
87+
{% endif %}
8188
--===============8815267485200512281==

roles/aws_controllers/templates/userdata_vmanage.j2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ write_files:
9898
</vpn>
9999
</config>
100100

101+
{% if admin_ssh_keys %}
102+
- path: /home/admin/.ssh/authorized_keys
103+
content: |
104+
{% for k in admin_ssh_keys %}
105+
{{ k }}
106+
{% endfor %}
107+
{% endif %}
108+
101109
{% if vmanage_cluster_private_ip is defined %}
102110
- path: /home/admin/customized.cfg
103111
content: |

roles/aws_controllers/templates/userdata_vsmart.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,11 @@ write_files:
7676
</vpn-instance>
7777
</vpn>
7878
</config>
79+
{% if admin_ssh_keys %}
80+
- path: /home/admin/.ssh/authorized_keys
81+
content: |
82+
{% for k in admin_ssh_keys %}
83+
{{ k }}
84+
{% endfor %}
85+
{% endif %}
7986
--===============8815267485200512281==

roles/aws_edges/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The following variables must be set prior to executing the role:
5454
- `aws_region`: AWS region to host the resources.
5555
- `aws_availibility_zone`: Specific AWS availability zone within the selected region.
5656
- `admin_password`: Password for administrative access to controller instances.
57+
- `admin_ssh_keys`: List of SSH public keys authorized for admin login.
5758
- `aws_vpc_config`: Configuration details for the AWS VPC.
5859
- `aws_security_group_config`: Settings for the AWS security group.
5960
- `aws_subnets_config`: Specifications for the AWS subnets.

roles/aws_edges/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ aws_resources_prefix: "{{ organization_name }}"
2727
# Cloud-init general configurations
2828
admin_username: admin
2929
admin_password: null # pragma: allowlist secret
30+
admin_ssh_keys: []
3031
vbond_port: 12346
3132
default_vbond_ip: 192.168.1.199 # default ips from official Cisco guides
3233
# vpn0_interface_color: default

roles/aws_edges/templates/bootstrap_cedge.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ Content-Disposition: attachment; filename="config-{{ uuid }}.txt"
171171
ip bootp server
172172
no ip source-route
173173
no ip ssh bulk-mode
174+
{% if admin_ssh_keys %}
175+
ip ssh pubkey-chain
176+
username admin
177+
{% for k in admin_ssh_keys %}
178+
key-hash ssh-rsa {{ k.split()[1] | ansible.builtin.b64decode | ansible.builtin.md5 | upper }}
179+
{% endfor %}
180+
{% endif %}
174181
no ip http server
175182
no ip http secure-server
176183
no ip http ctc authentication

roles/azure_controllers/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The `azure_controllers` role automates the deployment of Cisco SD-WAN controller
6262
- `az_subnets`: Definitions of Azure subnets within the Virtual Network.
6363
- `admin_username`: Admin username for the deployed VMs.
6464
- `admin_password`: Admin password for the deployed VMs.
65+
- `admin_ssh_keys`: List of SSH public keys authorized for admin login.
6566

6667
## Example Playbook
6768

roles/azure_controllers/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ az_allowed_subnets: null
6060
# Cloud-init general configurations
6161
admin_username: admin
6262
admin_password: null # pragma: allowlist secret
63+
admin_ssh_keys: []
6364
vbond_port: 12346
6465
default_vbond_ip: 192.168.1.199
6566
# vpn0_interface_color: default

0 commit comments

Comments
 (0)