-
Notifications
You must be signed in to change notification settings - Fork 124
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
Set Puma Process Tag #2291
Set Puma Process Tag #2291
Conversation
2888597
to
ed45f02
Compare
cmd = "ps -ef | grep puma | grep -v grep | grep -v cluster | " \ | ||
"grep conjur | awk '{print $2}' | tr -d '\n'" | ||
stdout, _ = @command_runner.capture2(cmd) | ||
cmd ="ps -ef | " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer string interpolation to string concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is ok because it lets us add comments on each line to explain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may be able to use backslashes at the end of each line to make this go away. I don't think code climate counts this as concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtuttle, I couldn't figure out how to use \
and have comments in between. Is there a trick to this I couldn't find?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah shoot, no you're right that probably doesn't work. Might just have to approve the CC warning on this one.
"grep puma | " + | ||
# Filter to only puma process for the Conjur API Server. This tag | ||
# is defined in the `config/puma.rb`. | ||
"grep '[Conjur API Server]' | " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this worked for me only like this "grep '\\[Conjur API Server\\]' | "
. The current grep
will catch any line that has any letter of Conjur API Server
as the brackets act as regex square brackets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@micahlee i pushed this change so i can build a Conjur on RHEL instance and verified that updating /etc/conjur/config/conjur.yml
and adding authenticators works:
➜ dap-package git:(verify-puma-tag) ✗ ssh -i ~/oren-aws.pem [email protected]
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Thu Jun 24 09:02:40 2021 from 194.90.225.101
[ec2-user@ip-172-31-70-43 ~]$
[ec2-user@ip-172-31-70-43 ~]$
[ec2-user@ip-172-31-70-43 ~]$ sudo su
[root@ip-172-31-70-43 ec2-user]# evoke configuration apply
Conjur server reboot initiated. New configuration will be applied.
[root@ip-172-31-70-43 ec2-user]#
[root@ip-172-31-70-43 ec2-user]#
[root@ip-172-31-70-43 ec2-user]# curl -k https://localhost/info
{
"release": "12.2.0+Conjur.RHEL.CA",
"version": "5.14.1",
"services": {
"possum": {
"name": "conjur-possum",
"version": "1.11.7.32_f060df58",
"arch": "x86_64"
},
"evoke": {
"name": "conjur-evoke",
"version": "5.21.0.0_8546dc3",
# -----------------------------
"arch": "x86_64"
},
"ui": {
"name": "conjur-ui",
"version": "2.13.1.0_204e265c",
"arch": "x86_64"
}
},
"container": "ip-172-31-70-43.ec2.internal",
"role": "master",
"configuration": {
"conjur": {
"role": "master",
"account": "oren",
"hostname": "Oren-oren-1-lb-93042339.us-east-1.elb.amazonaws.com",
"master_altnames": [
"Oren-oren-1-lb-93042339.us-east-1.elb.amazonaws.com",
"ec2-18-206-81-135.compute-1.amazonaws.com",
"ec2-44-192-19-138.compute-1.amazonaws.com",
"ec2-35-175-120-54.compute-1.amazonaws.com"
],
"debug": true,
"cluster_name": "cluster_oren",
"cluster_master": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_members": "ec2-18-206-81-135.compute-1.amazonaws.com=http://ec2-18-206-81-135.compute-1.amazonaws.com:2380,ec2-35-175-120-54.compute-1.amazonaws.com=http://ec2-35-175-120-54.compute-1.amazonaws.com:2380,ec2-44-192-19-138.compute-1.amazonaws.com=http://ec2-44-192-19-138.compute-1.amazonaws.com:2380",
"cluster_machine_name": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_machine_address": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_ttl": 300,
"cluster_interval": 1
}
},
"authenticators": {
"installed": [
"authn",
"authn-azure",
"authn-gcp",
"authn-iam",
"authn-k8s",
"authn-ldap",
"authn-oidc"
],
"configured": [
"authn"
],
"enabled": [
"authn"
]
}
}[root@ip-172-31-70-43 ec2-user]# vi /etc/conjur/config/conjur.yml
[root@ip-172-31-70-43 ec2-user]# evoke configuration apply
Conjur server reboot initiated. New configuration will be applied.
[root@ip-172-31-70-43 ec2-user]# curl -k https://localhost/info
{
"release": "12.2.0+Conjur.RHEL.CA",
"version": "5.14.1",
"services": {
"possum": {
"name": "conjur-possum",
"version": "1.11.7.32_f060df58",
"arch": "x86_64"
},
"evoke": {
"name": "conjur-evoke",
"version": "5.21.0.0_8546dc3",
"arch": "x86_64"
},
"ui": {
"name": "conjur-ui",
"version": "2.13.1.0_204e265c",
"arch": "x86_64"
}
},
"container": "ip-172-31-70-43.ec2.internal",
"role": "master",
"configuration": {
"conjur": {
"role": "master",
"account": "oren",
"hostname": "Oren-oren-1-lb-93042339.us-east-1.elb.amazonaws.com",
"master_altnames": [
"Oren-oren-1-lb-93042339.us-east-1.elb.amazonaws.com",
"ec2-18-206-81-135.compute-1.amazonaws.com",
"ec2-44-192-19-138.compute-1.amazonaws.com",
"ec2-35-175-120-54.compute-1.amazonaws.com"
],
"debug": true,
"cluster_name": "cluster_oren",
"cluster_master": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_members": "ec2-18-206-81-135.compute-1.amazonaws.com=http://ec2-18-206-81-135.compute-1.amazonaws.com:2380,ec2-35-175-120-54.compute-1.amazonaws.com=http://ec2-35-175-120-54.compute-1.amazonaws.com:2380,ec2-44-192-19-138.compute-1.amazonaws.com=http://ec2-44-192-19-138.compute-1.amazonaws.com:2380",
"cluster_machine_name": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_machine_address": "ec2-18-206-81-135.compute-1.amazonaws.com",
"cluster_ttl": 300,
"cluster_interval": 1
}
},
"authenticators": {
"installed": [
"authn",
"authn-azure",
"authn-gcp",
"authn-iam",
"authn-k8s",
"authn-ldap",
"authn-oidc"
],
"configured": [
"authn"
],
"enabled": [
"authn-oidc/oren"
]
}
}
[root@ip-172-31-70-43 ec2-user]# cat /etc/conjur/config/conjur.yml
# -----------------------------
# Conjur configuration file
# -----------------------------
#
# This file configures Conjur settings in YAML format. These settings generally
# consist of lines in the form:
#
# name: value
#
# Comments are introduced with "#" anywhere on a line.
#
# The commented-out settings shown in this file represent the default values.
#
# These configuration values are loaded by the Conjur process at startup and can
# be overridden by providing environment variables of the same name prefixed by
# CONJUR. For example, you can override the trusted_proxies value from this
# file by setting CONJUR_TRUSTED_PROXIES in the environment.
# Trusted proxies ensures that DAP can properly source client IP addresses.
#
# This setting should be a list of IP addresses and/or IP address ranges in CIDR
# notation. For example:
#
# trusted_proxies:
# - 192.168.1.1
# - 127.0.0.1
# trusted_proxies: []
authenticators:
- authn-oidc/oren
# This is a placeholder key to allow AnywayConfig to parse this sample config
# file consisting only of comments. Once the following PR is merged and
# released, this will no longer be necessary:
# https://github.com/palkan/anyway_config/pull/83
_:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment for fixing the grep but this is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a much more reliable way to do this. Thanks for cleaning it up!
d6488b2
to
2965092
Compare
This allows us to reliably identify the Conjur API server process to restart when reloading the Conjur config.
2965092
to
1747480
Compare
Code Climate has analyzed commit 1747480 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 90.6% (0.0% change). View more on Code Climate. |
What does this PR do?
This PR updates the puma config to explicitly set the process tag, rather than defaulting to the directory name of the application. This allows us to reliably identify the process to restart it when reloading the Conjur configuration.
What ticket does this PR close?
Resolves ONYX-9564
Checklists
Change log
Test coverage
Documentation
README
s) were updated in this PR, and/or there is a follow-on issue to update docs, orAPI Changes