DISABLE_SSH=true and START_SSH_SERVER=false doesn't work #14409

Closed
opened 2025-11-02 11:12:12 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @tanvp112 on GitHub (Apr 25, 2025).

Description

Hi,

Despite the flag has been set, sshd in the container still start.

docker-compose.yaml:

networks:
  gitea:
    external: false

volumes:
  gitea:
    driver: local

services:
  server:
    image: docker.gitea.com/gitea:1.23.7
    container_name: gitea
    restart: always
    environment:
    - GITEA__server__DISABLE_SSH=true
    - GITEA__server__START_SSH_SERVER=false
    networks:
      - gitea
    volumes:
      - gitea:/data
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"

Docker logs (full details below):

gitea  | Server listening on :: port 22.
gitea  | Server listening on 0.0.0.0 port 22
...

Checked in the container:

2124eb8ac044:/# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:41101 0.0.0.0:* LISTEN
tcp 0 0 :::3000 :::* LISTEN
tcp 0 0 :::ssh :::* LISTEN

app.ini after first time initialized:

APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
RUN_USER = git
WORK_PATH = /data/gitea

[repository]
ROOT = /data/git/repositories

[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
APP_DATA_PATH = /data/gitea
DOMAIN = 192.168.1.253
SSH_DOMAIN = 192.168.1.253
HTTP_PORT = 3000
ROOT_URL = http://192.168.1.253:3000/
DISABLE_SSH = true
SSH_PORT =  22               # <- Notice despite the port number is left empty on the web UI, value still seen here.
SSH_LISTEN_PORT = 22  # <- Notice Despite the port number is left empty on the web UI, value still seen here.
LFS_START_SERVER = true
START_SSH_SERVER = false
LFS_JWT_SECRET = 9eKNTCQ7scgRy6URdzLO9gFafDVQOuObsRO8aXB0DOQ
OFFLINE_MODE = true

[database]
PATH = /data/gitea/gitea.db
DB_TYPE = sqlite3
HOST = localhost:3306
NAME = gitea
USER = root
PASSWD = 
LOG_SQL = false
SCHEMA = 
SSL_MODE = disable

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER = file

[picture]
AVATAR_UPLOAD_PATH = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars

[attachment]
PATH = /data/gitea/attachments

[log]
MODE = console
LEVEL = info
ROOT_PATH = /data/gitea/log

[security]
INSTALL_LOCK = true
SECRET_KEY = 
REVERSE_PROXY_LIMIT = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NDU1NTk2NTl9.pTbWsm3Q_DjJPJ6BCZ5PNmHssp1g97q_OX5l4UIgXK4
PASSWORD_HASH_ALGO = pbkdf2

[service]
DISABLE_REGISTRATION = false
REQUIRE_SIGNIN_VIEW = false
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost

[lfs]
PATH = /data/git/lfs

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[cron.update_checker]
ENABLED = false

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

[oauth2]
JWT_SECRET = iZmq80mn1yWF-EAiNezLVHgYNScPUHq3SIct30fUKpY

Restart the container still the same. How to completely disable SSH for gitea?

Gitea Version

1.23.7

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

First start-up:

gitea  | Generating /data/ssh/ssh_host_ed25519_key...
gitea  | Generating /data/ssh/ssh_host_rsa_key...
gitea  | 2025/04/25 14:04:52 cmd/web.go:253:runWeb() [I] Starting Gitea on PID: 17
gitea  | 2025/04/25 14:04:52 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify
gitea  | 2025/04/25 14:04:52 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod
gitea  | 2025/04/25 14:04:52 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
gitea  | 2025/04/25 14:04:52 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea
gitea  | 2025/04/25 14:04:52 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea
gitea  | 2025/04/25 14:04:52 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini
gitea  | 2025/04/25 14:04:52 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run install page
gitea  | Generating /data/ssh/ssh_host_ecdsa_key...
gitea  | Server listening on :: port 22.
gitea  | Server listening on 0.0.0.0 port 22.
gitea  | 2025/04/25 14:04:52 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000
gitea  | 2025/04/25 14:04:52 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
gitea  | 2025/04/25 14:04:52 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17
gitea  | 2025/04/25 14:06:09 ...s/install/install.go:515:SubmitInstall() [I] Save settings to custom config file /data/gitea/conf/app.ini
gitea  | 2025/04/25 14:06:09 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
gitea  | 2025/04/25 14:06:09 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
gitea  | 2025/04/25 14:06:09 ...s/install/install.go:594:SubmitInstall() [I] First-time run install finished!
gitea  | 2025/04/25 14:06:12 cmd/web.go:366:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
gitea  | 2025/04/25 14:06:12 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify
gitea  | 2025/04/25 14:06:12 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod
gitea  | 2025/04/25 14:06:12 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
gitea  | 2025/04/25 14:06:12 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea
gitea  | 2025/04/25 14:06:12 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea
gitea  | 2025/04/25 14:06:12 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini
gitea  | 2025/04/25 14:06:12 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run web server
gitea  | 2025/04/25 14:06:13 routers/init.go:117:InitWebInstalled() [I] Git version: 2.47.2 (home: /data/gitea/home)
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/packages
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_log
gitea  | 2025/04/25 14:06:13 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
gitea  | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_artifacts
gitea  | 2025/04/25 14:06:13 routers/init.go:139:InitWebInstalled() [I] SQLite3 support is enabled
gitea  | 2025/04/25 14:06:13 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
gitea  | 2025/04/25 14:06:13 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
gitea  | 2025/04/25 14:06:13 cmd/web.go:205:serveInstalled() [I] PING DATABASE sqlite3
gitea  | 2025/04/25 14:06:13 cmd/web.go:205:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
gitea  | 2025/04/25 14:06:13 routers/init.go:145:InitWebInstalled() [I] ORM engine initialization successful!
gitea  | 2025/04/25 14:06:13 ...er/issues/indexer.go:76:func1() [I] PID 17: Initializing Issue Indexer: bleve
gitea  | 2025/04/25 14:06:13 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
gitea  | 2025/04/25 14:06:13 routers/init.go:86:syncAppConfForGit() [I] AppPath changed from '' to '/usr/local/bin/gitea'
gitea  | 2025/04/25 14:06:13 routers/init.go:91:syncAppConfForGit() [I] CustomConf changed from '' to '/data/gitea/conf/app.ini'
gitea  | 2025/04/25 14:06:13 routers/init.go:97:syncAppConfForGit() [I] re-sync repository hooks ...
gitea  | 2025/04/25 14:06:13 routers/init.go:100:syncAppConfForGit() [I] re-write ssh public keys ...
gitea  | 2025/04/25 14:06:13 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 7.372929ms
gitea  | 2025/04/25 14:06:14 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000
gitea  | 2025/04/25 14:06:14 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://192.168.1.253:3000/
gitea  | 2025/04/25 14:06:14 cmd/web.go:322:listen() [I] LFS server enabled
gitea  | 2025/04/25 14:06:14 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17
gitea  | 2025/04/25 14:06:15 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 192.168.1.253:58036, 200 OK in 1.3ms @ auth/auth.go:180(auth.SignIn)
gitea  | 2025/04/25 14:06:15 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 192.168.1.253:58036, 200 OK in 0.9ms @ auth/auth.go:180(auth.SignIn)
gitea  | Received signal 15; terminating.
gitea  | 2025/04/25 14:09:23 ...eful/manager_unix.go:144:handleSignals() [W] PID 17. Received SIGTERM. Shutting down...
gitea  | 2025/04/25 14:09:23 cmd/web.go:366:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
gitea  | 2025/04/25 14:09:23 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
gitea  | 2025/04/25 14:09:23 ...eful/server_hooks.go:46:doShutdown() [I] PID: 17 Listener ([::]:3000) closed.
gitea  | 2025/04/25 14:09:24 .../graceful/manager.go:184:doTerminate() [W] Terminating
gitea  | 2025/04/25 14:09:24 ...er/issues/indexer.go:120:2() [I] PID: 17 Issue Indexer closed
gitea  | 2025/04/25 14:09:24 ...eful/manager_unix.go:154:handleSignals() [W] PID: 17. Background context for manager closed - context canceled - Shutting down...
gitea  | 2025/04/25 14:09:24 cmd/web.go:225:serveInstalled() [I] PID: 17 Gitea Web Finished
gitea exited with code 0

Restart the container after first time initialized:

gitea  | Server listening on :: port 22.
gitea  | Server listening on 0.0.0.0 port 22.
gitea  | 2025/04/25 14:09:24 cmd/web.go:253:runWeb() [I] Starting Gitea on PID: 17
gitea  | 2025/04/25 14:09:24 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify
gitea  | 2025/04/25 14:09:24 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod
gitea  | 2025/04/25 14:09:24 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
gitea  | 2025/04/25 14:09:24 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea
gitea  | 2025/04/25 14:09:24 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea
gitea  | 2025/04/25 14:09:24 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini
gitea  | 2025/04/25 14:09:24 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run web server
gitea  | 2025/04/25 14:09:24 routers/init.go:117:InitWebInstalled() [I] Git version: 2.47.2 (home: /data/gitea/home)
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/packages
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_log
gitea  | 2025/04/25 14:09:24 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
gitea  | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_artifacts
gitea  | 2025/04/25 14:09:24 routers/init.go:139:InitWebInstalled() [I] SQLite3 support is enabled
gitea  | 2025/04/25 14:09:24 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
gitea  | 2025/04/25 14:09:24 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
gitea  | 2025/04/25 14:09:24 cmd/web.go:205:serveInstalled() [I] PING DATABASE sqlite3
gitea  | 2025/04/25 14:09:24 cmd/web.go:205:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
gitea  | 2025/04/25 14:09:24 routers/init.go:145:InitWebInstalled() [I] ORM engine initialization successful!
gitea  | 2025/04/25 14:09:24 ...er/issues/indexer.go:76:func1() [I] PID 17: Initializing Issue Indexer: bleve
gitea  | 2025/04/25 14:09:24 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
gitea  | 2025/04/25 14:09:24 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 477.238µs
gitea  | 2025/04/25 14:09:24 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000
gitea  | 2025/04/25 14:09:24 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://192.168.1.253:3000/
gitea  | 2025/04/25 14:09:24 cmd/web.go:322:listen() [I] LFS server enabled
gitea  | 2025/04/25 14:09:24 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17

Git Version

2.47.2

Operating System

Linux 6.13.12-200

How are you running Gitea?

https://docs.gitea.com/installation/install-with-docker

Database

SQLite

Originally created by @tanvp112 on GitHub (Apr 25, 2025). ### Description Hi, Despite the flag has been set, sshd in the container still start. docker-compose.yaml: ``` networks: gitea: external: false volumes: gitea: driver: local services: server: image: docker.gitea.com/gitea:1.23.7 container_name: gitea restart: always environment: - GITEA__server__DISABLE_SSH=true - GITEA__server__START_SSH_SERVER=false networks: - gitea volumes: - gitea:/data - /etc/localtime:/etc/localtime:ro ports: - "3000:3000" ``` Docker logs (full details below): ``` gitea | Server listening on :: port 22. gitea | Server listening on 0.0.0.0 port 22 ... ``` Checked in the container: >2124eb8ac044:/# netstat -l >Active Internet connections (only servers) >Proto Recv-Q Send-Q Local Address Foreign Address State >tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN >tcp 0 0 localhost:41101 0.0.0.0:* LISTEN >tcp 0 0 :::3000 :::* LISTEN >tcp 0 0 :::ssh :::* LISTEN app.ini _after_ first time initialized: ``` APP_NAME = Gitea: Git with a cup of tea RUN_MODE = prod RUN_USER = git WORK_PATH = /data/gitea [repository] ROOT = /data/git/repositories [repository.local] LOCAL_COPY_PATH = /data/gitea/tmp/local-repo [repository.upload] TEMP_PATH = /data/gitea/uploads [server] APP_DATA_PATH = /data/gitea DOMAIN = 192.168.1.253 SSH_DOMAIN = 192.168.1.253 HTTP_PORT = 3000 ROOT_URL = http://192.168.1.253:3000/ DISABLE_SSH = true SSH_PORT = 22 # <- Notice despite the port number is left empty on the web UI, value still seen here. SSH_LISTEN_PORT = 22 # <- Notice Despite the port number is left empty on the web UI, value still seen here. LFS_START_SERVER = true START_SSH_SERVER = false LFS_JWT_SECRET = 9eKNTCQ7scgRy6URdzLO9gFafDVQOuObsRO8aXB0DOQ OFFLINE_MODE = true [database] PATH = /data/gitea/gitea.db DB_TYPE = sqlite3 HOST = localhost:3306 NAME = gitea USER = root PASSWD = LOG_SQL = false SCHEMA = SSL_MODE = disable [indexer] ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve [session] PROVIDER_CONFIG = /data/gitea/sessions PROVIDER = file [picture] AVATAR_UPLOAD_PATH = /data/gitea/avatars REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars [attachment] PATH = /data/gitea/attachments [log] MODE = console LEVEL = info ROOT_PATH = /data/gitea/log [security] INSTALL_LOCK = true SECRET_KEY = REVERSE_PROXY_LIMIT = 1 REVERSE_PROXY_TRUSTED_PROXIES = * INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NDU1NTk2NTl9.pTbWsm3Q_DjJPJ6BCZ5PNmHssp1g97q_OX5l4UIgXK4 PASSWORD_HASH_ALGO = pbkdf2 [service] DISABLE_REGISTRATION = false REQUIRE_SIGNIN_VIEW = false REGISTER_EMAIL_CONFIRM = false ENABLE_NOTIFY_MAIL = false ALLOW_ONLY_EXTERNAL_REGISTRATION = false ENABLE_CAPTCHA = false DEFAULT_KEEP_EMAIL_PRIVATE = false DEFAULT_ALLOW_CREATE_ORGANIZATION = true DEFAULT_ENABLE_TIMETRACKING = true NO_REPLY_ADDRESS = noreply.localhost [lfs] PATH = /data/git/lfs [mailer] ENABLED = false [openid] ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNUP = true [cron.update_checker] ENABLED = false [repository.pull-request] DEFAULT_MERGE_STYLE = merge [repository.signing] DEFAULT_TRUST_MODEL = committer [oauth2] JWT_SECRET = iZmq80mn1yWF-EAiNezLVHgYNScPUHq3SIct30fUKpY ``` Restart the container still the same. How to _completely_ disable SSH for gitea? ### Gitea Version 1.23.7 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots First start-up: ``` gitea | Generating /data/ssh/ssh_host_ed25519_key... gitea | Generating /data/ssh/ssh_host_rsa_key... gitea | 2025/04/25 14:04:52 cmd/web.go:253:runWeb() [I] Starting Gitea on PID: 17 gitea | 2025/04/25 14:04:52 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify gitea | 2025/04/25 14:04:52 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod gitea | 2025/04/25 14:04:52 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea gitea | 2025/04/25 14:04:52 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea gitea | 2025/04/25 14:04:52 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea gitea | 2025/04/25 14:04:52 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini gitea | 2025/04/25 14:04:52 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run install page gitea | Generating /data/ssh/ssh_host_ecdsa_key... gitea | Server listening on :: port 22. gitea | Server listening on 0.0.0.0 port 22. gitea | 2025/04/25 14:04:52 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000 gitea | 2025/04/25 14:04:52 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://localhost:3000/ gitea | 2025/04/25 14:04:52 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17 gitea | 2025/04/25 14:06:09 ...s/install/install.go:515:SubmitInstall() [I] Save settings to custom config file /data/gitea/conf/app.ini gitea | 2025/04/25 14:06:09 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. gitea | 2025/04/25 14:06:09 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... gitea | 2025/04/25 14:06:09 ...s/install/install.go:594:SubmitInstall() [I] First-time run install finished! gitea | 2025/04/25 14:06:12 cmd/web.go:366:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed gitea | 2025/04/25 14:06:12 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify gitea | 2025/04/25 14:06:12 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod gitea | 2025/04/25 14:06:12 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea gitea | 2025/04/25 14:06:12 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea gitea | 2025/04/25 14:06:12 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea gitea | 2025/04/25 14:06:12 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini gitea | 2025/04/25 14:06:12 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run web server gitea | 2025/04/25 14:06:13 routers/init.go:117:InitWebInstalled() [I] Git version: 2.47.2 (home: /data/gitea/home) gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/packages gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_log gitea | 2025/04/25 14:06:13 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local gitea | 2025/04/25 14:06:13 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_artifacts gitea | 2025/04/25 14:06:13 routers/init.go:139:InitWebInstalled() [I] SQLite3 support is enabled gitea | 2025/04/25 14:06:13 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. gitea | 2025/04/25 14:06:13 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... gitea | 2025/04/25 14:06:13 cmd/web.go:205:serveInstalled() [I] PING DATABASE sqlite3 gitea | 2025/04/25 14:06:13 cmd/web.go:205:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1 gitea | 2025/04/25 14:06:13 routers/init.go:145:InitWebInstalled() [I] ORM engine initialization successful! gitea | 2025/04/25 14:06:13 ...er/issues/indexer.go:76:func1() [I] PID 17: Initializing Issue Indexer: bleve gitea | 2025/04/25 14:06:13 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories gitea | 2025/04/25 14:06:13 routers/init.go:86:syncAppConfForGit() [I] AppPath changed from '' to '/usr/local/bin/gitea' gitea | 2025/04/25 14:06:13 routers/init.go:91:syncAppConfForGit() [I] CustomConf changed from '' to '/data/gitea/conf/app.ini' gitea | 2025/04/25 14:06:13 routers/init.go:97:syncAppConfForGit() [I] re-sync repository hooks ... gitea | 2025/04/25 14:06:13 routers/init.go:100:syncAppConfForGit() [I] re-write ssh public keys ... gitea | 2025/04/25 14:06:13 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 7.372929ms gitea | 2025/04/25 14:06:14 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000 gitea | 2025/04/25 14:06:14 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://192.168.1.253:3000/ gitea | 2025/04/25 14:06:14 cmd/web.go:322:listen() [I] LFS server enabled gitea | 2025/04/25 14:06:14 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17 gitea | 2025/04/25 14:06:15 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 192.168.1.253:58036, 200 OK in 1.3ms @ auth/auth.go:180(auth.SignIn) gitea | 2025/04/25 14:06:15 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 192.168.1.253:58036, 200 OK in 0.9ms @ auth/auth.go:180(auth.SignIn) gitea | Received signal 15; terminating. gitea | 2025/04/25 14:09:23 ...eful/manager_unix.go:144:handleSignals() [W] PID 17. Received SIGTERM. Shutting down... gitea | 2025/04/25 14:09:23 cmd/web.go:366:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed gitea | 2025/04/25 14:09:23 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition gitea | 2025/04/25 14:09:23 ...eful/server_hooks.go:46:doShutdown() [I] PID: 17 Listener ([::]:3000) closed. gitea | 2025/04/25 14:09:24 .../graceful/manager.go:184:doTerminate() [W] Terminating gitea | 2025/04/25 14:09:24 ...er/issues/indexer.go:120:2() [I] PID: 17 Issue Indexer closed gitea | 2025/04/25 14:09:24 ...eful/manager_unix.go:154:handleSignals() [W] PID: 17. Background context for manager closed - context canceled - Shutting down... gitea | 2025/04/25 14:09:24 cmd/web.go:225:serveInstalled() [I] PID: 17 Gitea Web Finished gitea exited with code 0 ``` Restart the container _after_ first time initialized: ``` gitea | Server listening on :: port 22. gitea | Server listening on 0.0.0.0 port 22. gitea | 2025/04/25 14:09:24 cmd/web.go:253:runWeb() [I] Starting Gitea on PID: 17 gitea | 2025/04/25 14:09:24 cmd/web.go:112:showWebStartupMessage() [I] Gitea version: 1.23.7 built with GNU Make 4.4.1, go1.23.8 : bindata, timetzdata, sqlite, sqlite_unlock_notify gitea | 2025/04/25 14:09:24 cmd/web.go:113:showWebStartupMessage() [I] * RunMode: prod gitea | 2025/04/25 14:09:24 cmd/web.go:114:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea gitea | 2025/04/25 14:09:24 cmd/web.go:115:showWebStartupMessage() [I] * WorkPath: /data/gitea gitea | 2025/04/25 14:09:24 cmd/web.go:116:showWebStartupMessage() [I] * CustomPath: /data/gitea gitea | 2025/04/25 14:09:24 cmd/web.go:117:showWebStartupMessage() [I] * ConfigFile: /data/gitea/conf/app.ini gitea | 2025/04/25 14:09:24 cmd/web.go:118:showWebStartupMessage() [I] Prepare to run web server gitea | 2025/04/25 14:09:24 routers/init.go:117:InitWebInstalled() [I] Git version: 2.47.2 (home: /data/gitea/home) gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/attachments gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/avatars gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-avatars gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/git/lfs gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/repo-archive gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/packages gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_log gitea | 2025/04/25 14:09:24 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local gitea | 2025/04/25 14:09:24 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /data/gitea/actions_artifacts gitea | 2025/04/25 14:09:24 routers/init.go:139:InitWebInstalled() [I] SQLite3 support is enabled gitea | 2025/04/25 14:09:24 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. gitea | 2025/04/25 14:09:24 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... gitea | 2025/04/25 14:09:24 cmd/web.go:205:serveInstalled() [I] PING DATABASE sqlite3 gitea | 2025/04/25 14:09:24 cmd/web.go:205:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1 gitea | 2025/04/25 14:09:24 routers/init.go:145:InitWebInstalled() [I] ORM engine initialization successful! gitea | 2025/04/25 14:09:24 ...er/issues/indexer.go:76:func1() [I] PID 17: Initializing Issue Indexer: bleve gitea | 2025/04/25 14:09:24 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories gitea | 2025/04/25 14:09:24 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 477.238µs gitea | 2025/04/25 14:09:24 cmd/web.go:315:listen() [I] Listen: http://0.0.0.0:3000 gitea | 2025/04/25 14:09:24 cmd/web.go:319:listen() [I] AppURL(ROOT_URL): http://192.168.1.253:3000/ gitea | 2025/04/25 14:09:24 cmd/web.go:322:listen() [I] LFS server enabled gitea | 2025/04/25 14:09:24 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 17 ``` ### Git Version 2.47.2 ### Operating System Linux 6.13.12-200 ### How are you running Gitea? https://docs.gitea.com/installation/install-with-docker ### Database SQLite
GiteaMirror added the issue/needs-feedback label 2025-11-02 11:12:12 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Apr 25, 2025):

