rust-pcap / pcap

Rust language pcap library
Apache License 2.0
595 stars 138 forks source link

Setting up the CI/CD workflow for Npcap #290

Closed GyulyVGC closed 1 year ago

GyulyVGC commented 1 year ago

Hi! I would like to set up a workflow involving the use of Npcap for Windows tests. I noticed that you use the Npcap OEM to do so. I already obtained a Npcap OEM version from the nmap team, but I’m struggling to figure out what secrets should I use as my username and password, since Npcap doesn’t require any credential to be created. Could you please explain me what credentials did you use/where did you retrieve them? Thanks in advance!

stappersg commented 1 year ago

To me is

Npcap doesn’t require any credential to be created

the reason to ignore the

please explain me what credentials did you use

GyulyVGC commented 1 year ago

To me is

Npcap doesn’t require any credential to be created

the reason to ignore the

please explain me what credentials did you use

If you look in this this file they use a password and a username, I just don’t understand where they come from.

stappersg commented 1 year ago

(Please do read and underderstand http://www.catb.org/~esr/faqs/smart-questions.html )

What happens when the

    secrets:
      NPCAP_OEM_PASSWORD:
        required: true
      NPCAP_OEM_USERNAME:
        required: true

is removed?

GyulyVGC commented 1 year ago

What happens is that obviously they are not required anymore, but if I do not insert them I cannot invoke that web request apparently, so I don’t get your point.

stappersg commented 1 year ago

Acknowledge on removing those lines is not the progress we where hoping for.

(Regarding "What is your point?": The issue that you reported was not completely ignored.)

Wojtek242 commented 1 year ago

Hi! I would like to set up a workflow involving the use of Npcap for Windows tests. I noticed that you use the Npcap OEM to do so. I already obtained a Npcap OEM version from the nmap team, but I’m struggling to figure out what secrets should I use as my username and password, since Npcap doesn’t require any credential to be created. Could you please explain me what credentials did you use/where did you retrieve them? Thanks in advance!

Hi @GyulyVGC, I'm a bit confused by the question. If you obtained the Npcap OEM, you should have received a username and password from the Npcap team. If you don't have a username and password from the npcap team, then are you sure you have the OEM version?

@stappersg whilst I appreciate you trying to be helpful, could I ask you to please refrain from responding to issues in this repository which are not in your area of expertise? Asking the poster to clarify their question is not always helpful if you do not have the expertise to resolve the issue with the provided information. Your help is most welcome on issues which match your technical/code expertise.

GyulyVGC commented 1 year ago

Hi! I would like to set up a workflow involving the use of Npcap for Windows tests. I noticed that you use the Npcap OEM to do so. I already obtained a Npcap OEM version from the nmap team, but I’m struggling to figure out what secrets should I use as my username and password, since Npcap doesn’t require any credential to be created. Could you please explain me what credentials did you use/where did you retrieve them? Thanks in advance!

Hi @GyulyVGC, I'm a bit confused by the question. If you obtained the Npcap OEM, you should have received a username and password from the Npcap team. If you don't have a username and password from the npcap team, then are you sure you have the OEM version?

@stappersg whilst I appreciate you trying to be helpful, could I ask you to please refrain from responding to issues in this repository which are not in your area of expertise? Asking the poster to clarify their question is not always helpful if you do not have the expertise to resolve the issue with the provided information. Your help is most welcome on issues which match your technical/code expertise.

Thanks for your response! Yes, I have the OEM version; I've asked them via mail and then they sent an executable for the OEM raccomending me to not share it ofc. I have then asked for username and password and I've been said that they do not require it and that he was not really aware of how these kind of workflows works.

BTW, I followed what @Trolldemorted did in issue #134 and I contacted @fyodor (member of the nmap team) asking for an OEM version for CI/CD and I got the response I wrote before.

Wojtek242 commented 1 year ago

Yes, I have the OEM version; I've asked them via mail and then they sent an executable for the OEM raccomending me to not share it ofc. I have then asked for username and password and I've been said that they do not require it and that he was not really aware of how these kind of workflows works.

Ah sorry, then I cannot help you, because that's not what we do in this repository. We received both a username and password which are injected into the CI via the secrets.

I will close this issue, as I don't think there is any follow-up from our side, but if you have anymore questions, please feel free to ask.

GyulyVGC commented 1 year ago

Yeah, actually its not a problem of your side. I was just asking to figure out how you obtained it, but apparently we were given two different ways of obtaining the OEM. Thanks anyway for your support.

fyodor commented 1 year ago

Yes, we created a download account for the Rust Pcap Bindings team where their username and password are the secret credentials, whereas for @GyulyVGC of Sniffnet we created a private download URL for Npcap OEM Version 1.72 where the URL itself is the secret. I haven't set up Github's CI and secret systems myself, but presumably @GyulyVGC should modify their ci-steps.yml to create an NPCAP_OEM_URL secret instead of NPCAP_OEM_USERNAME and NPCAP_OEM_PASSWORD. Obviously the Invoke-WebRequest lines would have to be modified accordingly.

GyulyVGC commented 1 year ago

I've finally managed to setup the Npcap CI/CD. Thanks guys!

stappersg commented 1 year ago

I've finally managed to setup the Npcap CI/CD. Thanks guys!

A much nicer thanks would be documenting how to reproduce it.

GyulyVGC commented 1 year ago

I've finally managed to setup the Npcap CI/CD. Thanks guys!

A much nicer thanks would be documenting how to reproduce it.

Following the suggestion of mister @stappersg, here you are the file with the workflow!

stappersg commented 1 year ago

So probably this:

  workflow_call:
    secrets:
      NPCAP_OEM_URL:
        required: true
  Windows:
    name: Windows Tests
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v3
    - name: Install npcap sdk
      run: |
            Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip"
            Expand-Archive -LiteralPath C:/npcap-sdk.zip -DestinationPath C:/npcap-sdk
            echo "LIB=C:/npcap-sdk/Lib/x64" >> $env:GITHUB_ENV
    - name: Install npcap dll
      # Secrets are not passed to workflows that are triggered by a pull request from a fork.
      # https://docs.github.com/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets
      if: github.event_name != 'pull_request'
      run: |
            Invoke-WebRequest -Uri ${{secrets.NPCAP_OEM_URL}} -OutFile C:/npcap-oem.exe
            C:/npcap-oem.exe /S
    - name: Build
      if: github.event_name != 'pull_request'
      run: cargo build --verbose
    - name: Run tests
      if: github.event_name != 'pull_request'
      run: cargo test --verbose
GyulyVGC commented 1 year ago

Hi @fyodor. If you don't remember about me, I'm the guy you gave access to an OEM link of Npcap some times ago (I'm using it exclusively to run CI/CD at the moment).

Could you kindly clarify us about the scope of allowed applications of the OEM? (see our discussion). Can you confirm that we are allowed to silently install Npcap on the target machine of our users?

@4r7if3x

fyodor commented 1 year ago

Hi @GyulyVGC. We provided you the free copy of Npcap OEM just for your organization's CI/CD usage, not for redistribution to your users. The good news is that you can still link your project with the Npcap SDK and your users can then download and install the free or paid version of Npcap depending on their needs. Please see my more detailed answer here.

GyulyVGC commented 1 year ago

Yep, I understood it right the first time then.

Thanks for the answers!