mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 10:56:28 +02:00
* install VuePress Plugin Tabs https://www.npmjs.com/package/vuepress-plugin-tabs * init Enterprise documentation section * replace Vuepress tab plugin now using https://github.com/superbiger/vuepress-plugin-tabs * init Enterprise Quickstart * block of enterprise doc updates * Helm Quickstart Update (#2380) * removed/fixed redundant or incorrect config And some small copy edits * Update docs/docs/quick-start/helm.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * init console with helm doc * squash me * codeblock fix * init about page * updates to Enterprise section * consolidate on Postgres * WIP helm updates * update and align OS and Enterprise helm docs * Enterprise settings docs (#2397) * init console-specific reference docs files * remove shortdoc for name * init Enterprise Reference doc * expanding Enterprise Reference * init JS script for reference subpages When reviewing please remember that I'm not a developer, be kind * update script and apply * remove errant dep * document script and expand for CLI help output * import pomerium-console_serve.yaml In future iterations, this file should be sourced at build time as an artifact from the pomerium-console repo * init new output file * update script call and output * fix anchor links * BROKEN - import content from settings.yaml when dupe is true * filtering WiP * fix dupe script, more content * replace if dupe with if not docs * squash me * squash me! * add docs about PPL (#2404) * squash meeeeee * Update docs/enterprise/install/quickstart.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * symlink img dir from docs/reference * squash mee * update install reqs * Fixed links throughout * Update docs/enterprise/install/quickstart.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * Update docs/enterprise/install/quickstart.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * remove internal note * - format python with black - format js with prettier Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com> * optimize images with imageOptim Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com> * run prettier on config.js Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com> * concepts.md Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com> * update concepts Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com> * copy edits * typo * symlink img dir from docs/reference * modify TLS section in quick-start * rm whitespace * add common links postamble * block of updates * block of updates * updates with @travisgroth * turtles all the way down * more content * import all the things * fill out reports * fill out reports * fix file extension * fix links * crosslink PPL ref * document embedded prometheus * expand example * update reqs * document non-directory users * typo fix * update metrics_address * fix broken links in example configs * update examples for route syntax * replaced required with deprecated Note that I didn't link to the route reference because I'm unsure what link formats are accepted when this file is used elsewhere. The warning block below includes a link. * update enterprise/about * Update docs/enterprise/console-settings.yaml Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/console-settings.yaml Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * remove commented config lines * update non-domain user section in concepts * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/about.md Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * Update docs/enterprise/concepts.md Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> * add console route to OSS conf * update enterprise settings copy from source file * Update docs/enterprise/concepts.md * Update reports reference * merge conflict resolution * update sourced doc content, fix whitespace Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com> Co-authored-by: Bobby DeSimone <bobbydesimone@gmail.com> Co-authored-by: bobby <1544881+desimone@users.noreply.github.com>
139 lines
5 KiB
Markdown
139 lines
5 KiB
Markdown
---
|
|
title: code-server
|
|
lang: en-US
|
|
meta:
|
|
- name: keywords
|
|
content: >-
|
|
pomerium identity-access-proxy visual-studio-code visual studio code
|
|
authentication authorization
|
|
description: >-
|
|
This guide covers how to add authentication and authorization to a hosted,
|
|
fully, online instance of visual studio code.
|
|
---
|
|
|
|
# Securing Visual Studio Code Server
|
|
|
|
## Background
|
|
|
|
This guide covers using Pomerium to secure an instance of [code-server]. Pomerium is an identity-aware access proxy that can add single-sign-on / access control to any service, including visual studio code.
|
|
|
|
### Visual Studio Code
|
|
|
|
[Visual Studio Code] is an open source code editor by Microsoft that has become [incredibly popular](https://insights.stackoverflow.com/survey/2019#technology-_-most-popular-development-environments) in the last few years. For many developers, [Visual Studio Code] hits the sweet spot between no frills editors like vim/emacs and full feature IDE's like Eclipse and IntelliJ. VS Code offers some of the creature comforts like intellisense, git integration, and plugins, while staying relatively lightweight.
|
|
|
|
One of the interesting attributes of [Visual Studio Code] is that it is built on the [Electron](https://en.wikipedia.org/wiki/Electron_(software_framework)) framework which uses a headless instance of Chrome rendered as a desktop application. It didn't take long for folks to realize that if we already had this great IDE written in Javascript, it may be possible to make [Visual Studio Code] run remotely.
|
|
|
|
> "Any application that can be written in JavaScript, will eventually be written in JavaScript." -- [Jeff Atwood](https://blog.codinghorror.com/the-principle-of-least-power/)
|
|
|
|
### code-server
|
|
|
|
[code-server] is an open-source project that allows you to run [Visual Studio Code] on a **remote** server, through the browser. For example, this is a screenshot taken at the end of this tutorial.
|
|
|
|

|
|
|
|
## Pre-requisites
|
|
|
|
This guide assumes you have already completed one of the [install] guides, and have a working instance of Pomerium up and running. For purpose of this guide, I'm going to use docker-compose, though any other deployment method would work equally well.
|
|
|
|
## Configure
|
|
|
|
### Pomerium Config
|
|
|
|
```
|
|
# config.yaml
|
|
# See detailed configuration settings : https://www.pomerium.com/docs/reference/
|
|
|
|
authenticate_service_url: https://authenticate.corp.domain.example
|
|
|
|
# identity provider settings : https://www.pomerium.com/docs/identity-providers.html
|
|
idp_provider: google
|
|
idp_client_id: REPLACE_ME
|
|
idp_client_secret: REPLACE_ME
|
|
|
|
routes:
|
|
- from: https://code.corp.domain.example
|
|
to: http://codeserver:8080
|
|
policy:
|
|
- allow:
|
|
or:
|
|
- email:
|
|
is: user@example.com
|
|
allow_websockets: true
|
|
```
|
|
|
|
### Docker-compose
|
|
|
|
```yaml
|
|
codeserver:
|
|
image: codercom/code-server:latest
|
|
restart: always
|
|
ports:
|
|
- 8080:8080
|
|
volumes:
|
|
- ./code-server:/home/coder/project
|
|
command: --auth none --disable-telemetry /home/coder/project
|
|
```
|
|
|
|
### That's it
|
|
|
|
Simply navigate to your domain (e.g. `https://code.corp.domain.example`).
|
|
|
|

|
|
|
|
### (Example) Develop Pomerium in Pomerium
|
|
|
|
As a final touch, now that we've done all this work we might as well use our new development environment to write some real, actual code. And what better project is there than Pomerium? 😉
|
|
|
|
To build Pomerium, we must [install go](https://golang.org/doc/install) which is as simple as running the following commands in the [integrated terminal].
|
|
|
|
```bash
|
|
# install dependencies with apt
|
|
sudo apt-get update && sudo apt-get install -y wget make zip
|
|
|
|
# download go
|
|
wget https://golang.org/dl/go1.16.4.linux-amd64.tar.gz
|
|
sudo tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz
|
|
```
|
|
|
|
Then add Go to our [PATH].
|
|
|
|
```bash
|
|
# add the following to $HOME/.bashrc
|
|
export PATH=$PATH:/usr/local/go/bin
|
|
export PATH=$PATH:$(go env GOPATH)/bin
|
|
```
|
|
|
|
Reload [PATH] by opening the [integrated terminal] and sourcing the updated `.bashrc` file.
|
|
|
|
```bash
|
|
source $HOME/.bashrc
|
|
```
|
|
|
|
Finally, now that we've got Go all we need to go is grab the latest source and build.
|
|
|
|
```bash
|
|
# get the latest source
|
|
git clone https://github.com/pomerium/pomerium.git
|
|
|
|
# build pomerium
|
|
cd pomerium
|
|
make build
|
|
# run pomerium!
|
|
./bin/pomerium --version
|
|
# v0.14.0-28-g38a75913+38a75913
|
|
```
|
|
|
|
Happy remote hacking!!!😁
|
|
|
|
:::tip
|
|
|
|
When the code-server container is rebuilt, any files outside of `/home/coder/project` are reset, removing any dependencies (such as go and make). In a real remote development workflow, you could mount additional volumes, or [use a custom code-server container](https://github.com/cdr/deploy-code-server/tree/main/deploy-container) with these dependencies installed.
|
|
|
|
:::
|
|
|
|
[integrated terminal]: https://code.visualstudio.com/docs/editor/integrated-terminal
|
|
[path]: https://en.wikipedia.org/wiki/PATH_(variable)
|
|
[install]: /docs/install/readme.md
|
|
[synology nas]: /guides/synology.md
|
|
[visual studio code]: https://code.visualstudio.com/
|
|
[code-server]: https://github.com/cdr/code-server
|