Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
1166a5bc
Commit
1166a5bc
authored
8 years ago
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite ansible tasks using YAML syntax
parent
92acf889
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
36 deletions
+53
-36
playbooks/roles/security/tasks/main.yml
+1
-2
playbooks/roles/security/tasks/security-ubuntu.yml
+52
-34
No files found.
playbooks/roles/security/tasks/main.yml
View file @
1166a5bc
...
@@ -22,5 +22,4 @@
...
@@ -22,5 +22,4 @@
#
#
-
include
:
security-ubuntu.yml
-
include
:
security-ubuntu.yml
when
:
when
:
ansible_distribution == 'Ubuntu'
-
ansible_distribution == 'Ubuntu'
This diff is collapsed.
Click to expand it.
playbooks/roles/security/tasks/security-ubuntu.yml
View file @
1166a5bc
---
#### Enable periodic security updates
#### Enable periodic security updates
-
name
:
Install security packages
apt
:
name
:
"
{{
item
}}"
state
:
latest
update_cache
:
yes
with_items
:
"
{{
security_debian_pkgs
}}"
-
name
:
install security packages
apt
:
name={{ item }} state=latest update_cache=yes
with_items
:
security_debian_pkgs
-
name
:
Update all system packages
-
name
:
update all system packages
apt
:
apt
:
upgrade=
safe
upgrade
:
safe
when
:
SECURITY_UPGRADE_ON_ANSIBLE
when
:
SECURITY_UPGRADE_ON_ANSIBLE
-
name
:
configure periodic unattended-upgrades
-
name
:
Configure periodic unattended-upgrades
template
:
>
template
:
src=etc/apt/apt.conf.d/10periodic
src
:
"
etc/apt/apt.conf.d/10periodic"
dest=/etc/apt/apt.conf.d/10periodic
dest
:
"
/etc/apt/apt.conf.d/10periodic"
owner=root group=root mode=0644
owner
:
root
group
:
root
mode
:
"
0644"
when
:
SECURITY_UNATTENDED_UPGRADES
when
:
SECURITY_UNATTENDED_UPGRADES
-
name
:
disable unattended-upgrades
-
name
:
Disable unattended-upgrades
file
:
path=/etc/apt/apt.conf.d/10periodic state=absent
file
:
path
:
"
/etc/apt/apt.conf.d/10periodic"
state
:
absent
when
:
not SECURITY_UNATTENDED_UPGRADES
when
:
not SECURITY_UNATTENDED_UPGRADES
-
name
:
only unattended-upgrade from security repo
-
name
:
Only unattended-upgrade from security repo
template
:
>
template
:
src=etc/apt/apt.conf.d/20unattended-upgrade
src
:
"
etc/apt/apt.conf.d/20unattended-upgrade"
dest=/etc/apt/apt.conf.d/20unattended-upgrade
dest
:
"
/etc/apt/apt.conf.d/20unattended-upgrade"
owner=root group=root mode=0644
owner
:
root
group
:
root
mode
:
"
0644"
when
:
SECURITY_UNATTENDED_UPGRADES and not SECURITY_UPDATE_ALL_PACKAGES
when
:
SECURITY_UNATTENDED_UPGRADES and not SECURITY_UPDATE_ALL_PACKAGES
-
name
:
disable security only updates on unattended-upgrades
-
name
:
Disable security only updates on unattended-upgrades
file
:
path=/etc/apt/apt.conf.d/20unattended-upgrade state=absent
file
:
path
:
"
/etc/apt/apt.conf.d/20unattended-upgrade"
state
:
absent
when
:
SECURITY_UPDATE_ALL_PACKAGES or not SECURITY_UNATTENDED_UPGRADES
when
:
SECURITY_UPDATE_ALL_PACKAGES or not SECURITY_UNATTENDED_UPGRADES
#### Bash security vulnerability
#### Bash security vulnerability
-
name
:
Check if we are vulnerable
-
name
:
Check if we are vulnerable
shell
:
executable=/bin/bash chdir=/tmp foo='() { echo vulnerable; }' bash -c foo
shell
:
"
executable=/bin/bash
chdir=/tmp
foo='()
{
echo
vulnerable;
}'
bash
-c
foo"
register
:
test_vuln
register
:
test_vuln
ignore_errors
:
yes
ignore_errors
:
yes
-
name
:
Apply bash security update if we are vulnerable
-
name
:
Apply bash security update if we are vulnerable
apt
:
name=bash state=latest update_cache=true
apt
:
name
:
bash
state
:
latest
update_cache
:
yes
when
:
"
'vulnerable'
in
test_vuln.stdout"
when
:
"
'vulnerable'
in
test_vuln.stdout"
-
name
:
Check again and fail if we are still vulnerable
-
name
:
Check again and fail if we are still vulnerable
shell
:
executable=/bin/bash foo='() { echo vulnerable; }' bash -c foo
shell
:
"
executable=/bin/bash
foo='()
{
echo
vulnerable;
}'
bash
-c
foo"
when
:
"
'vulnerable'
in
test_vuln.stdout"
when
:
"
'vulnerable'
in
test_vuln.stdout"
register
:
test_vuln
register
:
test_vuln
failed_when
:
"
'vulnerable'
in
test_vuln.stdout"
failed_when
:
"
'vulnerable'
in
test_vuln.stdout"
...
@@ -52,20 +66,23 @@
...
@@ -52,20 +66,23 @@
#### GHOST security vulnerability
#### GHOST security vulnerability
-
name
:
GHOST.c
-
name
:
GHOST.c
copy
:
>
copy
:
src=tmp/GHOST.c
src
:
"
tmp/GHOST.c"
dest=/tmp/GHOST.c
dest
:
"
/tmp/GHOST.c"
owner=root group=root
owner
:
root
group
:
root
-
name
:
c
ompile GHOST
-
name
:
C
ompile GHOST
shell
:
gcc -o /tmp/GHOST /tmp/GHOST.c
shell
:
"
gcc
-o
/tmp/GHOST
/tmp/GHOST.c"
-
name
:
Check if we are vulnerable
-
name
:
Check if we are vulnerable
shell
:
/tmp/GHOST
shell
:
"
/tmp/GHOST"
register
:
test_ghost_vuln
register
:
test_ghost_vuln
ignore_errors
:
yes
ignore_errors
:
yes
-
name
:
Apply glibc security update if we are vulnerable
-
name
:
Apply glibc security update if we are vulnerable
apt
:
name=libc6 state=latest update_cache=true
apt
:
when
:
"
'vulnerable'
in
test_ghost_vuln.stdout"
name
:
libc6
state
:
latest
update_cache
:
yes
when
:
"
'vulnerable'
in
test_ghost_vuln.stdout"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment