Skip to content

Instantly share code, notes, and snippets.

@tianyuan129
Last active February 9, 2022 18:47
Show Gist options
  • Save tianyuan129/2f1d0a1d858ddb4db734448d93a01486 to your computer and use it in GitHub Desktop.
Save tianyuan129/2f1d0a1d858ddb4db734448d93a01486 to your computer and use it in GitHub Desktop.
Demo Terminal Script on NDNCERT Client [testbed-deployment branch]
Script started on 2022-02-09 18:23:08+00:00 [TERM="xterm" TTY="/dev/pts/3" COLUMNS="120" LINES="30"]
# git clone https://github.com/UCLA-IRL/ndncert && cd ndncert && git checkout testbed-deployment
Cloning into 'ndncert'...
remote: Enumerating objects: 4454, done.
remote: Counting objects: 100% (440/440), done.
remote: Compressing objects: 100% (203/203), done.
remote: Total 4454 (delta 317), reused 346 (delta 235), pack-reused 4014
Receiving objects: 100% (4454/4454), 1.47 MiB | 8.50 MiB/s, done.
Resolving deltas: 100% (3557/3557), done.
Branch 'testbed-deployment' set up to track remote branch 'testbed-deployment' from 'origin'.
Switched to a new branch 'testbed-deployment'
# ./waf configure
Setting top to                           : /root/ndncert
Setting out to                           : /root/ndncert/build
Checking for 'g++' (C++ compiler)        : /usr/bin/g++
Checking C++ compiler version            : 9.3.0
Checking supported CXXFLAGS              : -std=c++14
Checking supported LINKFLAGS             : -fuse-ld=gold
Checking for program 'pkg-config'        : /usr/bin/pkg-config
Checking for 'libndn-cxx'                : yes
Checking for 'sqlite3'                   : yes
Checking for OpenSSL version             : OpenSSL 1.1.1f  31 Mar 2020
Checking if OpenSSL library works        : yes
Checking for program 'dpkg-architecture' : /usr/bin/dpkg-architecture
Checking boost includes                  : 1.71.0
Checking boost libs                      : boost_system boost_program_options boost_filesystem
Checking for boost linkage               : ok
Checking supported CXXFLAGS              : -O2 -g -pedantic -Wall -Wextra -Wcatch-value=2 -Wextra-semi -Wnon-virtual-dtor -Wno-unused-parameter -fdiagnostics-color
Checking supported LINKFLAGS             : -Wl,-O1
'configure' finished successfully (1.401s)
# ./waf
Waf: Entering directory `/root/ndncert/build'
[ 1/39] Compiling src/detail/info-encoder.cpp
[ 2/39] Compiling src/detail/ca-memory.cpp
[ 3/39] Compiling src/challenge/challenge-module.cpp
[ 4/39] Compiling src/ca-module.cpp
[ 5/39] Compiling src/requester-request.cpp
[ 6/39] Compiling src/detail/error-encoder.cpp
[ 7/39] Compiling src/redirection-predicate/redirection-predicate.cpp
[ 8/39] Compiling src/detail/crypto-helpers.cpp
[ 9/39] Compiling src/detail/ca-configuration.cpp
[10/39] Compiling src/redirection-predicate/redirection-param.cpp
[11/39] Compiling src/redirection-predicate/redirection-inst-email.cpp
[12/39] Compiling src/detail/challenge-encoder.cpp
[13/39] Compiling src/name-assignment/assignment-random.cpp
[14/39] Compiling src/challenge/challenge-email.cpp
[15/39] Compiling src/name-assignment/assignment-inst-email.cpp
[16/39] Compiling src/detail/ca-sqlite.cpp
[17/39] Compiling src/name-assignment/assignment-func.cpp
[18/39] Compiling src/challenge/challenge-pin.cpp
[19/39] Compiling src/detail/profile-storage.cpp
[20/39] Compiling src/detail/ca-profile.cpp
[21/39] Compiling src/detail/ndncert-common.cpp
[22/39] Compiling src/name-assignment/assignment-param.cpp
[23/39] Compiling src/detail/ca-storage.cpp
[24/39] Compiling src/challenge/challenge-possession.cpp
[25/39] Compiling src/name-assignment/assignment-hash.cpp
[26/39] Compiling src/detail/request-encoder.cpp
[27/39] Compiling src/detail/ca-request-state.cpp
[28/39] Compiling src/detail/probe-encoder.cpp
[29/39] Compiling tools/ndncert-client.cpp
[30/39] Compiling tools/ndncert-ca-server.cpp
[31/39] Compiling tools/ndncert-ca-status.cpp
[32/39] Compiling libndn-cert.pc.in
[33/39] Compiling ndncert-send-email-challenge.py
[34/39] Compiling systemd/ndncert-ca.service.in
In file included from ../src/redirection-predicate/redirection-predicate.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

In file included from ../src/redirection-predicate/redirection-inst-email.hpp:24,
                 from ../src/redirection-predicate/redirection-inst-email.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

../src/detail/crypto-helpers.cpp: In function ‘ndn::Block ndncert::encodeBlockWithAesGcm128(uint32_t, const uint8_t*, const uint8_t*, size_t, const uint8_t*, size_t, std::vector<unsigned char>&)’:
../src/detail/crypto-helpers.cpp:422:60: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  422 |     ndn::random::generateSecureBytes(encryptionIv.data(), 8);
      |                                                            ^
In file included from ../src/detail/crypto-helpers.cpp:30:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/detail/crypto-helpers.cpp:422:60: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  422 |     ndn::random::generateSecureBytes(encryptionIv.data(), 8);
      |                                                            ^
In file included from ../src/detail/crypto-helpers.cpp:30:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~

In file included from ../src/redirection-predicate/redirection-param.hpp:24,
                 from ../src/redirection-predicate/redirection-param.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

In file included from ../src/detail/ca-configuration.hpp:25,
                 from ../src/ca-module.hpp:24,
                 from ../tools/ndncert-ca-status.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

In file included from ../src/detail/ca-configuration.hpp:25,
                 from ../src/detail/ca-configuration.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

In file included from ../src/detail/ca-configuration.hpp:25,
                 from ../src/ca-module.hpp:24,
                 from ../src/ca-module.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -
../src/ca-module.cpp: In constructor ‘ndncert::ca::CaModule::CaModule(ndn::Face&, ndn::security::v2::KeyChain&, const string&, const string&)’:
../src/ca-module.cpp:54:57: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
   54 |   ndn::random::generateSecureBytes(m_requestIdGenKey, 32);
      |                                                         ^
In file included from ../src/ca-module.cpp:35:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/ca-module.cpp:54:57: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
   54 |   ndn::random::generateSecureBytes(m_requestIdGenKey, 32);
      |                                                         ^
In file included from ../src/ca-module.cpp:35:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/ca-module.cpp: In member function ‘void ndncert::ca::CaModule::onNewRenewRevoke(const ndn::Interest&, ndncert::RequestType)’:
../src/ca-module.cpp:341:60: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  341 |   ndn::random::generateSecureBytes(salt.data(), salt.size());
      |                                                            ^
In file included from ../src/ca-module.cpp:35:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/ca-module.cpp:341:60: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  341 |   ndn::random::generateSecureBytes(salt.data(), salt.size());
      |                                                            ^
In file included from ../src/ca-module.cpp:35:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~

../src/challenge/challenge-possession.cpp: In member function ‘virtual std::tuple<ndncert::ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > ndncert::ChallengePossession::handleChallengeRequest(const ndn::Block&, ndncert::ca::RequestState&)’:
../src/challenge/challenge-possession.cpp:123:61: warning: ‘void ndn::security::transform::PublicKey::loadPkcs8(const uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  123 |       key.loadPkcs8(pubKeyBuffer.data(), pubKeyBuffer.size());
      |                                                             ^
In file included from ../src/challenge/challenge-possession.cpp:23:
/usr/local/include/ndn-cxx/security/transform/public-key.hpp:72:3: note: declared here
   72 |   loadPkcs8(const uint8_t* buf, size_t size)
      |   ^~~~~~~~~
../src/challenge/challenge-possession.cpp:141:59: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  141 |     ndn::random::generateSecureBytes(secretCode.data(), 16);
      |                                                           ^
In file included from ../src/challenge/challenge-possession.cpp:26:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/challenge/challenge-possession.cpp:141:59: warning: ‘void ndn::random::generateSecureBytes(uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  141 |     ndn::random::generateSecureBytes(secretCode.data(), 16);
      |                                                           ^
In file included from ../src/challenge/challenge-possession.cpp:26:
/usr/local/include/ndn-cxx/util/random.hpp:62:1: note: declared here
   62 | generateSecureBytes(uint8_t* bytes, size_t size)
      | ^~~~~~~~~~~~~~~~~~~
../src/challenge/challenge-possession.cpp:162:59: warning: ‘void ndn::security::transform::PublicKey::loadPkcs8(const uint8_t*, size_t)’ is deprecated: use the overload that takes a span<> [-Wdeprecated-declarations]
  162 |     key.loadPkcs8(pubKeyBuffer.data(), pubKeyBuffer.size());
      |                                                           ^
In file included from ../src/challenge/challenge-possession.cpp:23:
/usr/local/include/ndn-cxx/security/transform/public-key.hpp:72:3: note: declared here
   72 |   loadPkcs8(const uint8_t* buf, size_t size)
      |   ^~~~~~~~~

In file included from ../src/detail/ca-configuration.hpp:25,
                 from ../src/ca-module.hpp:24,
                 from ../tools/ndncert-ca-server.cpp:21:
../src/redirection-predicate/redirection-predicate.hpp:33:67: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
   33 |   explicit RedirectionPredicate(const std::string& format = "") {};
      |                                                                   ^
      |                                                                   -

[35/39] Linking build/libndn-cert.so
[36/39] Linking build/bin/ndncert-client
[37/39] Linking build/bin/ndncert-ca-server
[38/39] Linking build/bin/ndncert-ca-status
[39/39] Symlinking build/libndn-cert.so
Waf: Leaving directory `/root/ndncert/build'
'build' finished successfully (16.790s)
# sudo ./waf install
Waf: Entering directory `/root/ndncert/build'
+ install /usr/local/lib/libndn-cert.so.0.1.0 (from build/libndn-cert.so)
- symlink /usr/local/lib/libndn-cert.so (to libndn-cert.so.0.1.0)
+ install /usr/local/lib/pkgconfig/libndn-cert.pc (from build/libndn-cert.pc)
+ install /usr/local/bin/ndncert-client (from build/bin/ndncert-client)
+ install /usr/local/bin/ndncert-ca-server (from build/bin/ndncert-ca-server)
+ install /usr/local/bin/ndncert-ca-status (from build/bin/ndncert-ca-status)
+ install /usr/local/include/ndncert/detail/ndncert-config.hpp (from build/src/detail/ndncert-config.hpp)
+ install /usr/local/etc/ndncert/ca.conf.sample (from ca.conf.sample)
+ install /usr/local/include/ndncert/ca-module.hpp (from src/ca-module.hpp)
+ install /usr/local/bin/ndncert-send-email-challenge (from build/bin/ndncert-send-email-challenge)
+ install /usr/local/etc/ndncert/client.conf.sample (from client.conf.sample)
+ install /usr/local/include/ndncert/challenge/challenge-email.hpp (from src/challenge/challenge-email.hpp)
+ install /usr/local/etc/ndncert/ndncert-mail.conf.sample (from ndncert-mail.conf.sample)
+ install /usr/local/include/ndncert/challenge/challenge-module.hpp (from src/challenge/challenge-module.hpp)
+ install /usr/local/include/ndncert/challenge/challenge-pin.hpp (from src/challenge/challenge-pin.hpp)
+ install /usr/local/include/ndncert/challenge/challenge-possession.hpp (from src/challenge/challenge-possession.hpp)
+ install /usr/local/include/ndncert/detail/ca-configuration.hpp (from src/detail/ca-configuration.hpp)
+ install /usr/local/include/ndncert/detail/ca-memory.hpp (from src/detail/ca-memory.hpp)
+ install /usr/local/include/ndncert/detail/ca-profile.hpp (from src/detail/ca-profile.hpp)
+ install /usr/local/include/ndncert/detail/ca-request-state.hpp (from src/detail/ca-request-state.hpp)
+ install /usr/local/include/ndncert/detail/ca-sqlite.hpp (from src/detail/ca-sqlite.hpp)
+ install /usr/local/include/ndncert/detail/ca-storage.hpp (from src/detail/ca-storage.hpp)
+ install /usr/local/include/ndncert/detail/challenge-encoder.hpp (from src/detail/challenge-encoder.hpp)
+ install /usr/local/include/ndncert/detail/crypto-helpers.hpp (from src/detail/crypto-helpers.hpp)
+ install /usr/local/include/ndncert/detail/error-encoder.hpp (from src/detail/error-encoder.hpp)
+ install /usr/local/include/ndncert/detail/info-encoder.hpp (from src/detail/info-encoder.hpp)
+ install /usr/local/include/ndncert/detail/ndncert-common.hpp (from src/detail/ndncert-common.hpp)
+ install /usr/local/include/ndncert/detail/probe-encoder.hpp (from src/detail/probe-encoder.hpp)
+ install /usr/local/include/ndncert/detail/profile-storage.hpp (from src/detail/profile-storage.hpp)
+ install /usr/local/include/ndncert/detail/request-encoder.hpp (from src/detail/request-encoder.hpp)
+ install /usr/local/include/ndncert/name-assignment/assignment-func.hpp (from src/name-assignment/assignment-func.hpp)
+ install /usr/local/include/ndncert/name-assignment/assignment-hash.hpp (from src/name-assignment/assignment-hash.hpp)
+ install /usr/local/include/ndncert/name-assignment/assignment-inst-email.hpp (from src/name-assignment/assignment-inst-email.hpp)
+ install /usr/local/include/ndncert/name-assignment/assignment-param.hpp (from src/name-assignment/assignment-param.hpp)
+ install /usr/local/include/ndncert/name-assignment/assignment-random.hpp (from src/name-assignment/assignment-random.hpp)
+ install /usr/local/include/ndncert/redirection-predicate/redirection-inst-email.hpp (from src/redirection-predicate/redirection-inst-email.hpp)
+ install /usr/local/include/ndncert/redirection-predicate/redirection-param.hpp (from src/redirection-predicate/redirection-param.hpp)
+ install /usr/local/include/ndncert/redirection-predicate/redirection-predicate.hpp (from src/redirection-predicate/redirection-predicate.hpp)
+ install /usr/local/include/ndncert/requester-request.hpp (from src/requester-request.hpp)
Waf: Leaving directory `/root/ndncert/build'
'install' finished successfully (0.410s)
# sudo ldconfig
# sudo cp /usr/local/etc/ndncert/client.conf.sample /usr/local/etc/ndncert/client.conf
# nfd-start
NFD is already running...
# ndn-autoconfig
Starting multicast discovery stage
Stage multicast discovery succeeded with udp4://suns.cs.ucla.edu
Already connected to HUB udp4://131.179.196.48:6363
Registered prefix /
Registered prefix /localhop/nfd
# ndncert-client
***************************************
Step 1: CA SELECTION
> Index: 0
>> CA prefix:/ndncert-demo
>> Introduction: NDN Testbed NDNCERT CA (Demo)
Please type in the CA's index that you want to apply or type in NONE if your expected CA is not in the list:
0

***************************************
Step 2: Please provide information for name assignment
Please input: email
tianyuan@cs.ucla.edu
Got it. This is what you've provided:
email : tianyuan@cs.ucla.edu
You will be redirected to CA: /ndncert-demo/edu/ucla
You are assigned to name: /ndncert-demo/edu/ucla/cs/tianyuan

***************************************
Step 3: Please type in your expected validity period of your certificate. Type the number of hours (168 for week, 730 for month, 8760 for year). The CA may reject your application if your expected period is too long.
168
The validity period of your certificate will be: 168 hours

***************************************
Step 4: Please provide parameters used for Identity Verification Challenge
Please input your verification code
750485
Got it. This is what you've provided:
code : 750485
Certificate has already been issued, downloading certificate...

***************************************
Step 4: DONE
Certificate with Name: /ndncert-demo/edu/ucla/cs/tianyuan/KEY/K1%AE%E7%8C8%B7%CE/NDNCERT/9008410142180777144 has already been installed to your local keychain
Exit now# exit

Script done on 2022-02-09 18:25:26+00:00 [COMMAND_EXIT_CODE="0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment