mirror of
https://github.com/trufflesecurity/xsshunter
synced 2025-02-16 05:18:36 +00:00
trying to get ssl
This commit is contained in:
parent
53e6fefb18
commit
94a1f74516
3 changed files with 7 additions and 6 deletions
7
app.js
7
app.js
|
@ -17,11 +17,9 @@ const api = require('./api.js');
|
|||
const validate = require('express-jsonschema').validate;
|
||||
const constants = require('./constants.js');
|
||||
const {google} = require('googleapis');
|
||||
|
||||
|
||||
const {OAuth2Client} = require('google-auth-library');
|
||||
const client = new OAuth2Client(process.env.CLIENT_ID, process.env.CLIENT_SECRET, `https://${process.env.HOSTNAME}/oauth-login`);
|
||||
|
||||
const client = new OAuth2Client(process.env.CLIENT_ID, process.env.CLIENT_SECRET, `https://${process.env.HOSTNAME}/oauth-login`);
|
||||
|
||||
function set_secure_headers(req, res) {
|
||||
res.set("X-XSS-Protection", "mode=block");
|
||||
|
@ -290,8 +288,9 @@ async function get_app_server() {
|
|||
client.setCredentials(tokens);
|
||||
const oauth2 = google.oauth2({version: 'v2', auth: client});
|
||||
const email = await oauth2.userinfo.v2.me.get();
|
||||
req.session.authenticated = true;
|
||||
req.session.email = email.data.email;
|
||||
res.send(`Hello ${email.data.email}!`);
|
||||
|
||||
} catch (error) {
|
||||
console.log(`Error Occured: ${error}`);
|
||||
res.status(500).send("Error Occured");
|
||||
|
|
|
@ -9,6 +9,8 @@ services:
|
|||
# SSL will automatically be set up and
|
||||
# renewed with LetsEncrypt.
|
||||
- HOSTNAME=your.host.name
|
||||
# THis hostname is where your JS is served out of
|
||||
- XSS_HOSTNAME=your.xss.domain
|
||||
# [REQUIRED] Email for SSL
|
||||
- SSL_CONTACT_EMAIL=YourEmail@gmail.com
|
||||
# Maximum XSS callback payload size
|
||||
|
|
|
@ -3,7 +3,7 @@ echo "Initializing SSL/TLS..."
|
|||
# Set up Greenlock
|
||||
# Test if --maintainer-email is required, we can set it via environment variables...
|
||||
npx greenlock init --config-dir /app/greenlock.d --maintainer-email $SSL_CONTACT_EMAIL
|
||||
npx greenlock add --subject $HOSTNAME --altnames "$HOSTNAME"
|
||||
npx greenlock add --subject $HOSTNAME --altnames "*.$XSS_HOSTNAME"
|
||||
|
||||
echo "Starting server..."
|
||||
node server.js
|
||||
node server.js
|
||||
|
|
Loading…
Add table
Reference in a new issue