Skip to content

Instantly share code, notes, and snippets.

@SwagDevOps
Last active January 30, 2025 16:59
Show Gist options
  • Select an option

  • Save SwagDevOps/7132a54a892a72d275f1960f6cfc9233 to your computer and use it in GitHub Desktop.

Select an option

Save SwagDevOps/7132a54a892a72d275f1960f6cfc9233 to your computer and use it in GitHub Desktop.

Revisions

  1. SwagDevOps revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion danted.conf
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # Server logging
    logoutput: /var/log/sockd.log
    errorlog: /var/log/sockd.log
    debug: 1
    debug: 0
    # Define the internal and external network interfaces
    internal: 0.0.0.0 port = 1080
    external: eth0
  2. SwagDevOps revised this gist Jan 30, 2025. 3 changed files with 3 additions and 1 deletion.
    1 change: 1 addition & 0 deletions danted.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # vim: set filetype=apache :
    # file: /etc/danted.conf

    # Server logging
    1 change: 1 addition & 0 deletions danted.override.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # vim: set filetype=ini :
    # file: /etc/systemd/system/danted.service.d/override.conf
    [Service]
    ReadWritePaths=/var/log/sockd.log
    2 changes: 1 addition & 1 deletion logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vim: set filetype=nginx :
    # vim: set filetype=apache :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  3. SwagDevOps revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vim: set filetype=apache :
    # vim: set filetype=nginx :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  4. SwagDevOps revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vim: set filetype=conf :
    # vim: set filetype=apache :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  5. SwagDevOps revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vim: set filetype=config :
    # vim: set filetype=conf :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  6. SwagDevOps revised this gist Jan 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # vim: set filetype=gitconfig :
    # vim: set filetype=config :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  7. SwagDevOps renamed this gist Jan 30, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions logrotate-sockd>conf → logrotate-sockd.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # vim: set filetype=gitconfig :
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
  8. SwagDevOps renamed this gist Jan 30, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. SwagDevOps created this gist Jan 30, 2025.
    28 changes: 28 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    ## Service

    ```.sh
    systemctl edit danted.service
    systemctl daemon-reload
    service danted restart
    ```

    ## Logging

    ```.sh
    touch /var/log/sockd.log
    chown root:proxy !$
    chmod 0664 !$
    ```

    ## User

    ```.sh
    useradd --system -M -U -s /usr/bin/false -d /dev/null -- proxy-user
    passwd !$
    ```

    ## Test

    ```sh
    curl --socks5 proxy-user:[email protected]:1080 https://example.com
    ```
    27 changes: 27 additions & 0 deletions danted.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # file: /etc/danted.conf

    # Server logging
    logoutput: /var/log/sockd.log
    errorlog: /var/log/sockd.log
    debug: 1
    # Define the internal and external network interfaces
    internal: 0.0.0.0 port = 1080
    external: eth0
    # when doing something that can require privilege (use userid of):
    user.privileged: root # proxy
    # when running as usual (use userid of):
    user.unprivileged: nobody
    # when compiled with libwrap support (use userid of):
    user.libwrap: nobody
    # Define the method of authentication
    socksmethod: username # none
    # Define access
    socks pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: error connect disconnect
    }

    client pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: connect disconnect
    }
    3 changes: 3 additions & 0 deletions danted.override.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # file: /etc/systemd/system/danted.service.d/override.conf
    [Service]
    ReadWritePaths=/var/log/sockd.log
    14 changes: 14 additions & 0 deletions logrotate-sockd>conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # custom logrotate
    #
    # file: /etc/logrotate.d/sockd
    /var/log/sockd.log {
    missingok
    create 0664 root proxy
    notifempty
    compress
    delaycompress
    rotate 7
    postrotate
    /usr/sbin/service danted force-reload 2> /dev/null || true
    endscript
    }