Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/acme/ |
| [Home] [System Details] [Kill Me] |
�
���_c@s�dZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddl
mZddl
mZddl
mZeje�Zd e jfd
��YZddd��YZd
efd��YZdeefd��YZdejfd��YZdeefd��YZdefd��YZdejfd��YZde jfd��YZdS(s1Support
for standalone client challenge solvers.
i����N(tBaseHTTPServer(thttp_client(tsocketserver(t
challenges(tcrypto_util(tListt TLSServercBs2eZdZd�Zd�Zd�Zd�ZRS(sGeneric
TLS
Server.cOs�|jdt�|_|jr-tj|_ntj|_|jdi�|_|jdtj �|_
|jdt�|_t
jj|||�dS(Ntipv6tcertstmethodtallow_reuse_address(tpoptFalseRtsockettAF_INET6taddress_familytAF_INETRRt_DEFAULT_SSL_METHODR tTrueR
Rt TCPServert__init__(tselftargstkwargs((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRs c Cs=tj|jd|jdt|dd�d|j�|_dS(Ntcert_selectiontalpn_selectiont_alpn_selectionR (Rt SSLSocketR
t_cert_selectiontgetattrtNoneR (R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyt
_wrap_sock"scCs|j�}|jj|d�S(s.Callback
selecting certificate for connection.N(tget_servernameRtgetR(Rt
connectiontserver_name((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR(scCs|j�tjj|�S(N(RRRtserver_bind(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR$-s
(t__name__t
__module__t__doc__RRRR$(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRs
tACMEServerMixincBseZdZdZeZRS(s"ACME server common
settings mixin.s'ACME client standalone challenge
solver(R%R&R'tserver_versionRR
(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR(2stBaseDualNetworkedServerscBs2eZdZd�Zd�Zd�Zd�ZRS(sBase
class for a pair of IPv6 and IPv4 servers that tries to do everything
it's asked for both servers, but where failures in one server
don't
affect the other.
If two servers are instantiated, they will serve on the same port.
c
Os\|d}g|_g|_xttgD]}yp||d<|df|f|d}|f|}|||�} tjd|d|d|r�dnd�Wnttjk
r|jr�tjd|d|d|r�dnd�q9tjd |d|d|rdnd�q)X|jj| �| jj �d}q)W|jsXtjd
��ndS(NiRiis$Successfully bound to %s:%s using
%stIPv6tIPv4s�Certbot wasn't able to bind to %s:%s using %s, this
is often expected due to the dual stack nature of IPv6 socket
implementations.s Failed to bind to %s:%s using %ssCould not bind to IPv4
or IPv6.(
tthreadstserversRRtloggertdebugR
terrortappendtgetsockname(
RtServerClasstserver_addresstremaining_argsRtportt
ip_versiontnew_addresstnew_argstserver((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRAs2
cCsGx@|jD]5}tjd|j�}|j�|jj|�q
WdS(s*Wraps
socketserver.TCPServer.serve_foreverttargetN(R.t threadingtThreadt
serve_forevertstartR-R2(RR;tthread((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR?ks
cCs#g|jD]}|jj�^q
S(s/Wraps
socketserver.TCPServer.socket.getsockname(R.R
R3(RR;((s3/usr/lib/python2.7/site-packages/acme/standalone.pytgetsocknamessscCsSx%|jD]}|j�|j�q
Wx|jD]}|j�q2Wg|_dS(spWraps socketserver.TCPServer.shutdown,
socketserver.TCPServer.server_close, and
threading.Thread.joinN(R.tshutdowntserver_closeR-tjoin(RR;RA((s3/usr/lib/python2.7/site-packages/acme/standalone.pytshutdown_and_server_closews
(R%R&R'RR?RBRF(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR*9s
* tTLSALPN01ServercBs2eZdZdZed�Zd�Zd�ZRS(sTLSALPN01
Server.s
acme-tls/1cCs,tj||td|d|�||_dS(NRR(RRt_BaseRequestHandlerWithLoggingtchallenge_certs(RR5RRIR((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�scCs/|j�}tjd|�|jj|d�S(Ns)Serving
challenge cert for server name %s(R
R/R0RIR!R(RR"R#((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�scCsYt|�dkr?|d|jkr?tjd|j�|jStjdt|��dS(s!Callback
to select alpn protocol.iisAgreed on %s ALPNs#Cannot agree on ALPN proto.
Got:
%st(tlentACME_TLS_1_PROTOCOLR/R0tstr(Rt_connectiontalpn_protos((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�s
%(R%R&R'RLRRRR(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRG�s
t
HTTPServercBseZdZd�ZRS(sGeneric HTTP
Server.cOsS|jdt�|_|jr-tj|_ntj|_tjj |||�dS(NR(
RRRR
RRRRRPR(RRR((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�s
(R%R&R'R(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRP�stHTTP01ServercBseZdZedd�ZRS(sHTTP01
Server.icCs/tj||tjd|d|�d|�dS(Ntsimple_http_resourcesttimeoutR(RPRtHTTP01RequestHandlertpartial_init(RR5t resourcesRRS((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�s(R%R&R'RR(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRQ�stHTTP01DualNetworkedServerscBseZdZd�ZRS(s`HTTP01Server
Wrapper. Tries everything for both. Failures for one don't
affect the
other.cOstj|t||�dS(N(R*RRQ(RRR((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�s(R%R&R'R(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRW�sRTcBsneZdZejdd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Ze
d
��ZRS(s�HTTP01 challenge handler.
Adheres to the stdlib's `socketserver.BaseRequestHandler`
interface.
:ivar set simple_http_resources: A set of `HTTP01Resource`
objects. TODO: better name?
tHTTP01Resourceschall response
validationcOsG|jdt��|_|jdd�|_tjj|||�dS(NRRRSi(RtsetRRRSRtBaseHTTPRequestHandlerR(RRR((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR�scGs"tjd|jd||�dS(sLog
arbitrary message.s %s - -
%siN(R/R0tclient_address(RtformatR((s3/usr/lib/python2.7/site-packages/acme/standalone.pytlog_message�scCs!|jd�tjj|�dS(sHandle
request.sIncoming
requestN(R]RRZthandle(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR^�s
cCsS|jdkr|j�n3|jjdtjj�rE|j�n
|j�dS(Nt/(tpaththandle_indext
startswithRtHTTP01t
URI_ROOT_PATHthandle_simple_http_resourcet
handle_404(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pytdo_GET�s
cCsG|jd�|jdd�|j�|jj|jjj��dS(sHandle
index
page.i�sContent-Types text/htmlN(t
send_responsetsend_headertend_headerstwfiletwriteR;R)tencode(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRa�s
cCsD|jtjdd�|jdd�|j�|jjd�dS(sHandler 404
Not Found errors.tmessages Not
FoundsContent-types text/htmlt404N(RhRt NOT_FOUNDRiRjRkRl(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRf�s
cCs�x�|jD]n}|jj|jkr
|jd|jjd��|jtj�|j�|j j
|jj��dSq
W|jd�|jd|j�dS(s$Handle HTTP01 provisioned
resources.sServing HTTP01 with token %rttokenNsNo resources to serves0%s
does not correspond to any resource.
ignoring(RRtchallR`R]RmRhRtOKRjRkRlt
validation(Rtresource((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRe�s
cCstj|d|d|�S(s�Partially initialize this handler.
This is useful because `socketserver.BaseServer` takes
uninitialized handler and initializes it with the current
request.
RRRS(t functoolstpartial(tclsRRRS((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRUs (R%R&R'tcollectionst
namedtupleRXRR]R^RgRaRfRetclassmethodRU(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRT�s RHcBs
eZdZd�Zd�ZRS(s BaseRequestHandler with
logging.cGs"tjd|jd||�dS(sLog arbitrary message.s %s
- -
%siN(R/R0R[(RR\R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR]scCs!|jd�tjj|�dS(sHandle
request.sIncoming
requestN(R]RtBaseRequestHandlerR^(R((s3/usr/lib/python2.7/site-packages/acme/standalone.pyR^s
(R%R&R'R]R^(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyRHs ((R'RyRvtloggingR
R=t six.movesRRRtacmeRRtacme.magic_typingRt getLoggerR%R/RRR(tobjectR*RGRPRQRWRZRTR|RH(((s3/usr/lib/python2.7/site-packages/acme/standalone.pyt<module>s*I" M