yubihsm-connector-3.0.5/0000775000175000017500000000000014667565502014167 5ustar aveenaveenyubihsm-connector-3.0.5/go.sum0000664000175000017500000014034214667565502015326 0ustar aveenaveencloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.5.3 h1:vNFpj2z7YIbwh2bw7x35sqYpp2wfuq+pivKbWG09B8c= github.com/fsnotify/fsnotify v1.5.3/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gousb v1.1.2 h1:1BwarNB3inFTFhPgUEfah4hwOPuDz/49I0uX8XNginU= github.com/google/gousb v1.1.2/go.mod h1:GGWUkK0gAXDzxhwrzetW592aOmkkqSGcj5KLEgmCVUg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk= github.com/kardianos/service v1.2.1/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/notdpate/evloghook v0.0.0-20180503050227-f202fa6c9ebb h1:GFmMJZvdCkRfbfo07+lUKrB+jh2cJ+a2l6qD/3hxZ6M= github.com/notdpate/evloghook v0.0.0-20180503050227-f202fa6c9ebb/go.mod h1:ukoRZyzBppMQypxM7KqEvHc4DB5uNW6NXFp1sVeXamM= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= yubihsm-connector-3.0.5/logging_windows.go0000664000175000017500000000206014667565502017714 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // +build windows package main import ( "io/ioutil" log "github.com/sirupsen/logrus" logrus_evlog "github.com/notdpate/evloghook" ) func loggingInit(interactive bool) error { if interactive { log.SetFormatter(&log.TextFormatter{DisableColors: true}) } else { log.SetOutput(ioutil.Discard) log.SetFormatter(&log.JSONFormatter{}) hook, err := logrus_evlog.NewEventLogHook("YubiHSM Connector") if err != nil { return err } log.AddHook(hook) } return nil } yubihsm-connector-3.0.5/usb_windows.h0000664000175000017500000000271714667565502016712 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef USB_WINDOWS_H_GUARD #define USB_WINDOWS_H_GUARD #include #include #include #include #include #include #include #include typedef struct DEVICE_CONTEXT { HANDLE deviceHandle; WINUSB_INTERFACE_HANDLE usbInterface; UCHAR readPipe; UCHAR writePipe; BOOL initialized; } DEVICE_CONTEXT, *PDEVICE_CONTEXT; extern DWORD usbOpen(int vendorId, int productId, char* serialNumber, PDEVICE_CONTEXT* device); extern void usbClose(PDEVICE_CONTEXT* device); extern DWORD usbCheck(PDEVICE_CONTEXT device, int vendorId, int productId); extern DWORD usbWrite(PDEVICE_CONTEXT device, PUCHAR buffer, ULONG bufferSizeInBytes, PULONG bytesTransferred); extern DWORD usbRead(PDEVICE_CONTEXT device, PUCHAR buffer, ULONG bufferSizeInBytes, PULONG bytesTransferred); #endif // USB_WINDOWS_H_GUARD yubihsm-connector-3.0.5/versioninfo_windows.go0000664000175000017500000000117214667565502020632 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //go:generate goversioninfo -64 package main yubihsm-connector-3.0.5/version.in.go0000664000175000017500000000566414667565502016623 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // +build ignore package main import ( "encoding/json" "io/ioutil" "log" "os" "runtime" "text/template" "time" ) type VersionInput struct { Major int `json:"major"` Minor int `json:"minor"` Patch int `json:"patch"` Build int `json:"build"` } func die(err error) { if err != nil { log.Fatal(err) } } func main() { // Read JSON version file raw_version, err := ioutil.ReadFile("./VERSION") die(err) var vi VersionInput err = json.Unmarshal(raw_version, &vi) die(err) f, err := os.Create("version.go") die(err) defer f.Close() var funcMap = make(template.FuncMap) funcMap["now"] = time.Now funcMap["isWindows"] = func() bool { return runtime.GOOS == "windows" } var versionTemplate = template.Must(template.New("").Funcs(funcMap).Parse(`// go generate // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by robots at // {{ now.UTC }} package main import ( "fmt" ) type VersionInfo struct { Major int Minor int Patch int Build int } func (v *VersionInfo) String() string { return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch) } var Version = VersionInfo{ {{ .Major }}, {{ .Minor }}, {{ .Patch }}, {{ .Build }} } `)) versionTemplate.Execute(f, vi) var versionInfoTemplate = template.Must(template.New("").Parse(`{ "FixedFileInfo" : { "FileVersion": { "Major": {{ .Major }}, "Minor": {{ .Minor }}, "Patch": {{ .Patch }}, "Build": {{ .Build }} }, "ProductVersion": { "Major": {{ .Major }}, "Minor": {{ .Minor }}, "Patch": {{ .Patch }}, "Build": {{ .Build }} }, "FileFlagsMask": "3f", "FileFlags": "00", "FileOS": "040004", "FileType": "01", "FileSubType": "00" }, "StringFileInfo": { "Comments": "", "CompanyName": "Yubico AB", "FileDescription": "YubiHSM Connector", "FileVersion": "{{ .Major }}.{{ .Minor }}.{{ .Patch }}.{{ .Build }}", "InternalName": "yubihsm-connector", "LegalCopyright": "© Yubico AB", "LegalTrademarks": "", "OriginalFilename": "yubihsm-connector", "PrivateBuild": "", "ProductName": "YubiHSM Connector", "ProductVersion": "{{ .Major }}.{{ .Minor }}.{{ .Patch }}.{{ .Build }}", "SpecialBuild": "" }, "VarFileInfo": { "Translation": { "LangID": "0409", "CharsetID": "04B0" } } }`)) if runtime.GOOS == "windows" { f, err = os.Create("versioninfo.json") die(err) defer f.Close() versionInfoTemplate.Execute(f, vi) } } yubihsm-connector-3.0.5/Dockerfile0000664000175000017500000000116214667565502016161 0ustar aveenaveenFROM golang:1.17-bullseye AS build RUN apt-get update -y && \ apt-get install -y \ curl \ git \ pkg-config \ build-essential \ libusb-1.0.0-dev && \ apt-get clean &&\ rm -rf /var/lib/apt/lists/* COPY . /usr/lib/src/yubihsm-connector WORKDIR /usr/lib/src/yubihsm-connector RUN make rebuild FROM debian:bullseye-slim RUN apt-get update -y && \ apt-get install -y libusb-1.0.0 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY --from=build /usr/lib/src/yubihsm-connector/bin/yubihsm-connector /usr/local/bin/ ENV YUBIHSM_CONNECTOR_LISTEN=0.0.0.0:12345 ENTRYPOINT ["yubihsm-connector"] CMD ["-d"] yubihsm-connector-3.0.5/go.mod0000664000175000017500000000242614667565502015301 0ustar aveenaveenmodule github.com/Yubico/yubihsm-connector go 1.17 require ( github.com/google/gousb v1.1.2 github.com/google/uuid v1.3.0 github.com/kardianos/service v1.2.1 github.com/notdpate/evloghook v0.0.0-20180503050227-f202fa6c9ebb github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 github.com/spf13/viper v1.11.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) require ( github.com/fsnotify/fsnotify v1.5.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.2.0 // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) yubihsm-connector-3.0.5/usb_libusb.go0000664000175000017500000001306114667565502016650 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // +build !windows package main import ( "context" "fmt" "sync" "time" "github.com/google/gousb" log "github.com/sirupsen/logrus" ) var state struct { ctx *gousb.Context device *gousb.Device config *gousb.Config iface *gousb.Interface wendpoint *gousb.OutEndpoint rendpoint *gousb.InEndpoint mtx sync.Mutex } func usbopen(cid string, serial string) (err error) { if state.ctx == nil { log.WithField("Correlation-ID", cid).Debug("usb context not yet open") state.ctx = gousb.NewContext() if state.ctx == nil { return fmt.Errorf("unable to create a usb context") } } if state.device != nil { log.WithField("Correlation-ID", cid).Debug("usb device already open") return nil } var devs []*gousb.Device devs, err = state.ctx.OpenDevices(func(desc *gousb.DeviceDesc) bool { if desc.Vendor == 0x1050 && desc.Product == 0x0030 { return true } return false }) // If len(devs) > 0 we're happy even if there are errors, because // gousb will try to open all the devices that match, but will also // return the last of any error encountered when interacting with // *any* device, even the ones we're not interested in. if len(devs) == 0 && err != nil { goto out } for _, dev := range devs { serialnumber, err := dev.SerialNumber() if err != nil { log.WithFields(log.Fields{ "Correlation-ID": cid, "Device": dev, "Error": err, }).Debug("Couldn't read serial number from device") dev.Close() continue } fields := log.Fields{ "Correlation-ID": cid, "Device-Serial": serialnumber, "Wanted-Serial": serial, } if serial != "" && serial != serialnumber { log.WithFields(fields).Debug("Device skipped for non-matching serial") dev.Close() } else { log.WithFields(fields).Debug("Returning a matched device") if state.device != nil { // A new matching device will override the previously selected // one, close the one we're overriding. state.device.Close() } state.device = dev } } if state.device == nil { err = fmt.Errorf("device not found") goto out } state.device.ControlTimeout = 5 * time.Second state.config, err = state.device.Config(1) if err != nil { goto out } state.iface, err = state.config.Interface(0, 0) if err != nil { goto out } state.wendpoint, err = state.iface.OutEndpoint(0x1) if err != nil { goto out } state.rendpoint, err = state.iface.InEndpoint(0x81) if err != nil { goto out } usbread(cid, 1*time.Millisecond) return nil out: usbclose(cid) return err } func usbclose(cid string) { if state.iface != nil { state.iface.Close() state.iface = nil } if state.config != nil { state.config.Close() state.config = nil } if state.device != nil { state.device.Close() state.device = nil } } func usbreopen(cid string, why error, serial string) (err error) { log.WithFields(log.Fields{ "Correlation-ID": cid, "why": why, }).Debug("reopening usb context") usbclose(cid) return usbopen(cid, serial) } func usbCheck(cid string, serial string) (err error) { state.mtx.Lock() defer state.mtx.Unlock() if err = usbopen(cid, serial); err != nil { return err } for { if _, err := state.device.SerialNumber(); err != nil { log.WithFields(log.Fields{ "Correlation-ID": cid, "Error": err, }).Debug("Couldn't read serial number from device") if err = usbreopen(cid, err, serial); err != nil { return err } continue } break } return nil } func usbwrite(buf []byte, cid string) (err error) { var n int var ctx context.Context ctx = context.Background() if n, err = state.wendpoint.WriteContext(ctx, buf); err != nil { goto out } if len(buf)%64 == 0 { var empty []byte if n, err = state.wendpoint.WriteContext(ctx, empty); err != nil { goto out } } out: log.WithFields(log.Fields{ "Correlation-ID": cid, "n": n, "err": err, "len": len(buf), "buf": buf, }).Debug("usb endpoint write") return err } func usbread(cid string, timeout time.Duration) (buf []byte, err error) { var n int var ctx context.Context buf = make([]byte, 8192) ctx = context.Background() if timeout > 0 { var cancel func() ctx, cancel = context.WithTimeout(ctx, timeout) defer cancel() } if n, err = state.rendpoint.ReadContext(ctx, buf); err != nil { buf = buf[:0] goto out } buf = buf[:n] out: log.WithFields(log.Fields{ "Correlation-ID": cid, "n": n, "err": err, "len": len(buf), "buf": buf, }).Debug("usb endpoint read") return buf, err } func usbProxy(req []byte, cid string, serial string) (resp []byte, err error) { state.mtx.Lock() defer state.mtx.Unlock() if err = usbopen(cid, serial); err != nil { return nil, err } for i := 0; i < 2; i++ { if err = usbwrite(req, cid); err != nil { if err2 := usbreopen(cid, err, serial); err2 != nil { return nil, err2 } continue } resp, err = usbread(cid, 0) break } return resp, err } yubihsm-connector-3.0.5/tools/0000775000175000017500000000000014667565502015327 5ustar aveenaveenyubihsm-connector-3.0.5/tools/generate-certificate0000775000175000017500000000141314667565502021326 0ustar aveenaveen#!/usr/bin/env bash if [[ ! -z "$DEBUG" ]]; then set -x fi set -eu -o pipefail readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly SOURCE_DIR="$SCRIPT_DIR/.." main() { local out="$SOURCE_DIR/var" if [[ $# -eq 1 ]]; then out="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" if [[ ! -d "$out" ]]; then printf '%s: not a directory\n' "$1" >&2 exit 1 fi fi local key="$out/cert.key" local cert="$out/cert.crt" if [[ -f "$key" && -f "$cert" ]]; then exit 0 fi openssl req -newkey rsa:2048 -x509 -days 365 -nodes \ -subj "/C=SE/O=EXAMPLE/CN=example.com" \ -keyout "$key" -out "$cert" &>/dev/null echo "$key" echo "$cert" } pushd "$SOURCE_DIR" &>/dev/null main "$@" popd &>/dev/null yubihsm-connector-3.0.5/CHANGELOG0000664000175000017500000000055414667565502015405 0ustar aveenaveen=== Version 3.0.5 * Increase maximum message size the connector can handle * Fix compatibility with later Go versions === Version 3.0.4 * Add changelog * Minor code improvement === Version 3.0.3 * Dependency update === Version 3.0.2 * Timeout functionality deprecated === Version 3.0.1 * Security update for YSA-2021-02 * Improved compatibility with ESXiyubihsm-connector-3.0.5/deb/0000775000175000017500000000000014667565502014721 5ustar aveenaveenyubihsm-connector-3.0.5/deb/yubihsm-connector.yaml0000664000175000017500000000041214667565502021252 0ustar aveenaveen# Certificate (X.509) #cert: "" # # Certificate key #key: "" # # Listening address. Defaults to "127.0.0.1:12345". #listen: "127.0.0.1:12345" # # Device serial in case of multiple devices #serial: "" # # Log to syslog/eventlog. Defaults to "false". #syslog: "false" yubihsm-connector-3.0.5/deb/yubihsm-connector0000664000175000017500000000314114667565502020313 0ustar aveenaveen#!/bin/sh ### BEGIN INIT INFO # Provides: yubihsm-connector # Required-Start: $local_fs $network $named $time $syslog # Required-Stop: $local_fs $network $named $time $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the yubihsm-connector # Description: starts yubihsm-connector using start-stop-daemon ### END INIT INFO DESC="yubihsm-connector" NAME=yubihsm-connector DAEMON=/usr/bin/yubihsm-connector DAEMONOPTS="-c /etc/yubihsm-connector.yaml" DAEMONUSER=yubihsm-connector PIDFILE=/var/run/$NAME.pid LOGFILE=/var/log/$NAME.log STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}" test -x $DAEMON || exit 0 start() { touch $LOGFILE && chown $DAEMONUSER $LOGFILE start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE \ --background --chuid $DAEMONUSER --oknodo --exec $DAEMON -- $DAEMONOPTS } stop() { start-stop-daemon --stop --quiet --pidfile $PIDFILE --retry=$STOP_SCHEDULE \ --oknodo rm -f $PIDFILE } status() { if [ -f $PIDFILE ]; then if kill -0 $(cat "$PIDFILE"); then echo "$NAME is running" else echo "$NAME process is dead, but pidfile exists" fi else echo "$NAME is not running" fi } case "$1" in start) echo "Starting $NAME" start ;; stop) echo "Stopping $NAME" stop ;; restart) echo "Restarting $NAME" stop start ;; status) status ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" exit 2 ;; esac exit 0 yubihsm-connector-3.0.5/deb/70-yubihsm-connector.rules0000664000175000017500000000030314667565502021665 0ustar aveenaveenACTION!="add|change", GOTO="yubihsm_connector_end" #Yubico YubiHSM2 SUBSYSTEM=="usb", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0030", OWNER="yubihsm-connector" LABEL="yubihsm_connector_end" yubihsm-connector-3.0.5/deb/deb.json0000664000175000017500000000172514667565502016353 0ustar aveenaveen{ "name": "yubihsm-connector", "maintainer": "Yubico Open Source Maintainers ", "description": "USB to HTTP bridge for the YubiHSM", "homepage": "https://developers.yubico.com/YubiHSM2/Component_Reference/yubihsm-connector/", "files": [ { "from": "bin/!name!", "to": "/usr/bin", "base": "bin/", "fperm": "0755" }, { "from": "deb/70-!name!.rules", "to": "/lib/udev/rules.d", "base": "deb/", "fperm": "0644" }, { "from": "deb/!name!.yaml", "to": "/etc/", "base": "deb/", "fperm": "0644" } ], "copyrights": [ { "files": "*", "copyright": "2016 Yubico AB", "license": "BSD", "file": "LICENSE" } ], "depends": [ "libusb-1.0-0", "adduser" ], "postinst-file": "deb/postinst.sh", "systemd-file": "deb/yubihsm-connector.service", "init-file": "deb/yubihsm-connector", "conf-files": ["/etc/!name!.yaml"] } yubihsm-connector-3.0.5/deb/yubihsm-connector.service0000664000175000017500000000113014667565502021746 0ustar aveenaveen; https://www.freedesktop.org/software/systemd/man/systemd.exec.html ; https://www.freedesktop.org/software/systemd/man/systemd.service.html [Unit] Description=YubiHSM connector Documentation=https://developers.yubico.com/YubiHSM2/Component_Reference/yubihsm-connector/ After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service [Service] Restart=on-abnormal User=yubihsm-connector Group=yubihsm-connector ExecStart=/usr/bin/yubihsm-connector -c /etc/yubihsm-connector.yaml PrivateTmp=true ProtectHome=true ProtectSystem=full [Install] WantedBy=multi-user.target yubihsm-connector-3.0.5/deb/postinst.sh0000664000175000017500000000012014667565502017131 0ustar aveenaveenadduser --no-create-home --home /nonexistent --group --system yubihsm-connector yubihsm-connector-3.0.5/logging_syslog.go0000664000175000017500000000201714667565502017544 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // +build !windows package main import ( "log/syslog" log "github.com/sirupsen/logrus" logrus_syslog "github.com/sirupsen/logrus/hooks/syslog" ) func loggingInit(interactive bool) error { if interactive { log.SetFormatter(&log.TextFormatter{}) } else { log.SetFormatter(&log.JSONFormatter{}) hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "") if err != nil { return err } log.AddHook(hook) } return nil } yubihsm-connector-3.0.5/LICENSE0000664000175000017500000002205614667565502015201 0ustar aveenaveenApache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS yubihsm-connector-3.0.5/VERSION0000664000175000017500000000007714667565502015243 0ustar aveenaveen{ "major" : 3, "minor" : 0, "patch" : 5, "build" : 0 } yubihsm-connector-3.0.5/usb_windows.c0000664000175000017500000004464114667565502016707 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "usb_windows.h" const DWORD PIPE_WRITE = 0x01; const DWORD PIPE_READ = 0x81; #define safe_close_handle(X) if (X != INVALID_HANDLE_VALUE) { CloseHandle(X); } #define safe_free(X) if (X) { free(X); } #define safe_free_usb(X) if (X != INVALID_HANDLE_VALUE) { WinUsb_Free(X); } // For some reason, CGO isn't finding this declaration, despite all of the correct include // files and compiler flags being set (that I can think of). Copying the declaration here // allows us to work around this issue. WINBASEAPI int WINAPI CompareStringOrdinal( LPCWCH lpString1, _In_ int cchCount1, LPCWCH lpString2, _In_ int cchCount2, _In_ BOOL bIgnoreCase ); static DWORD GetDeviceInterfaceDetails( HDEVINFO deviceInfoSet, PSP_DEVINFO_DATA deviceInfoData, PSP_DEVICE_INTERFACE_DETAIL_DATA* deviceDetails ) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = { sizeof(SP_INTERFACE_DEVICE_DATA) }; PSP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData = NULL; DWORD error = ERROR_SUCCESS; ULONG requiredBytes = 0; assert(deviceInfoSet); assert(deviceInfoData); assert(deviceDetails); if (!SetupDiEnumDeviceInterfaces(deviceInfoSet, deviceInfoData, &GUID_DEVINTERFACE_USB_DEVICE, 0, &deviceInterfaceData)) { error = GetLastError(); printf("SetupDiEnumDeviceInterfaces failed with 0x%x\n", error); goto Cleanup; } // First call gets the size of the buffer needed. We expect it to fail with // ERROR_INSUFFICIENT_BUFFER. if (!SetupDiGetDeviceInterfaceDetail(deviceInfoSet, &deviceInterfaceData, NULL, 0, &requiredBytes, NULL)) { error = GetLastError(); if (error != ERROR_INSUFFICIENT_BUFFER) { printf("SetupDiGetDeviceInterfaceDetails(1) failed with 0x%x\n", error); goto Cleanup; } error = ERROR_SUCCESS; } else { // We SHOULD have failed with ERROR_INSUFFICIENT_BUFFER, but we didn't. No // sense in continuing. Fail with a generic failure code. assert(FALSE); error = ERROR_GEN_FAILURE; goto Cleanup; } assert(requiredBytes >= sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA)); deviceInterfaceDetailData = malloc(requiredBytes); if (!deviceInterfaceDetailData) { error = ERROR_OUTOFMEMORY; goto Cleanup; } deviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); // Since we should have the exact buffer size now, this call should succeed and // give us the device interface details (the device instance path). if (!SetupDiGetDeviceInterfaceDetail(deviceInfoSet, &deviceInterfaceData, deviceInterfaceDetailData, requiredBytes, NULL, NULL)) { error = GetLastError(); printf("SetupDiGetDeviceInterfaceDetails(2) failed with 0x%x\n", error); goto Cleanup; } *deviceDetails = deviceInterfaceDetailData; deviceInterfaceDetailData = NULL; Cleanup: safe_free(deviceInterfaceDetailData); return error; } static DWORD GetDeviceHandle(PTSTR devicePath, HANDLE* deviceHandle) { HANDLE devHandle = INVALID_HANDLE_VALUE; assert(devicePath); assert(deviceHandle); devHandle = CreateFile(devicePath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, // WinUsb requires overlapped I/O NULL); if (devHandle == INVALID_HANDLE_VALUE) { printf("CreateFile failed with 0x%x\n", GetLastError()); return GetLastError(); } *deviceHandle = devHandle; return ERROR_SUCCESS; } static BOOL IsMatchingDevice(WINUSB_INTERFACE_HANDLE interfaceHandle, int vendorId, int productId, char* serialNumber) { ULONG bytesTransferred = 0; USB_DEVICE_DESCRIPTOR deviceDescriptor = { 0 }; DWORD error = ERROR_SUCCESS; BYTE serialBuffer[MAXIMUM_USB_STRING_LENGTH] = { 0 }; // Maximum size of descriptor is 255 (struct size field is only a byte) PUSB_STRING_DESCRIPTOR serialDescriptor = NULL; ULONG serialLength = 0; WCHAR serialNumberBuffer[MAXIMUM_USB_STRING_LENGTH] = { 0 }; WCHAR wideSerialNumber[MAXIMUM_USB_STRING_LENGTH] = { 0 }; assert(interfaceHandle && (interfaceHandle != INVALID_HANDLE_VALUE)); // The USB_DEVICE_DESCRIPTOR contains the VID and PID, along with the descriptor // number for the device's serial number. if (!WinUsb_GetDescriptor(interfaceHandle, USB_DEVICE_DESCRIPTOR_TYPE, 0, 0x409, // English (PUCHAR)&deviceDescriptor, sizeof(deviceDescriptor), &bytesTransferred)) { error = GetLastError(); printf("WinUsb_GetDescriptor(DEVICE) failed with 0x%x\n", error); goto Cleanup; } // Regardless of whether a serial number was defined - we need to make sure this // is at least the same kind of device we're looking for. Do these checks first // as they're cheap. if ((deviceDescriptor.idVendor != (USHORT)vendorId) || (deviceDescriptor.idProduct != (USHORT)productId)) { error = ERROR_OBJECT_NOT_FOUND; goto Cleanup; } // If the user provided a serialNumber, we need to grab the string descriptor which // contains the string version of the serialNumber and compare the values after normalizing // both on UTF-16. if (serialNumber) { ZeroMemory(serialBuffer, sizeof(serialBuffer)); if (!WinUsb_GetDescriptor(interfaceHandle, USB_STRING_DESCRIPTOR_TYPE, deviceDescriptor.iSerialNumber, 0x409, // English (PUCHAR)serialBuffer, sizeof(serialBuffer), &bytesTransferred)) { error = GetLastError(); printf("WinUsb_GetDescriptor(STRING) failed with 0x%x\n", error); goto Cleanup; } // USB Strings are UTF-16LE. The length is 2 less than the whole descriptor // length, as per the USB spec (9.6.9 in USB 3.2 spec). Maximum size is 255. serialDescriptor = (PUSB_STRING_DESCRIPTOR)serialBuffer; serialLength = serialDescriptor->bLength - 2; // The USB spec is a bit ambiguous as to whether if a string descriptor is present // that it MUST contain string data. (9.5 and 9.6.9 in USB 3.2 spec) However, since // we've already matched against a Yubico device, we support serial numbers, so we // should assert that the serial number length is non-zero. assert(serialLength > 0); // We're being called from Go, which means the incoming serialNumber is actually // UTF-8 and not ASCII. Convert to UTF-16 so we can compare using CompareStringOrdinal. if (!MultiByteToWideChar(CP_UTF8, 0, serialNumber, -1, wideSerialNumber, 255)) { error = GetLastError(); printf("MultiByteToWideChar failed with 0x%x\n", error); goto Cleanup; } // Copy the device's serial number into a temporary buffer. StrinchCchCopyN will guarantee // that the copy is null-terminated, which let's us do a slightly easier string comparison below. if (FAILED(StringCchCopyN(serialNumberBuffer, 255, serialDescriptor->bString, serialLength))) { error = ERROR_INVALID_PARAMETER; printf("StringCchCopyN failed."); goto Cleanup; } // wideSerialNumber is the UTF-16 conversion of Go's serial number string. It's // guaranteed to be null-terminated. serialNumberBuffer is also guaranteed to // be null terminated (see above). Because of this, we'll let CompareStringOrdinal // find the string lengths as it sees fit (-1 as parameter) if (CompareStringOrdinal(wideSerialNumber, -1, serialNumberBuffer, -1, TRUE /* case insensitive */) != CSTR_EQUAL) { error = ERROR_OBJECT_NOT_FOUND; printf("CompareStringOrdinal failed with 0x%x\n", error); printf("WideSerialNumber: %S\n", wideSerialNumber); printf("Descriptor: %S\n", serialNumberBuffer); goto Cleanup; } } Cleanup: return error == ERROR_SUCCESS; } static DWORD GetUsbDevice(int vendorId, int productId, char* serialNumber, PDEVICE_CONTEXT ctx) { HANDLE deviceHandle = INVALID_HANDLE_VALUE; SP_DEVINFO_DATA deviceInfoData = { sizeof(SP_DEVINFO_DATA) }; HDEVINFO deviceInfoSet = INVALID_HANDLE_VALUE; PSP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData = NULL; DWORD error = ERROR_SUCCESS; WINUSB_INTERFACE_HANDLE interfaceHandle = INVALID_HANDLE_VALUE; assert(ctx); // Find all USB Devices (excluding roots, hubs, and hid devices) deviceInfoSet = SetupDiGetClassDevs(&GUID_DEVINTERFACE_USB_DEVICE, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); if (deviceInfoSet == INVALID_HANDLE_VALUE) { error = GetLastError(); printf("SetupDiGetClassDevs failed with 0x%x\n", error); goto Cleanup; } // Iterate through each device found, open it, and determine if it's the device we're looking for. // Errors here are treated as best effort. If we encounter a failure, simply clean up and continue // on to the next device. for (int index = 0; SetupDiEnumDeviceInfo(deviceInfoSet, index, &deviceInfoData); index++) { error = ERROR_SUCCESS; safe_free(deviceInterfaceDetailData); safe_close_handle(deviceHandle); safe_free_usb(interfaceHandle); error = GetDeviceInterfaceDetails(deviceInfoSet, &deviceInfoData, &deviceInterfaceDetailData); if (error == ERROR_NO_MORE_ITEMS) { // We've hit the end of our device list. We didn't find anything, so set the error // code to something more appropriate and exit. error = ERROR_OBJECT_NOT_FOUND; goto Cleanup; } else if (error != ERROR_SUCCESS) { // This is the one case where we do not skip the device. There's no reason SetupDi should // fail, so we don't want to get stuck in an infinite loop here. Better to just exit. goto Cleanup; } error = GetDeviceHandle(deviceInterfaceDetailData->DevicePath, &deviceHandle); if (error != ERROR_SUCCESS) { continue; } if (!WinUsb_Initialize(deviceHandle, &interfaceHandle)) { error = GetLastError(); interfaceHandle = INVALID_HANDLE_VALUE; // It isn't documented what interfaceHandle's value // would be on failure, so explicitly set it so we // can deterministically clean up if needed. // Only report interesting errors. if (error != ERROR_NOT_SUPPORTED && error != ERROR_SHARING_VIOLATION) { printf("WinUsb_Initialize failed with 0x%x\n", error); } continue; } if (!IsMatchingDevice(interfaceHandle, vendorId, productId, serialNumber)) { // Set an error in case this is the last iteration of the loop. error = ERROR_OBJECT_NOT_FOUND; continue; } { // we set up a dummy read with a 10ms timeout here, if the timeout is too // short this times out before it has time to complete. The reason for // doing this is that there might be data left in the device buffers from // earlier transactions, this should flush it. BYTE buf[4096]; ULONG transferred = 0; ULONG timeout = 10; if (!WinUsb_SetPipePolicy(interfaceHandle, PIPE_READ, PIPE_TRANSFER_TIMEOUT, sizeof(timeout), &timeout)) { error = GetLastError(); continue; } // we don't really care about what happens to this read request.. WinUsb_ReadPipe(interfaceHandle, PIPE_READ, buf, sizeof(buf), &transferred, 0); timeout = 0; if (!WinUsb_SetPipePolicy(interfaceHandle, PIPE_READ, PIPE_TRANSFER_TIMEOUT, sizeof(timeout), &timeout)) { error = GetLastError(); continue; } if (!WinUsb_SetPipePolicy(interfaceHandle, PIPE_WRITE, PIPE_TRANSFER_TIMEOUT, sizeof(timeout), &timeout)) { error = GetLastError(); continue; } // This is vitally important since it declares that ZLP should be sent when a message // would otherwise end on a packet boundary. if (!WinUsb_SetPipePolicy(interfaceHandle, PIPE_WRITE, SHORT_PACKET_TERMINATE, 1, (PVOID) "\x1")) { error = GetLastError(); continue; } } // Device found, break out of loop and return it. break; } if (error != ERROR_SUCCESS) { // We exited the loop above while in an error state, we need to clean up. goto Cleanup; } ctx->deviceHandle = deviceHandle; ctx->usbInterface = interfaceHandle; ctx->readPipe = PIPE_READ; ctx->writePipe = PIPE_WRITE; ctx->initialized = TRUE; deviceHandle = INVALID_HANDLE_VALUE; interfaceHandle = INVALID_HANDLE_VALUE; Cleanup: safe_free(deviceInterfaceDetailData); safe_close_handle(deviceHandle); safe_free_usb(interfaceHandle); if (deviceInfoSet != INVALID_HANDLE_VALUE) { SetupDiDestroyDeviceInfoList(deviceInfoSet); } return error; } DWORD usbOpen(int vendorId, int productId, char* serialNumber, PDEVICE_CONTEXT* device) { PDEVICE_CONTEXT ctx = NULL; DWORD error = ERROR_SUCCESS; if (!device) { error = ERROR_INVALID_PARAMETER; goto Cleanup; } *device = NULL; ctx = (PDEVICE_CONTEXT)malloc(sizeof(*ctx)); if (!ctx) { error = ERROR_OUTOFMEMORY; goto Cleanup; } ctx->deviceHandle = INVALID_HANDLE_VALUE; ctx->usbInterface = INVALID_HANDLE_VALUE; ctx->readPipe = 0; ctx->writePipe = 0; ctx->initialized = FALSE; error = GetUsbDevice(vendorId, productId, serialNumber, ctx); if (error != ERROR_SUCCESS) { printf("GetUsbDevice returned 0x%x\n", error); goto Cleanup; } *device = ctx; ctx = NULL; Cleanup: if (ctx) { if (ctx->deviceHandle != INVALID_HANDLE_VALUE) { CloseHandle(ctx->deviceHandle); } if (ctx->usbInterface != INVALID_HANDLE_VALUE) { WinUsb_Free(ctx->usbInterface); } } return error; } void usbClose(PDEVICE_CONTEXT* device) { PDEVICE_CONTEXT deref = NULL; if (!device) { return; } deref = *device; if (!deref) { return; } if (deref->initialized) { WinUsb_Free(deref->usbInterface); CloseHandle(deref->deviceHandle); deref->initialized = FALSE; } free(deref); *device = NULL; } DWORD usbCheck(PDEVICE_CONTEXT device, int vendorId, int productId) { if (!device || !device->initialized) { return ERROR_INVALID_STATE; } if (!IsMatchingDevice(device->usbInterface, vendorId, productId, NULL)) { return ERROR_OBJECT_NOT_FOUND; } return ERROR_SUCCESS; } DWORD usbWrite(PDEVICE_CONTEXT device, PUCHAR buffer, ULONG bufferSizeInBytes, PULONG bytesTransferred) { if (!device || !device->initialized) { return ERROR_INVALID_STATE; } if (!buffer || bufferSizeInBytes == 0) { return ERROR_INVALID_PARAMETER; } if (!WinUsb_WritePipe(device->usbInterface, device->writePipe, buffer, bufferSizeInBytes, bytesTransferred, NULL)) { return GetLastError(); } return ERROR_SUCCESS; } DWORD usbRead(PDEVICE_CONTEXT device, PUCHAR buffer, ULONG bufferSizeInBytes, PULONG bytesTransferred) { if (!device || !device->initialized) { return ERROR_INVALID_STATE; } if (!buffer || !bytesTransferred || bufferSizeInBytes == 0) { return ERROR_INVALID_PARAMETER; } if (!WinUsb_ReadPipe(device->usbInterface, device->readPipe, buffer, bufferSizeInBytes, bytesTransferred, NULL)) { return GetLastError(); } return ERROR_SUCCESS; } yubihsm-connector-3.0.5/usb_winusb.go0000664000175000017500000001034514667565502016701 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //go:build windows // +build windows package main import ( "fmt" "sync" "unsafe" log "github.com/sirupsen/logrus" ) // #cgo CFLAGS: -DUNICODE -D_UNICODE // #cgo LDFLAGS: -lwinusb -lsetupapi -luuid // #include "usb_windows.h" import "C" var device struct { ctx C.PDEVICE_CONTEXT mtx sync.Mutex } type C_DWORD C.DWORD func (e C_DWORD) Error() string { return fmt.Sprintf("Windows Error: 0x%x", uint(e)) } const ( SUCCESS C_DWORD = C.ERROR_SUCCESS ERROR_INVALID_STATE C_DWORD = C.ERROR_INVALID_STATE ERROR_INVALID_HANDLE C_DWORD = C.ERROR_INVALID_HANDLE ERROR_INVALID_PARAMETER C_DWORD = C.ERROR_INVALID_PARAMETER ERROR_OUTOFMEMORY C_DWORD = C.ERROR_OUTOFMEMORY ERROR_GEN_FAILURE C_DWORD = C.ERROR_GEN_FAILURE ERROR_OBJECT_NOT_FOUND C_DWORD = C.ERROR_OBJECT_NOT_FOUND ERROR_NOT_SUPPORTED C_DWORD = C.ERROR_NOT_SUPPORTED ERROR_SHARING_VIOLATION C_DWORD = C.ERROR_SHARING_VIOLATION ERROR_BAD_COMMAND C_DWORD = C.ERROR_BAD_COMMAND ) func winusbError(err C.DWORD) error { if err != C.ERROR_SUCCESS { return C_DWORD(err) } return nil } func usbopen(cid string, serial string) (err error) { if device.ctx != nil { log.WithField("Correlation-ID", cid).Debug("usb context already open") return nil } if serial != "" { cSerial := C.CString(serial) defer C.free(unsafe.Pointer(cSerial)) err = winusbError(C.usbOpen(0x1050, 0x0030, cSerial, &device.ctx)) } else { err = winusbError(C.usbOpen(0x1050, 0x0030, nil, &device.ctx)) } if device.ctx == nil { err = fmt.Errorf("device not found") } return err } func usbclose(cid string) { if device.ctx != nil { C.usbClose(&device.ctx) } } func usbreopen(cid string, why error, serial string) (err error) { log.WithFields(log.Fields{ "Correlation-ID": cid, "why": why, }).Debug("reopening usb context") usbclose(cid) return usbopen(cid, serial) } func usbCheck(cid string, serial string) (err error) { device.mtx.Lock() defer device.mtx.Unlock() if err = usbopen(cid, serial); err != nil { return err } for { if err = winusbError(C.usbCheck(device.ctx, 0x1050, 0x0030)); err != nil { log.WithFields(log.Fields{ "Correlation-ID": cid, "Error": err, }).Debug("Couldn't check usb context") if err = usbreopen(cid, err, serial); err != nil { return err } continue } break } return nil } func usbwrite(buf []byte, cid string) (err error) { var n C.ULONG if err = winusbError(C.usbWrite( device.ctx, (*C.UCHAR)(unsafe.Pointer(&buf[0])), C.ULONG(len(buf)), &n)); err != nil { goto out } out: log.WithFields(log.Fields{ "Correlation-ID": cid, "n": uint(n), "err": err, "len": len(buf), "buf": buf, }).Debug("usb endpoint write") return err } func usbread(cid string) (buf []byte, err error) { var n C.ULONG buf = make([]byte, 8192) if err = winusbError(C.usbRead( device.ctx, (*C.UCHAR)(unsafe.Pointer(&buf[0])), C.ULONG(len(buf)), &n)); err != nil { buf = buf[:0] goto out } buf = buf[:n] out: log.WithFields(log.Fields{ "Correlation-ID": cid, "n": uint(n), "err": err, "len": len(buf), "buf": buf, }).Debug("usb endpoint read") return buf, err } func usbProxy(req []byte, cid string, serial string) (resp []byte, err error) { device.mtx.Lock() defer device.mtx.Unlock() if err = usbopen(cid, serial); err != nil { return nil, err } for i := 0; i < 2; i++ { if err = usbwrite(req, cid); err != nil { if err2 := usbreopen(cid, err, serial); err2 != nil { return nil, err2 } continue } resp, err = usbread(cid) break } return resp, err } yubihsm-connector-3.0.5/README.adoc0000664000175000017500000000311314667565502015752 0ustar aveenaveen= YubiHSM Connector == Usage The connector is self documenting, peruse the `--help`'s. [source,console] ---- $ yubihsm-connector --help YubiHSM Connector Usage: yubihsm-connector [flags] yubihsm-connector [command] Available Commands: config service Flags: -c, --config string config file -d, --debug debug output Use "yubihsm-connector [command] --help" for more information about a command. ---- == Development === Dependencies - link:https://golang.org[golang (>=1.17)] - link:https://pre-commit.com[pre-commit] - link:https://libusb.info[libusb-1.0] === pre-commit [source,console] ---- $ pre-commit install ---- See the configured [hooks](.pre-commit-config.yaml) for details. === Building [source,console] ---- $ make ---- === Cross-compiling for Windows To make this work you need to have mingw-w64 installed. [source,console] ---- $ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build ---- === Linting [source,console] ---- $ make vet $ make fmt ---- === License .... Copyright 2016-2018 Yubico AB Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. .... yubihsm-connector-3.0.5/main.go0000664000175000017500000002400614667565502015444 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "context" "fmt" "net/http" "os" "os/signal" "path" "regexp" "runtime" "strings" "syscall" "time" yaml "gopkg.in/yaml.v3" "github.com/kardianos/service" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" ) var ( // Host header allowlisting hostHeaderAllowlisting bool hostHeaderAllowlist = []string{"localhost", "localhost.", "127.0.0.1", "[::1]"} ) type program struct { srv *http.Server } func (p *program) Start(s service.Service) error { addr := viper.GetString("listen") serial, _ := ensureSerial(viper.GetString("serial")) // already validated by Cobra p.srv = &http.Server{Addr: addr, ReadTimeout: 5 * time.Second} // Hard coded 5s timeout to prevent resource starvation http.HandleFunc("/connector/status", middlewareWrapper(func(w http.ResponseWriter, r *http.Request) { statusHandler(w, r, serial) })) http.HandleFunc("/connector/api", middlewareWrapper(func(w http.ResponseWriter, r *http.Request) { apiHandler(w, r, serial) })) if viper.GetBool("seccomp") { log.Warn("seccomp support has been deprecated and the flag will be removed in future versions") } tls := false cert := viper.GetString("cert") key := viper.GetString("key") if cert != "" && key != "" { tls = true } log.WithFields(log.Fields{ "pid": os.Getpid(), "listen": addr, "TLS": tls, }).Debug("takeoff") go func(tls bool) { if tls { if err := p.srv.ListenAndServeTLS(cert, key); err != nil { log.Printf("ListenAndServeTLS failure: %s", err) } } else { if err := p.srv.ListenAndServe(); err != nil { log.Printf("ListenAndServe failure: %s", err) } } }(tls) return nil } func (p *program) Stop(s service.Service) error { return p.srv.Shutdown(context.TODO()) } //go:generate go run version.in.go func main() { loggingInit(service.Interactive()) if !service.Interactive() { if runtime.GOOS == "windows" { viper.AddConfigPath(path.Join(os.Getenv("ProgramData"), "YubiHSM")) } else { // These paths will work for most UNIXy platforms. macOS may need something else. configPaths := [2]string{"/etc", "/usr/local/etc"} for _, configPath := range configPaths { viper.AddConfigPath(path.Join(configPath, "yubihsm")) } } } svcConfig := &service.Config{ Name: "yhconsrv", DisplayName: "YubiHSM Connector Service", Description: "Implements the http-usb interface for the YubiHSM", } prg := &program{} s, err := service.New(prg, svcConfig) if err != nil { log.Fatal(err) return } signalChannel := make(chan os.Signal, 1) signal.Notify(signalChannel, syscall.SIGINT, syscall.SIGTERM) go func() { signalEncountered := <-signalChannel log.Info("Shutting down.") // Put any process wide shutdown calls here usbclose("Process terminate") signal.Reset(signalEncountered) os.Exit(0) }() rootCmd := &cobra.Command{ Use: "yubihsm-connector", Long: `YubiHSM Connector v` + Version.String(), SilenceUsage: true, SilenceErrors: true, PersistentPreRun: func(cmd *cobra.Command, args []string) { config := viper.GetString("config") if config != "" { viper.SetConfigFile(config) } }, PreRunE: func(cmd *cobra.Command, args []string) (err error) { if err = viper.ReadInConfig(); err != nil { if _, ok := err.(viper.ConfigFileNotFoundError); !ok { return err } } if viper.GetBool("debug") { log.SetLevel(log.DebugLevel) } certkeyErr := fmt.Errorf("cert and key must both be specified") if viper.GetString("cert") != "" && viper.GetString("key") == "" { return certkeyErr } else if viper.GetString("cert") == "" && viper.GetString("key") != "" { return certkeyErr } serial, err := ensureSerial(viper.GetString("serial")) if err != nil { return err } log.WithFields(log.Fields{ "config": viper.ConfigFileUsed(), "pid": os.Getpid(), "seccomp": viper.GetBool("seccomp"), "syslog": viper.GetBool("syslog"), "version": Version.String(), "cert": viper.GetString("cert"), "key": viper.GetString("key"), "timeout": timeoutToMs(viper.GetUint32("timeout")), "serial": serial, }).Debug("preflight complete") return nil }, RunE: func(cmd *cobra.Command, args []string) (err error) { return s.Run() }, } rootCmd.PersistentFlags().StringP("config", "c", "", "config file") viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config")) rootCmd.PersistentFlags().BoolP("debug", "d", false, "debug output") viper.BindPFlag("debug", rootCmd.PersistentFlags().Lookup("debug")) rootCmd.PersistentFlags().BoolP("seccomp", "s", false, "enable seccomp") viper.BindPFlag("seccomp", rootCmd.PersistentFlags().Lookup("seccomp")) rootCmd.PersistentFlags().StringP("cert", "", "", "certificate (X509)") viper.BindPFlag("cert", rootCmd.PersistentFlags().Lookup("cert")) rootCmd.PersistentFlags().StringP("key", "", "", "certificate key") viper.BindPFlag("key", rootCmd.PersistentFlags().Lookup("key")) rootCmd.PersistentFlags().StringP("serial", "", "", "device serial") viper.BindPFlag("serial", rootCmd.PersistentFlags().Lookup("serial")) rootCmd.PersistentFlags().StringP("listen", "l", "localhost:12345", "listen address") viper.BindPFlag("listen", rootCmd.PersistentFlags().Lookup("listen")) rootCmd.PersistentFlags().BoolP("syslog", "L", false, "log to syslog/eventlog") viper.BindPFlag("syslog", rootCmd.PersistentFlags().Lookup("syslog")) rootCmd.PersistentFlags().BoolVar(&hostHeaderAllowlisting, "enable-host-header-allowlist", false, "Enable Host header allowlisting") viper.BindPFlag("enable-host-allowlist", rootCmd.PersistentFlags().Lookup("enable-host-header-allowlist")) rootCmd.PersistentFlags().StringSliceVar(&hostHeaderAllowlist, "host-header-allowlist", hostHeaderAllowlist, "Host header allowlist") viper.BindPFlag("host-allowlist", rootCmd.PersistentFlags().Lookup("host-header-allowlist")) rootCmd.PersistentFlags().Uint32P("timeout", "t", 0, "(DEPRECATED) USB operation timeout in milliseconds (default 0, never timeout)") viper.BindPFlag("timeout", rootCmd.PersistentFlags().Lookup("timeout")) configCmd := &cobra.Command{ Use: "config", Long: `YubiHSM Connector configuration Most configuration knobs for the connector are not available at the command line, and must be supplied via a configurtion file. listen: localhost:12345 syslog: false cert: /path/to/certificate.crt key: /path/to/certificate.key serial: 0123456789 `, } configCheckCmd := &cobra.Command{ Use: "check", Long: `Syntax check configuration`, SilenceErrors: true, SilenceUsage: true, Run: func(cmd *cobra.Command, args []string) { if err := viper.ReadInConfig(); err != nil { log.WithFields(log.Fields{ "error": err, "config": viper.ConfigFileUsed(), }).Fatal("syntax errors in configuration file") } else { log.Info("OK!") } }, } configGenCmd := &cobra.Command{ Use: "generate", Long: `Generate a skeleton configuration from default values`, SilenceErrors: true, SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) (err error) { var buf []byte config := viper.AllSettings() delete(config, "debug") delete(config, "config") delete(config, "seccomp") if buf, err = yaml.Marshal(&config); err != nil { return err } fmt.Fprintf(os.Stdout, "%s", buf) return nil }, } versionCmd := &cobra.Command{ Use: "version", Long: `Print program version`, SilenceErrors: true, SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) (err error) { fmt.Fprintf(os.Stdout, "%s\n", Version.String()) return nil }, } installCmd := &cobra.Command{ Use: "install", Long: "Install YubiHSM Connector service", RunE: func(cmd *cobra.Command, args []string) error { return s.Install() }, } uninstallCmd := &cobra.Command{ Use: "uninstall", Long: "Uninstall YubiHSM Connector service", RunE: func(cmd *cobra.Command, args []string) error { return s.Uninstall() }, } startCmd := &cobra.Command{ Use: "start", Long: "Starts YubiHSM Connector service", RunE: func(cmd *cobra.Command, args []string) error { return s.Start() }, } stopCmd := &cobra.Command{ Use: "stop", Long: "Stops YubiHSM Connector service", RunE: func(cmd *cobra.Command, args []string) error { return s.Stop() }, } restartCmd := &cobra.Command{ Use: "restart", Long: "Restarts YubiHSM Connector service", RunE: func(cmd *cobra.Command, args []string) error { return s.Restart() }, } configCmd.AddCommand(configCheckCmd, configGenCmd) rootCmd.AddCommand(configCmd) rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(installCmd) rootCmd.AddCommand(uninstallCmd) rootCmd.AddCommand(startCmd) rootCmd.AddCommand(stopCmd) rootCmd.AddCommand(restartCmd) viper.SetConfigName("yubihsm-connector") viper.SetEnvPrefix("YUBIHSM_CONNECTOR") viper.AutomaticEnv() if err := rootCmd.Execute(); err != nil { log.Fatal(err) } } // XXX(thorduri): Barf. var errInvalidSerial = fmt.Errorf("invalid device serial") func ensureSerial(s string) (string, error) { if s == "" { return "", nil } else if len(s) > 10 { return "", errInvalidSerial } n := 10 - len(s) s = fmt.Sprintf("%s%s", strings.Repeat("0", n), s) matched, err := regexp.MatchString("^[0-9]{10}$", s) if err != nil { return "", err } else if !matched { return "", errInvalidSerial } return s, nil } func timeoutToMs(t uint32) time.Duration { return time.Duration(t) * time.Millisecond } yubihsm-connector-3.0.5/Makefile0000664000175000017500000000152414667565502015631 0ustar aveenaveen# yubihsm-connector MAKEFLAGS += -s MAKEFLAGS += --no-builtin-rules .SUFFIXES: all: build gen: @go generate build: gen @go build -o bin/yubihsm-connector rebuild: clean build install: build install bin/yubihsm-connector /usr/local/bin cert: @./tools/generate-certificate run: build @./bin/yubihsm-connector -d srun: cert build @./bin/yubihsm-connector -d --cert=var/cert.crt --key=var/cert.key fmt: @go fmt vet: gen @go vet test: vet @go test -v docker-clean: @docker rmi yubico/yubihsm-connector docker-build: @docker build -t yubico/yubihsm-connector -f Dockerfile . docker-run: @docker run --rm -it --privileged -v ${PWD}:/yubihsm-connector -v /dev/bus/usb/:/dev/bus/usb/ -p 12345:12345 yubico/yubihsm-connector clean: @rm -rf bin/* pkg/* *.syso versioninfo.json version.go .PHONY: all build fmt vet test clean version yubihsm-connector-3.0.5/api.go0000664000175000017500000001363514667565502015277 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "fmt" "io/ioutil" "net/http" "os" "strings" "time" "github.com/google/uuid" log "github.com/sirupsen/logrus" "github.com/spf13/viper" ) func uuidv4() (string, error) { uuid, err := uuid.NewRandom() if err != nil { return "", err } return uuid.String(), nil } type statusReponse struct { http.ResponseWriter status int } func (r *statusReponse) Write(p []byte) (int, error) { if r.status == 0 { r.WriteHeader(http.StatusOK) } return r.ResponseWriter.Write(p) } func (r *statusReponse) WriteHeader(status int) { r.status = status r.ResponseWriter.WriteHeader(status) } func middlewareWrapper(next http.HandlerFunc) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error id := r.Header.Get("X-Request-ID") if id == "" { id, err = uuidv4() if err != nil { id = "-" } r.Header.Set("X-Request-ID", id) } ip := r.Header.Get("X-Real-IP") if ip == "" { s := strings.Split(r.RemoteAddr, ":") ip = s[0] r.Header.Set("X-Real-IP", ip) } clog := log.WithFields(log.Fields{ "X-Request-ID": id, "X-Real-IP": ip, "RemoteAddr": r.RemoteAddr, "Method": r.Method, "Content-Length": r.ContentLength, "Content-Type": r.Header.Get("Content-Type"), "User-Agent": r.UserAgent(), "URI": r.URL.RequestURI(), }) defer func() { if rcv := recover(); rcv != nil { clog.WithField("panic", rcv).Error("recovered from handler panic") http.Error( w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, ) } }() if hostHeaderAllowlisting && !validateHost(r.Host) { clog.WithField("host", r.Host).Error("host not in allowlist") http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) return } response := &statusReponse{ ResponseWriter: w, } response.Header().Add("X-Request-ID", id) now := time.Now() next.ServeHTTP(response, r) latency := time.Since(now) fields := log.Fields{ "latency": latency, "StatusCode": response.status, } if response.status != http.StatusOK { clog.WithFields(fields).Error("error in handling request") } else { clog.WithFields(fields).Info("handled request") } }) } func statusHandler(w http.ResponseWriter, r *http.Request, serial string) { var err error if r.Method != "GET" { w.Header().Set("Allow", "GET") http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } cid := r.Header.Get("X-Request-ID") clog := log.WithFields(log.Fields{ "X-Request-ID": cid, }) var status string if err = usbCheck(cid, serial); err != nil { status = "NO_DEVICE" clog.WithError(err).Warn("status failed to open usb device") } else { status = "OK" } // Deal with address/port in ycshell. split := strings.Split(viper.GetString("listen"), ":") fmt.Fprintf(w, "status=%s\n", status) if serial == "" { fmt.Fprintf(w, "serial=*\n") } else { fmt.Fprintf(w, "serial=%s\n", serial) } fmt.Fprintf(w, "version=%s\n", Version.String()) fmt.Fprintf(w, "pid=%d\n", os.Getpid()) fmt.Fprintf(w, "address=%s\n", split[0]) fmt.Fprintf(w, "port=%s\n", split[1]) } func apiHandler(w http.ResponseWriter, r *http.Request, serial string) { var buf []byte var n int var err error const min_len = 3 // The minimum request is CMD (1 byte) + LEN (2 bytes) const max_len = 3136 + 3 // Allow 3 bytes more than the HSM can handle before returning http.StatusBadRequest cid := r.Header.Get("X-Request-ID") clog := log.WithFields(log.Fields{ "X-Request-ID": cid, }) if r.Method != "POST" { w.Header().Set("Allow", "POST") http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) return } if r.ContentLength < min_len || r.ContentLength > max_len { http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) return } if buf, err = ioutil.ReadAll(r.Body); err != nil { clog.WithError(err).Error("failed reading incoming request") http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } if buf, err = usbProxy(buf, cid, serial); err != nil { clog.WithError(err).Error("failed usb proxy") http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/octet-stream") if n, err = w.Write(buf); err != nil { clog.WithError(err).Error("failed response write") http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } if n != len(buf) { clog.WithError(err).WithFields(log.Fields{ "n": n, "len": len(buf), }).Error("partial response write") http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } } func extractHost(addr string) string { if strings.Contains(addr, ":") { idx := strings.LastIndex(addr, ":") idx2 := 0 // if this is a v6 adress we need to discover in a sane way if it has port or not if strings.Contains(addr, "]") { idx2 = strings.Index(addr, "]") } if idx > idx2 { addr = addr[:idx] } } return addr } func validateHost(addr string) bool { host := extractHost(addr) for _, h := range hostHeaderAllowlist { if h == host { return true } } return false } yubihsm-connector-3.0.5/main_test.go0000664000175000017500000000252014667565502016500 0ustar aveenaveen// Copyright 2016-2018 Yubico AB // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "testing" ) type ensureSerialTest struct { iserial string oserial string err error } var ensureSerialTests = []ensureSerialTest{ { "", "", nil, }, { "12345", "0000012345", nil, }, { "abcdef", "", errInvalidSerial, }, { "12345678901234567890", "", errInvalidSerial, }, { "-1", "", errInvalidSerial, }, } func TestEnsureSerial(t *testing.T) { for i, test := range ensureSerialTests { serial, err := ensureSerial(test.iserial) if err != test.err { t.Fatalf("ensureSerialTest %d: got %v: expected: %v", i, err, test.err) continue } else if err != nil { continue } if serial != test.oserial { t.Fatalf("ensureSerial %d: got %q: expected %q", i, serial, test.oserial) } } }