Giter VIP home page Giter VIP logo

csaf_distribution's People

Contributors

actions-user avatar bernhard-herzog avatar bernhardreiter avatar fadiabb avatar janhoefelmeyer avatar mfd2007 avatar s-l-teichmann avatar santosomar avatar tschmidtb51 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

csaf_distribution's Issues

Add more details to the output

From a user's perspective, it would be beneficial to have more details (or at least an option for it) in the output. It should include:

  • Information from the publisher object
  • role
  • Path of the provider-metadata.json found as link
  • whether the provider-metadata.json is valid
  • Path of the security.txt tested/found
  • whether ROLIE feeds exist, where and whether they are valid

Provider Setup

I found a few issues with the documentation of the provider setup:

TLP csaf can't be set as config

It looks like tlp=csaf is an invalid config option as it results in:

Errors:
	unsupported TLP type 'csaf'

Was that intended?

Restrict writing permission to client certificates from special CA

Only some valid TLS client certificate should allow an upload of information (e.g. access to the API and webinterface of the csaf_provider.)

Technically we need

  • a config option to set an Issuer
  • a compariston of this issuer to os.Getenv("SSL_CLIENT_I_DN") in cmd/csaf_provider/controller.go
  • and extension of the documentation that this CA has to be part of the general list of allowed CS in the ssl_client_certificate bundle of nginx.

CSAF uploader docs

Please align the table with the help function. E.g.

  • The --insecure flag seems to exist in the csaf_uploader but is not documented in the table.
  • -x gives more info in the help than the table has

Give usage information on bad invocation

Would be nice to give usage information if options or parameters fail or if -h or --help is given explitly at all.
Currently:

./csaf_checker -t html example.com -h
unknown flag `t'
2022/02/25 17:46:33 error: unknown flag `t'

So I need to call it all just with -h without extra parameters.
If -h is present it should be executed and then execution should stop.

Add --version option

Would be nice to use -v and --version to see which version of the binary I have.

technical considerations

We need one way to build this for released versions (if they are tagged and this is git we could take it from the tag)
and for development versions.

Allow protected client certificates

To authenticate with a TLS client certificate, the client needs to have access to the private key. Private keys can be protected by a passphrase. It should be possible to use such protected client certificates with the uploader.

Move standard provider configuration files to /etc/

Currently the config files for the provider are placed in /usr/lib/csaf, e.g. see (but also in other places)

defaultConfigPath = "/usr/lib/csaf/config.toml" // Default path to the config file.

As those config files are not likely to change in normal operations, they probably belong to /etc, either
/etc/csaf or /etc/csaf_provider at least that is my interpretation of https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

@s-l-teichmann what do you think?

Reflect correct role

The value of role in provider-metadata.json should be csaf_trusted_provider by default.

Expose config options

It looks like some options of the csaf_uploader can't be stored in the config (e.g. settings for interactive password). Is that correct? Shouldn't that be possible with password-interactive=true?

Provide ROLIE as prefered default.

For a correct CSAF Trusted Provider, only one method of providing several things is needed.

It would be nice to have an option to only publish as ROLIE and to have this option being activated by default.
Because ROLIE is considered the preferred way of publishing via CSAF-2.0 and by using it only, a Trusted Provider sets a good example for others.

Maybe out of scope for 1.0

Prevent parallel runs of csaf_aggregator

As protection against an overly long running process, another start of csaf_aggregator should be detected, prevented and warned about. This shall protect against two instances running and conflicting.

Build instructions sometimes fail

Using the current build instructions

 cd csaf_distribution
 go build -v ./cmd/...

there are sometimes no binaries build.
(Test done with go version go1.17.6 linux/amd64 and c57de75 (current head) )

Allow uploading with TLS client certificates

Allow the csaf_uploader to use a TLS Client certificate to authenticate itself to the csaf_provider API.

technical considerations

