Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ansible-public
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
system
ansible-public
Commits
960b6b87
Commit
960b6b87
authored
2 years ago
by
Baptiste DE RENZO
Browse files
Options
Downloads
Patches
Plain Diff
Verify root ssh authorized key file before permitrootlogin modification, Refs
#37430
parent
552f577d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/sysconfig/tasks/main.yml
+12
-1
12 additions, 1 deletion
roles/sysconfig/tasks/main.yml
with
12 additions
and
1 deletion
roles/sysconfig/tasks/main.yml
+
12
−
1
View file @
960b6b87
...
...
@@ -96,7 +96,18 @@
backup
:
true
notify
:
restart unattended-upgrades
-
name
:
enable root login via ssh with key
-
name
:
verify root user ssh authorized key file
ansible.builtin.stat
:
path
:
/root/.ssh/authorized_keys
register
:
auth
-
name
:
fail if the root ssh authorized key is missing or empty
ansible.builtin.fail
:
msg
:
"
Error:
root
user
does
not
have
any
ssh
key
configured
!
\n\
Cannot
configure
PermitRootLogin
to
without-password"
when
:
not auth.stat.exists or auth.stat.size ==
0
-
name
:
enable root login via ssh with key only
ansible.builtin.replace
:
dest
:
/etc/ssh/sshd_config
regexp
:
^#?PermitRootLogin.*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment