2019-01-07 01:25:33 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
2017-01-20 17:52:57 +00:00
|
|
|
|
|
|
|
|
import Button from 'components/buttons/Button';
|
|
|
|
|
import Icon from 'components/icons/Icon';
|
|
|
|
|
import InputField from 'components/forms/fields/InputField';
|
|
|
|
|
import { renderFlash } from 'redux/nodes/notifications/actions';
|
2018-07-17 18:27:30 +00:00
|
|
|
import {
|
|
|
|
|
copyText,
|
|
|
|
|
COPY_TEXT_SUCCESS,
|
|
|
|
|
COPY_TEXT_ERROR,
|
|
|
|
|
} from 'utilities/copy_text';
|
2017-01-20 17:52:57 +00:00
|
|
|
import certificate from '../../../../assets/images/osquery-certificate.svg';
|
|
|
|
|
|
|
|
|
|
const baseClass = 'add-host-modal';
|
|
|
|
|
|
|
|
|
|
class AddHostModal extends Component {
|
|
|
|
|
static propTypes = {
|
|
|
|
|
dispatch: PropTypes.func,
|
2017-01-21 01:16:00 +00:00
|
|
|
onFetchCertificate: PropTypes.func,
|
2017-01-20 17:52:57 +00:00
|
|
|
onReturnToApp: PropTypes.func,
|
2017-01-21 01:16:00 +00:00
|
|
|
osqueryEnrollSecret: PropTypes.string,
|
2017-01-20 17:52:57 +00:00
|
|
|
};
|
|
|
|
|
|
2018-07-17 18:27:30 +00:00
|
|
|
constructor(props) {
|
2017-01-20 17:52:57 +00:00
|
|
|
super(props);
|
|
|
|
|
|
2017-01-21 01:16:00 +00:00
|
|
|
this.state = { revealSecret: false };
|
2017-01-20 17:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onCopySecret = (elementClass) => {
|
|
|
|
|
return (evt) => {
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
|
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
|
|
|
|
|
if (copyText(elementClass)) {
|
2018-07-17 18:27:30 +00:00
|
|
|
dispatch(renderFlash('success', COPY_TEXT_SUCCESS));
|
2017-01-20 17:52:57 +00:00
|
|
|
} else {
|
|
|
|
|
this.setState({ revealSecret: true });
|
2018-07-17 18:27:30 +00:00
|
|
|
dispatch(renderFlash('error', COPY_TEXT_ERROR));
|
2017-01-20 17:52:57 +00:00
|
|
|
}
|
|
|
|
|
};
|
2018-07-17 18:27:30 +00:00
|
|
|
};
|
2017-01-20 17:52:57 +00:00
|
|
|
|
|
|
|
|
toggleSecret = (evt) => {
|
|
|
|
|
const { revealSecret } = this.state;
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
|
|
|
|
|
this.setState({ revealSecret: !revealSecret });
|
|
|
|
|
return false;
|
2018-07-17 18:27:30 +00:00
|
|
|
};
|
2017-01-20 17:52:57 +00:00
|
|
|
|
2018-07-17 18:27:30 +00:00
|
|
|
render() {
|
2017-01-21 01:16:00 +00:00
|
|
|
const { onCopySecret, toggleSecret } = this;
|
2017-01-20 17:52:57 +00:00
|
|
|
const { revealSecret } = this.state;
|
2018-07-17 18:27:30 +00:00
|
|
|
const {
|
|
|
|
|
onFetchCertificate,
|
|
|
|
|
onReturnToApp,
|
|
|
|
|
osqueryEnrollSecret,
|
|
|
|
|
} = this.props;
|
2017-01-20 17:52:57 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={baseClass}>
|
2018-07-17 18:27:30 +00:00
|
|
|
<p>
|
|
|
|
|
Follow the instructions below to add hosts to your Kolide Instance.
|
|
|
|
|
</p>
|
2017-01-20 17:52:57 +00:00
|
|
|
|
|
|
|
|
<div className={`${baseClass}__manual-install-header`}>
|
|
|
|
|
<Icon name="wrench-hand" />
|
|
|
|
|
<h2>Manual Install</h2>
|
2018-07-17 18:27:30 +00:00
|
|
|
<h3>
|
|
|
|
|
Fully Customize Your <strong>Osquery</strong> Installation
|
|
|
|
|
</h3>
|
2017-01-20 17:52:57 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className={`${baseClass}__manual-install-content`}>
|
|
|
|
|
<ol className={`${baseClass}__install-steps`}>
|
|
|
|
|
<li>
|
2018-07-17 18:27:30 +00:00
|
|
|
<h4>
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/kolide/fleet/blob/master/docs/infrastructure/adding-hosts-to-fleet.md"
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
Kolide / Osquery - Install Docs <Icon name="external-link" />
|
|
|
|
|
</a>
|
|
|
|
|
</h4>
|
|
|
|
|
<p>
|
|
|
|
|
In order to install <strong>osquery</strong> on a client you
|
|
|
|
|
will need the following information:
|
|
|
|
|
</p>
|
2017-01-20 17:52:57 +00:00
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<h4>Retrieve Osquery Enroll Secret</h4>
|
|
|
|
|
<p>
|
2017-09-06 15:18:59 +00:00
|
|
|
The following is your enroll secret:
|
2018-07-17 18:27:30 +00:00
|
|
|
<a
|
|
|
|
|
href="#revealSecret"
|
|
|
|
|
onClick={toggleSecret}
|
|
|
|
|
className={`${baseClass}__reveal-secret`}
|
|
|
|
|
>
|
|
|
|
|
{revealSecret ? 'Hide' : 'Reveal'} Secret
|
|
|
|
|
</a>
|
2017-01-20 17:52:57 +00:00
|
|
|
</p>
|
|
|
|
|
<div className={`${baseClass}__secret-wrapper`}>
|
|
|
|
|
<InputField
|
2017-02-07 14:31:03 +00:00
|
|
|
disabled
|
2017-01-20 17:52:57 +00:00
|
|
|
inputWrapperClass={`${baseClass}__secret-input`}
|
|
|
|
|
name="osqueryd-secret"
|
|
|
|
|
type={revealSecret ? 'text' : 'password'}
|
2017-01-21 01:16:00 +00:00
|
|
|
value={osqueryEnrollSecret}
|
2017-01-20 17:52:57 +00:00
|
|
|
/>
|
2018-07-17 18:27:30 +00:00
|
|
|
<Button
|
|
|
|
|
variant="unstyled"
|
|
|
|
|
className={`${baseClass}__secret-copy-icon`}
|
|
|
|
|
onClick={onCopySecret(`.${baseClass}__secret-input`)}
|
|
|
|
|
>
|
2017-01-20 17:52:57 +00:00
|
|
|
<Icon name="clipboard" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
2017-09-06 15:18:59 +00:00
|
|
|
<li>
|
|
|
|
|
<h4>Download Server Certificate (Optional)</h4>
|
2018-07-17 18:27:30 +00:00
|
|
|
<p>
|
|
|
|
|
If you use the native osquery TLS plugins, Osquery requires the
|
|
|
|
|
same TLS certificate that Kolide is using in order to
|
|
|
|
|
authenticate. You can fetch the certificate below:
|
|
|
|
|
</p>
|
2017-09-06 15:18:59 +00:00
|
|
|
<p className={`${baseClass}__download-cert`}>
|
|
|
|
|
<Button variant="unstyled" onClick={onFetchCertificate}>
|
|
|
|
|
<img src={certificate} role="presentation" />
|
|
|
|
|
<span>Fetch Kolide Certificate</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
2017-01-20 17:52:57 +00:00
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className={`${baseClass}__button-wrap`}>
|
|
|
|
|
<Button onClick={onReturnToApp} variant="success">
|
|
|
|
|
Return To App
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default AddHostModal;
|