Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Remove deprecated Shadowsocks repository and compile from source.
Browse files Browse the repository at this point in the history
Fixes #507 and #517.

Relates to #501 and #510.
  • Loading branch information
jlund committed Feb 15, 2017
1 parent b181f46 commit 67e3a02
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 39 deletions.
29 changes: 0 additions & 29 deletions playbooks/roles/shadowsocks/files/shadowsocks_org_signing.key

This file was deleted.

49 changes: 39 additions & 10 deletions playbooks/roles/shadowsocks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,49 @@
value: 3
state: present

- name: Add the official Shadowsocks.org APT key
apt_key:
id: 1D27208A
data: "{{ item }}"
with_file: shadowsocks_org_signing.key
- name: Install the shadowsocks-libev dependencies
apt:
name: "{{ item }}"
install_recommends: no
with_items: "{{ shadowsocks_dependencies }}"

- name: Add the Shadowsocks-libev repository
apt_repository:
repo: 'deb http://shadowsocks.org/{{ ansible_distribution|lower }} trusty main'
state: present
- name: Retrieve the shadowsocks-libev source code
get_url:
url: https://github.com/shadowsocks/shadowsocks-libev/archive/v{{ shadowsocks_version }}.tar.gz
dest: "{{ shadowsocks_source_location }}"
checksum: "{{ shadowsocks_checksum }}"
owner: root
group: root
mode: 0644

- name: Extract the shadowsocks-libev source code
unarchive:
copy: no
src: "{{ shadowsocks_source_location }}"
dest: /usr/local/src
owner: root
group: root
creates: "{{ shadowsocks_compilation_directory }}/README.md"

- name: Build the shadowsocks-libev package
shell: ./autogen.sh && dpkg-buildpackage -j{{ ansible_processor_cores }} -b -us -uc -i
args:
chdir: "{{ shadowsocks_compilation_directory }}"
creates: "{{ shadowsocks_compilation_directory }}/config.log"

- name: Discover the package name (in case we are compiling on an exotic non-AMD64 architecture)
command: find /usr/local/src/ -name shadowsocks-libev*.deb
register: shadowsocks_debian_package_location

- name: Install shadowsocks-libev
apt:
name: shadowsocks-libev
deb: "{{ shadowsocks_debian_package_location.stdout }}"

- name: Ensure that shadowsocks-libev runs as an unprivileged user
lineinfile:
dest: /etc/default/shadowsocks-libev
regexp: "^USER"
line: "USER=nobody"

- name: Generate a random Shadowsocks password
shell: openssl rand -base64 48 > {{ shadowsocks_password_file }}
Expand Down
23 changes: 23 additions & 0 deletions playbooks/roles/shadowsocks/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
---
shadowsocks_dependencies:
- apg
- asciidoc
- autoconf
- automake
- debhelper
- dh-systemd
- gettext
- libev-dev
- libmbedtls-dev
- libpcre3-dev
- libsodium-dev
- libssl-dev
- libtool
- libudns-dev
- xmlto

shadowsocks_checksum: "sha256:fa232047d12d39bf19f3539828ca1662da5e5905bfc03163ba20c37fe8e94d8f"
shadowsocks_version: "2.5.6"
shadowsocks_compilation_directory: "/usr/local/src/shadowsocks-libev-{{ shadowsocks_version }}"
shadowsocks_source_filename: "shadowsocks-libev-{{ shadowsocks_version }}.tar.gz"
shadowsocks_source_location: "/usr/local/src/{{ shadowsocks_source_filename }}"

shadowsocks_location: "/etc/shadowsocks-libev"
shadowsocks_password_file: "{{ shadowsocks_location }}/shadowsocks-password.txt"

Expand Down

0 comments on commit 67e3a02

Please sign in to comment.