onion-grater development

This is now in the testers repository.

In context of SETCONF Tor control protocol command should not be used when system Tor is configured / TOR_SKIP_LAUNCH=1 is not honored (#42510) · Issues · The Tor Project / Applications / Tor Browser · GitLab maybe the following could be used…

    SETCONF:
      - pattern: 'UseBridges.*'
        replacement: 'non-existing-command'
        response:
        - pattern:     '.*'
          replacement: '250 OK'
Apr 09 10:46:36 host onion-grater[15915]: 10.138.28.23:60210 (filter: 30_autogenerated): -> SETCONF UseBridges=0 Bridge Socks4Proxy Socks5Proxy Socks5ProxyUsername Socks5ProxyPassword HTTPSProxy HTTPSProxyAuthenticator ReachableAddresses
Apr 09 10:46:36 host onion-grater[15915]: 10.138.28.23:60210 (filter: 30_autogenerated): rewrote command:
Apr 09 10:46:36 host onion-grater[15915]:     SETCONF UseBridges=0 Bridge Socks4Proxy Socks5Proxy Socks5ProxyUsername Socks5ProxyPassword HTTPSProxy HTTPSProxyAuthenticator ReachableAddresses
Apr 09 10:46:36 host onion-grater[15915]: to:
Apr 09 10:46:36 host onion-grater[15915]:     SETCONF non-existing-command
Apr 09 10:46:36 host onion-grater[15915]: 10.138.28.23:60210 (filter: 30_autogenerated): rewrote response:
Apr 09 10:46:36 host onion-grater[15915]:     552 Unrecognized option: Unknown option 'non-existing-command'.  Failing.
Apr 09 10:46:36 host onion-grater[15915]: to:
Apr 09 10:46:36 host onion-grater[15915]:     250 OK

Taking a command to be filtered (“SETCONF UseBridges=0 Bridge ...”), rewriting it to SETCONF non-existing-command, catch Tor’s response and rewrite to 250 OK.

…but I hope that won’t be needed.

Mentioning here because this might be useful one day for other applications.