You need to use the "rootless" version

@wxiaoguang commented on GitHub (Apr 25, 2025): You need to use the "rootless" version
Author
Owner

@tanvp112 commented on GitHub (Apr 25, 2025):

What does it has to do with "rootless"? Note the objective is to completely disable SSH. Setting DISABLE_SSH=true and START_SSH_SERVER=false according to the document doesn't work at all.

Can go thru the logs first and elaborate further? The issue can be easily reproduce with the docker-compose.yaml included in the issue, let me know what else feedback you need to confirm the bug?

@tanvp112 commented on GitHub (Apr 25, 2025): What does it has to do with "rootless"? Note the objective is to _completely_ disable SSH. Setting DISABLE_SSH=true and START_SSH_SERVER=false according to the document doesn't work at all. Can go thru the logs first and elaborate further? The issue can be easily reproduce with the docker-compose.yaml included in the issue, let me know what else feedback you need to confirm the bug?
Author
Owner

@wxiaoguang commented on GitHub (Apr 25, 2025):

The default "rootful" version uses external OpenSSH server, it can't be controlled by the config options.

The "rootless" version uses builtin SSH server, it is controlled by these config options.

@wxiaoguang commented on GitHub (Apr 25, 2025): * https://hub.docker.com/r/gitea/gitea/tags?name=rootless * https://docs.gitea.com/installation/install-with-docker-rootless The default "rootful" version uses external OpenSSH server, it can't be controlled by the config options. The "rootless" version uses builtin SSH server, it is controlled by these config options.
Author
Owner

