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
edx
configuration
Commits
f393fe8e
Commit
f393fe8e
authored
Jun 28, 2016
by
Arbab Nazar
Committed by
GitHub
Jun 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3155 from edx/arbab/security-rewrite
rewrite ansible tasks using YAML syntax
parents
82329823
1166a5bc
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 @
f393fe8e
...
...
@@ -22,5 +22,4 @@
#
-
include
:
security-ubuntu.yml
when
:
-
ansible_distribution == 'Ubuntu'
when
:
ansible_distribution == 'Ubuntu'
playbooks/roles/security/tasks/security-ubuntu.yml
View file @
f393fe8e
---
#### 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
apt
:
upgrade=
safe
-
name
:
Update all system packages
apt
:
upgrade
:
safe
when
:
SECURITY_UPGRADE_ON_ANSIBLE
-
name
:
configure periodic unattended-upgrades
template
:
>
src=etc/apt/apt.conf.d/10periodic
dest=/etc/apt/apt.conf.d/10periodic
owner=root group=root mode=0644
-
name
:
Configure periodic unattended-upgrades
template
:
src
:
"
etc/apt/apt.conf.d/10periodic"
dest
:
"
/etc/apt/apt.conf.d/10periodic"
owner
:
root
group
:
root
mode
:
"
0644"
when
:
SECURITY_UNATTENDED_UPGRADES
-
name
:
disable unattended-upgrades
file
:
path=/etc/apt/apt.conf.d/10periodic state=absent
-
name
:
Disable unattended-upgrades
file
:
path
:
"
/etc/apt/apt.conf.d/10periodic"
state
:
absent
when
:
not SECURITY_UNATTENDED_UPGRADES
-
name
:
only unattended-upgrade from security repo
template
:
>
src=etc/apt/apt.conf.d/20unattended-upgrade
dest=/etc/apt/apt.conf.d/20unattended-upgrade
owner=root group=root mode=0644
-
name
:
Only unattended-upgrade from security repo
template
:
src
:
"
etc/apt/apt.conf.d/20unattended-upgrade"
dest
:
"
/etc/apt/apt.conf.d/20unattended-upgrade"
owner
:
root
group
:
root
mode
:
"
0644"
when
:
SECURITY_UNATTENDED_UPGRADES and not SECURITY_UPDATE_ALL_PACKAGES
-
name
:
disable security only updates on unattended-upgrades
file
:
path=/etc/apt/apt.conf.d/20unattended-upgrade state=absent
-
name
:
Disable security only updates on unattended-upgrades
file
:
path
:
"
/etc/apt/apt.conf.d/20unattended-upgrade"
state
:
absent
when
:
SECURITY_UPDATE_ALL_PACKAGES or not SECURITY_UNATTENDED_UPGRADES
#### Bash security vulnerability
-
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
ignore_errors
:
yes
-
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"
-
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"
register
:
test_vuln
failed_when
:
"
'vulnerable'
in
test_vuln.stdout"
...
...
@@ -52,20 +66,23 @@
#### GHOST security vulnerability
-
name
:
GHOST.c
copy
:
>
src=tmp/GHOST.c
dest=/tmp/GHOST.c
owner=root group=root
copy
:
src
:
"
tmp/GHOST.c"
dest
:
"
/tmp/GHOST.c"
owner
:
root
group
:
root
-
name
:
c
ompile GHOST
shell
:
gcc -o /tmp/GHOST /tmp/GHOST.c
-
name
:
C
ompile GHOST
shell
:
"
gcc
-o
/tmp/GHOST
/tmp/GHOST.c"
-
name
:
Check if we are vulnerable
shell
:
/tmp/GHOST
shell
:
"
/tmp/GHOST"
register
:
test_ghost_vuln
ignore_errors
:
yes
-
name
:
Apply glibc security update if we are vulnerable
apt
:
name=libc6 state=latest update_cache=true
when
:
"
'vulnerable'
in
test_ghost_vuln.stdout"
apt
:
name
:
libc6
state
:
latest
update_cache
:
yes
when
:
"
'vulnerable'
in
test_ghost_vuln.stdout"
\ No newline at end of file
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