From twm at freecog.net Mon Apr 1 21:25:55 2019 From: twm at freecog.net (Tom Most) Date: Mon, 01 Apr 2019 23:25:55 -0400 Subject: [Twisted-web] Listening on 2 addresses In-Reply-To: References: <9A7AC4BF-7376-4887-837D-1AAACA369588@Chaos1.DE> <2ccdd885-0c0c-424e-b2d2-7ad3d79ea467@www.fastmail.com> Message-ID: Hi Axel, I'm not entirely sure what's going wrong there (maybe quote the ipv6 address?), but you want to retain the various independent command-line options you should instantiate endpoints directly rather than constructing an endpoint string (the endpoint string is useful to expose *directly* as a CLI parameter). I.e., you can construct SSL4ServerEndpoint directly. Oddly SSL6ServerEndpoint doesn't exist, though, and I don't see a generic server wrapper like wrapClientTLS for the server site. I'm afraid I may have led you down the wrong path --- I didn't realize this was missing. ---Tom On Sun, Mar 31, 2019, at 8:34 AM, Axel Rau wrote: > Hi Tom, > > thanks for the explanation. After adding some brackets, your example code works like a charm. >> >> [1]: https://twistedmatrix.com/documents/current/api/twisted.application.service.MultiService.html >> [2]: https://twistedmatrix.com/documents/current/api/twisted.application.internet.StreamServerEndpointService.html >> [3]: https://twistedmatrix.com/documents/current/api/twisted.internet.endpoints.html#serverFromString > > Using your pointers, I tried the next step: TLS. > > This variant of the makeService method: > > ipv4_endpoint = endpoints.serverFromString( > reactor, 'ssl:{}:privateKey={}:certKey={}:interface={}'.format( > options['port'], > endpoints.quoteStringArgument(options['cert_path']), > endpoints.quoteStringArgument(options['key_path']), > options['ipv4_address'])) > > ipv6_endpoint = endpoints.serverFromString( > reactor, 'ssl:{}:privateKey={}:certKey={}:interface={}'.format( > options['port'], > endpoints.quoteStringArgument(options['cert_path']), > endpoints.quoteStringArgument(options['key_path']), > options['ipv6_address'])) > > ipv4 = internet.StreamServerEndpointService(ipv4_endpoint, meteo_factory) > ipv6 = internet.StreamServerEndpointService(ipv6_endpoint, meteo_factory) > > root = MultiService() > ipv4.setServiceParent(root) > ipv6.setServiceParent(root) > > does not work. It fails with: > _parseSSL() got multiple values for argument ‚interface' > same with private privateKey and certKey. > > What did I wrong this time? > > Thanks, Axel > --- > PGP-Key:29E99DD6 ☀ computing @ chaos claudius > > _______________________________________________ > Twisted-web mailing list > Twisted-web at twistedmatrix.com > https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Axel.Rau at Chaos1.DE Tue Apr 2 02:17:57 2019 From: Axel.Rau at Chaos1.DE (Axel Rau) Date: Tue, 2 Apr 2019 10:17:57 +0200 Subject: [Twisted-web] [RESOLVED] --was: Re: Listening on 2 addresses In-Reply-To: References: <9A7AC4BF-7376-4887-837D-1AAACA369588@Chaos1.DE> <2ccdd885-0c0c-424e-b2d2-7ad3d79ea467@www.fastmail.com> Message-ID: <0EBA4C53-007D-4930-9C2C-0F052B4CAB30@Chaos1.DE> Hi Tom, quoting the IPv6 address resolved the issue! The error message is far away from being helpful. )-: Thanks for your patience, Axel > Am 02.04.2019 um 05:25 schrieb Tom Most : > > Hi Axel, > > I'm not entirely sure what's going wrong there (maybe quote the ipv6 address?), but you want to retain the various independent command-line options you should instantiate endpoints directly rather than constructing an endpoint string (the endpoint string is useful to expose directly as a CLI parameter). > > I.e., you can construct SSL4ServerEndpoint directly. Oddly SSL6ServerEndpoint doesn't exist, though, and I don't see a generic server wrapper like wrapClientTLS for the server site. I'm afraid I may have led you down the wrong path --- I didn't realize this was missing. > > ---Tom > > On Sun, Mar 31, 2019, at 8:34 AM, Axel Rau wrote: >> Hi Tom, >> >> thanks for the explanation. After adding some brackets, your example code works like a charm. >>> >>> [1]: https://twistedmatrix.com/documents/current/api/twisted.application.service.MultiService.html >>> [2]: https://twistedmatrix.com/documents/current/api/twisted.application.internet.StreamServerEndpointService.html >>> [3]: https://twistedmatrix.com/documents/current/api/twisted.internet.endpoints.html#serverFromString >> >> >> Using your pointers, I tried the next step: TLS. >> >> This variant of the makeService method: >> >> ipv4_endpoint = endpoints.serverFromString( >> reactor, 'ssl:{}:privateKey={}:certKey={}:interface={}'.format( >> options['port'], >> endpoints.quoteStringArgument(options['cert_path']), >> endpoints.quoteStringArgument(options['key_path']), >> options['ipv4_address'])) >> >> ipv6_endpoint = endpoints.serverFromString( >> reactor, 'ssl:{}:privateKey={}:certKey={}:interface={}'.format( >> options['port'], >> endpoints.quoteStringArgument(options['cert_path']), >> endpoints.quoteStringArgument(options['key_path']), >> options['ipv6_address'])) >> >> ipv4 = internet.StreamServerEndpointService(ipv4_endpoint, meteo_factory) >> ipv6 = internet.StreamServerEndpointService(ipv6_endpoint, meteo_factory) >> >> root = MultiService() >> ipv4.setServiceParent(root) >> ipv6.setServiceParent(root) >> >> does not work. It fails with: >> _parseSSL() got multiple values for argument ‚interface' >> same with private privateKey and certKey. >> >> What did I wrong this time? >> >> Thanks, Axel >> --- >> PGP-Key:29E99DD6 ☀ computing @ chaos claudius >> >> _______________________________________________ >> Twisted-web mailing list >> Twisted-web at twistedmatrix.com >> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web >> > > _______________________________________________ > Twisted-web mailing list > Twisted-web at twistedmatrix.com > https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web --- PGP-Key:29E99DD6 ☀ computing @ chaos claudius -------------- next part -------------- An HTML attachment was scrubbed... URL: