Skip to content

Commit 8765b7a

Browse files
oauth2-proxy (#4784)
* 'Add new script' * change cleaning * change cleaning --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]>
1 parent 56e316b commit 8765b7a

File tree

4 files changed

+173
-0
lines changed

4 files changed

+173
-0
lines changed

ct/headers/oauth2-proxy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__ __ ___
2+
____ ____ ___ __/ /_/ /_ |__ \ ____ _________ _ ____ __
3+
/ __ \/ __ `/ / / / __/ __ \__/ /_____/ __ \/ ___/ __ \| |/_/ / / /
4+
/ /_/ / /_/ / /_/ / /_/ / / / __/_____/ /_/ / / / /_/ /> </ /_/ /
5+
\____/\__,_/\__,_/\__/_/ /_/____/ / .___/_/ \____/_/|_|\__, /
6+
/_/ /____/

ct/oauth2-proxy.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/oauth2-proxy/oauth2-proxy/
7+
8+
APP="oauth2-proxy"
9+
var_tags="${var_tags:-os}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-512}"
12+
var_disk="${var_disk:-3}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/oauth2-proxy ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -fsSL https://api.github.com/repos/oauth2-proxy/oauth2-proxy/releases/latest | jq -r .tag_name | sed 's/^v//')
33+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
34+
msg_info "Stopping ${APP} services"
35+
systemctl stop oauth2-proxy
36+
msg_ok "Stopped ${APP}"
37+
38+
msg_info "Updating $APP to ${RELEASE}"
39+
rm -f /opt/oauth2-proxy/oauth2-proxy
40+
curl -fsSL "https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v${RELEASE}/oauth2-proxy-v${RELEASE}.linux-amd64.tar.gz" -o /opt/oauth2-proxy.tar.gz
41+
tar -xzf /opt/oauth2-proxy.tar.gz
42+
mv /opt/oauth2-proxy-v${RELEASE}.linux-amd64/oauth2-proxy /opt/oauth2-proxy
43+
systemctl start oauth2-proxy
44+
echo "${RELEASE}" >/opt/${APP}_version.txt
45+
msg_ok "Updated ${APP} to ${RELEASE}"
46+
47+
msg_info "Cleaning up"
48+
rm -f "/opt/oauth2-proxy.tar.gz"
49+
rm -rf "/opt/oauth2-proxy-v${RELEASE}.linux-amd64"
50+
$STD apt-get -y autoremove
51+
$STD apt-get -y autoclean
52+
msg_ok "Cleaned"
53+
else
54+
msg_ok "${APP} is already up to date (${RELEASE})"
55+
fi
56+
}
57+
58+
start
59+
build_container
60+
description
61+
62+
msg_ok "Completed Successfully!\n"
63+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
64+
echo -e "${INFO}${YW} Now you can modify /opt/oauth2-proxy/config.toml with your needed config.${CL}"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "OAuth2-Proxy",
3+
"slug": "oauth2-proxy",
4+
"categories": [
5+
4,
6+
6
7+
],
8+
"date_created": "2025-05-25",
9+
"type": "ct",
10+
"updateable": true,
11+
"privileged": false,
12+
"interface_port": null,
13+
"documentation": "https://oauth2-proxy.github.io/oauth2-proxy/configuration/overview",
14+
"website": "https://oauth2-proxy.github.io/oauth2-proxy/",
15+
"logo": "https://raw.githubusercontent.com/oauth2-proxy/oauth2-proxy/f82e90426a1881d36bf995f25de9b7b1db4c2564/docs/static/img/logos/OAuth2_Proxy_icon.svg",
16+
"config_path": "/opt/oauth2-proxy/config.toml",
17+
"description": "A reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers.",
18+
"install_methods": [
19+
{
20+
"type": "default",
21+
"script": "ct/oauth2-proxy.sh",
22+
"resources": {
23+
"cpu": 1,
24+
"ram": 512,
25+
"hdd": 3,
26+
"os": "debian",
27+
"version": "12"
28+
}
29+
}
30+
],
31+
"default_credentials": {
32+
"username": null,
33+
"password": null
34+
},
35+
"notes": [
36+
{
37+
"text": "This application includes a blank configuration file by default due to the wide range of available configuration options. We recommend referring to the official documentation for guidance: `https://oauth2-proxy.github.io/oauth2-proxy/configuration/overview`. With this you can make your config.toml file accordingly to your needs.",
38+
"type": "info"
39+
},
40+
{
41+
"text": "After changing the config restart OAuth2-Proxy with: `systemctl restart oauth2-proxy`",
42+
"type": "info"
43+
}
44+
]
45+
}

install/oauth2-proxy-install.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/oauth2-proxy/oauth2-proxy/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
jq
19+
msg_ok "Installed Dependencies"
20+
21+
msg_info "Setup OAuth2-Proxy"
22+
RELEASE=$(curl -fsSL https://api.github.com/repos/oauth2-proxy/oauth2-proxy/releases/latest | jq -r .tag_name | sed 's/^v//')
23+
mkdir -p /opt/oauth2-proxy
24+
curl -fsSL "https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v${RELEASE}/oauth2-proxy-v${RELEASE}.linux-amd64.tar.gz" -o /opt/oauth2-proxy.tar.gz
25+
tar -xzf /opt/oauth2-proxy.tar.gz -C /opt
26+
mv /opt/oauth2-proxy-v${RELEASE}.linux-amd64/oauth2-proxy /opt/oauth2-proxy
27+
touch /opt/oauth2-proxy/config.toml
28+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
29+
msg_ok "Setup OAuth2-Proxy"
30+
31+
msg_info "Creating Service"
32+
cat <<EOF >/etc/systemd/system/oauth2-proxy.service
33+
[Unit]
34+
Description=OAuth2-Proxy Service
35+
After=network.target
36+
37+
[Service]
38+
Type=simple
39+
WorkingDirectory=/opt/oauth2-proxy
40+
ExecStart=/opt/oauth2-proxy/oauth2-proxy --config config.toml
41+
Restart=on-failure
42+
RestartSec=5
43+
44+
[Install]
45+
WantedBy=multi-user.target
46+
EOF
47+
systemctl enable -q --now oauth2-proxy
48+
msg_ok "Created Service"
49+
50+
motd_ssh
51+
customize
52+
53+
msg_info "Cleaning up"
54+
rm -f "/opt/oauth2-proxy.tar.gz"
55+
rm -rf "/opt/oauth2-proxy-v${RELEASE}.linux-amd64"
56+
$STD apt-get -y autoremove
57+
$STD apt-get -y autoclean
58+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)