Skip to content

Instantly share code, notes, and snippets.

@thapakazi
Last active April 11, 2023 08:40
Show Gist options
  • Select an option

  • Save thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 to your computer and use it in GitHub Desktop.

Select an option

Save thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 to your computer and use it in GitHub Desktop.

Revisions

  1. thapakazi revised this gist Apr 11, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-tiny-proxy.yaml
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@
    ansible.builtin.lineinfile:
    path: /etc/tinyproxy/tinyproxy.conf
    regexp: '^(Allow)(.*)'
    line: 'Allow 0.10.0.0/0'
    line: 'Allow 0.0.0.0/0'
    insertafter: '^Allow'

    - name: Adjust Tinyproxy config - Set MaxClients
  2. thapakazi revised this gist Apr 11, 2023. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions install-tiny-proxy.yaml
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,14 @@
    ---
    #
    # Install ansible (like in ubuntu):
    # sudo apt update
    # sudo apt install software-properties-common
    # sudo add-apt-repository --yes --update ppa:ansible/ansible
    # sudo apt install -y ansible

    # run with pull
    # ansible-pull -U https://gist.github.com/thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 install-tiny-proxy.yaml -i "localhost," -c local
    #
    - name: Install and configure Tinyproxy
    hosts: all
    become: yes
  3. thapakazi created this gist Apr 11, 2023.
    49 changes: 49 additions & 0 deletions install-tiny-proxy.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    ---
    - name: Install and configure Tinyproxy
    hosts: all
    become: yes
    tasks:
    - name: Update apt cache and install Tinyproxy
    ansible.builtin.apt:
    name: tinyproxy
    update_cache: yes
    state: present

    - name: Adjust Tinyproxy config - Bind to all interfaces
    ansible.builtin.lineinfile:
    path: /etc/tinyproxy/tinyproxy.conf
    regexp: '^(Bind)(.*)'
    line: 'Bind 0.0.0.0'

    - name: Adjust Tinyproxy config - Allow access from specific IP range
    ansible.builtin.lineinfile:
    path: /etc/tinyproxy/tinyproxy.conf
    regexp: '^(Allow)(.*)'
    line: 'Allow 0.10.0.0/0'
    insertafter: '^Allow'

    - name: Adjust Tinyproxy config - Set MaxClients
    ansible.builtin.lineinfile:
    path: /etc/tinyproxy/tinyproxy.conf
    regexp: '^(MaxClients)(.*)'
    line: 'MaxClients 10000'

    - name: Create systemd override directory for Tinyproxy
    ansible.builtin.file:
    path: /etc/systemd/system/tinyproxy.service.d
    state: directory
    mode: '0755'

    - name: Adjust systemd file for Tinyproxy - Set LimitNOFILE
    ansible.builtin.blockinfile:
    path: /etc/systemd/system/tinyproxy.service.d/override.conf
    block: |
    [Service]
    LimitNOFILE=65536
    create: yes

    - name: Reload and restart Tinyproxy
    ansible.builtin.systemd:
    name: tinyproxy
    state: restarted
    daemon_reload: yes