Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renew info about TLS in http api #627

Merged
merged 3 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/acra-server/acra-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ import (
"syscall"
"time"

log "github.com/sirupsen/logrus"
bolt "go.etcd.io/bbolt"

"github.com/cossacklabs/acra/cmd"
"github.com/cossacklabs/acra/cmd/acra-server/common"
"github.com/cossacklabs/acra/crypto"
Expand All @@ -67,8 +70,6 @@ import (
"github.com/cossacklabs/acra/pseudonymization/storage"
"github.com/cossacklabs/acra/sqlparser"
"github.com/cossacklabs/acra/utils"
log "github.com/sirupsen/logrus"
bolt "go.etcd.io/bbolt"
)

var restartSignalsChannel chan os.Signal
Expand Down Expand Up @@ -141,7 +142,7 @@ func realMain() error {
scriptOnPoison := flag.String("poison_run_script_file", "", "On detecting poison record: log about poison record detection, execute script, return decrypted data")

enableHTTPAPI := flag.Bool("http_api_enable", false, "Enable HTTP API. Use together with --http_api_tls_transport_enable whenever possible.")
httpAPIUseTLS := flag.Bool("http_api_tls_transport_enable", false, "Enable HTTPS support for the API. Use together with the --http_api_enable. TLS configuration is the same as in the Acra Proxy.")
httpAPIUseTLS := flag.Bool("http_api_tls_transport_enable", false, "Enable HTTPS support for the API. Use together with the --http_api_enable. TLS configuration is the same as in the Acra Proxy. Starting from 0.96.0 the flag value will be true by default.")

network.RegisterTLSBaseArgs(flag.CommandLine)
network.RegisterTLSArgsForService(flag.CommandLine, false, "", network.ClientNameConstructorFunc())
Expand Down
2 changes: 1 addition & 1 deletion configs/acra-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ generate_markdown_args_table: false
# Enable HTTP API. Use together with --http_api_tls_transport_enable whenever possible.
http_api_enable: false

# Enable HTTPS support for the API. Use together with the --http_api_enable. TLS configuration is the same as in the Acra Proxy.
# Enable HTTPS support for the API. Use together with the --http_api_enable. TLS configuration is the same as in the Acra Proxy. Starting from 0.96.0 the flag value will be true by default.
http_api_tls_transport_enable: false

# Port for AcraServer for HTTP API
Expand Down
6 changes: 5 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,11 @@ def test_clearing(self):
# execute any query for loading key by acra
result = self.engine1.execute(sa.select([1]).limit(1))
result.fetchone()
with urlopen('http://localhost:{}/resetKeyStorage'.format(self.ACRASERVER_PORT + 1)) as response:

ssl_context = ssl.create_default_context(cafile=base.TEST_TLS_CA)
ssl_context.load_cert_chain(base.TEST_TLS_CLIENT_CERT, base.TEST_TLS_CLIENT_KEY)
ssl_context.check_hostname = True
with urlopen('https://localhost:{}/resetKeyStorage'.format(self.ACRASERVER_PORT + 1), context=ssl_context) as response:
self.assertEqual(response.status, 200)


Expand Down
1 change: 1 addition & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def get_acra_cli_args(self, acra_kwargs):
'acrastruct_injectedcell_enable': 'false' if self.WHOLECELL_MODE else 'true',
'd': 'true' if self.DEBUG_LOG else 'false',
'http_api_enable': 'true',
'http_api_tls_transport_enable': 'true',
'keystore_cache_on_start_enable': 'false',
'keys_dir': base.KEYS_FOLDER.name,
}
Expand Down