It is okay to use whatever can be more easily implemented when telling the tool which client certificate to take, one setting for the p12 format or two settings for key and cert.

Needs checking if this also works with client certificates which are password protected.

Implement download throttling based on documents per timeunit

Some CSAF providers may block an IP address if there are too many documents downloaded in a certain time frame.

To stay below this threshold, a config option in the checker and per provider in the aggreator shall limit the rate of how many documents are downloaded per time unit. E.g. in documents per minute.

Improve Error logging

We should improve the logging when using TLS client certificates. Even if I just access the WebUI I get a message in the log:

2022/04/08 17:30:26 [error] 11918#11918: *23 FastCGI sent in stderr: "2022/04/08 17:30:26 SSL_CLIENT_VERIFY: SUCCESS
2022/04/08 17:30:26 ca: C=DE,O=C=DE,O=CSAF Tools Development (internal),CN=Tester
2022/04/08 17:30:26 user: C=DE,O=CSAF Tools Development (internal),CN=TLS Uploader Client 1" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: xxxxxx.xxxx, request: "GET /cgi-bin/csaf_provider.go/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "xxxxxx.xxxx"

Improve error-handling by wrong config values

Noticed during #83 testing.

If the value of the category attribute in provide_metadata.publisher is not one of the allowed ones a 502 Bad Gateway error message is shown.
This message should be enhanced to indicate the error of wrong value for the category.

Write provider-metadata.json in compliance with CSD02 Schema

11ed0e8 changed the schema and thus the requirement and contents of the provider-metadata.json. Now our checker shows that the provider-metadata.json we have written with the provider does not validate with:

 "messages": [
  "https://localhost:8443/.well-known/csaf/provider-metadata.json: Validating against JSON schema failed:",
  "https://docs.oasis-open.org/csaf/csaf/v2.0/provider_json_schema.json#/additionalProperties: additionalProperties 'pgp_keys' not allowed",

so at least the pgp_keys have to be changed to public_openpgp_keys, but there maybe other changes.

@Fadiabb one for you?

Improve checking for new ROLIE possibilities

There are forthcoming changes towards CSAF-2.0 cs2 and it would be nice if the checker could check for the improved ROLIE values (in the area of hashes and sigs).

maybe out of scope for 1.0

Suggestion for requirement 10

It looks like the following config could work to fulfill requirement 10:

# Special DNS requirement
server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        ssl_certificate {SSL-CERT};
        ssl_certificate_key {SSL_KEY};

        root /var/www/domain;
        
        server_name csaf.data.security.domain.tld;

        location / {
                try_files /.well-known/csaf/provider-metadata.json =404;
        }

        access_log /var/log/nginx/dns-domain_access.log;
        error_log /var/log/nginx/dns-domain_error.log;

}

But maybe there is a better solution?

ROLIE feed is missing `feed` object

The ROLIE feeds currently generated by the csaf_provider are missing the surrounding feed element.

Expected output:

{
  "feed": {
    "id": "example-csaf-feed-tlp-white",
    "title": "Example CSAF feed (TLP:WHITE)",
    //...
  }
}

Current output:

{
  "id": "csaf-feed-tlp-white",
  "title": "CSAF feed (TLP:WHITE)",
  // ...
}

ROLIE feed category missing

The ROLIE feeds generated by the csaf_provider are missing the category field

"category": [ 
        {
          "scheme": "urn:ietf:params:rolie:category:information-type",
          "term": "csaf"
        }
      ]

which is required as per RFC 8322 Section 6.1.

Provide option to run mandatory tests

With secvisogram/csaf-validator-service a service exists that could run the business level test on CSAF documents and provide the information whether the document is valid. We should add a config option to send the CSAF document to such a service and parse the result. If isValid is true, the upload should proceed, otherwise an error should be thrown.
See the documentation for details on how to send the document and receive the response.

Update security.txt

It would be nice, if the security.txt is updated (adding the CSAF field) if it already exists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.