@wxiaoguang commented on GitHub (Apr 25, 2025):

One more thing, if you are using docker, actually you do not need to disable the SSH server, you could just not map the SSH port, then no one could access.

@wxiaoguang commented on GitHub (Apr 25, 2025): One more thing, if you are using docker, actually you do not need to disable the SSH server, you could just not map the SSH port, then no one could access.
Author
Owner

@tanvp112 commented on GitHub (Apr 25, 2025):

One more thing, if you are using docker, actually you do not need to disable the SSH server, you could just not map the SSH port, then no one could acces.

Technically you are right, but the security team thinks otherwise... Let me test the rootless image as you said.

@tanvp112 commented on GitHub (Apr 25, 2025): > One more thing, if you are using docker, actually you do not need to disable the SSH server, you could just not map the SSH port, then no one could acces. Technically you are right, but the security team thinks otherwise... Let me test the rootless image as you said.
Author
Owner

@tanvp112 commented on GitHub (Apr 25, 2025):

Ok, the rootless image works as expected. Just one quick follow-up question:

REDIRECT_OTHER_PORT = true
PORT_TO_REDIRECT = 3000

I can now browse to https://[host]>:3000 and create user etc... no issue. But if I browse to http://[host]:3000 I am not redirect to https://:3000, is the setting above not enough?

@tanvp112 commented on GitHub (Apr 25, 2025): Ok, the rootless image works as expected. Just one quick follow-up question: REDIRECT_OTHER_PORT = true PORT_TO_REDIRECT = 3000 I can now browse to **https**://[host]>:3000 and create user etc... no issue. But if I browse to http://[host]:3000 I am not redirect to **https**://<host>:3000, is the setting above not enough?
Author
Owner

@TheFox0x7 commented on GitHub (Apr 25, 2025):

You can't have both http and https on the same port. It's a different protocol.

@TheFox0x7 commented on GitHub (Apr 25, 2025): You can't have both http and https on the same port. It's a different protocol.
Author
Owner

@tanvp112 commented on GitHub (Apr 25, 2025):

@wxiaoguang and @f0x52 , works & many thanks for the quick response!

@tanvp112 commented on GitHub (Apr 25, 2025): @wxiaoguang and @f0x52 , works & many thanks for the quick response!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14409