Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve chroot configuration in config.php. #45827

Closed
kamalmjt opened this issue Jun 12, 2024 · 1 comment
Closed

preserve chroot configuration in config.php. #45827

kamalmjt opened this issue Jun 12, 2024 · 1 comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement

Comments

@kamalmjt
Copy link

kamalmjt commented Jun 12, 2024

Hello, I am using Nextcloud on a PHP-FPM with chroot, and I am having trouble maintaining the directory configuration of Nextcloud. That is, with each update, the parameters in the config.php file get messed up.

` 'tempdirectory' => ((php_sapi_name() != 'cli') ? getcwd() . '/../../../tmp/' : '/home/nextcloud.website.com/tmp/'),
'datadirectory' => ((php_sapi_name() != 'cli') ? getcwd() . '/../../../nextclouddata/' : '/home/nextcloud.website.com/nextclouddata/'),
'logfile' => ((php_sapi_name() != 'cli') ? getcwd() . '/../../../nextclouddata/nextcloud.log' : '/home/nextcloud.website.com/nextclouddata/nextcloud.log'),

`

That is, with each update, these parameters are overwritten by the values ​​returned by the function.

My chroot environment looks like this:

`Full directory tree out of chroot: (chroot = /home/nextcloud.website.com)
/home/
├── nextcloud.website.com
│ ├── dev
│ │ ├── null
│ │ ├── random
│ │ ├── urandom
│ │ └── zero
│ ├── etc
│ │ ├── hosts
│ │ ├── resolv.conf
│ │ └── ssl
│ ├── lib
│ │ └── x86_64-linux-gnu
│ ├── nextclouddata (Nexcloud User data)
│ │ ├── appdata_oc1ip557q2ir
│ │ ├── audit.log
│ │ ├── audit.log.1
│ │ ├── User0
│ │ ├── User6
│ │ ├── files_external
│ │ ├── flow.log
│ │ ├── flow.log.1
│ │ ├── User4
│ │ ├── User1
│ │ ├── index.html
│ │ ├── User2
│ │ ├── nextcloud.log
│ │ ├── nextcloud.log.1
│ │ ├── tmp
│ │ ├── updater.log
│ │ ├── updater-oc1ip557q2ir
│ │ └── User3
│ ├── tmp
│ ├── update
│ │ ├── actualizar.sh
│ │ ├── latest.zip
│ │ ├── nextcloud -> ../../nextcloud.website.com/www/nextcloud
│ │ ├── nextcloud-28.0.6.zip.1
│ │ └── old
│ ├── usr
│ │ ├── bin
│ │ ├── lib
│ │ └── share
│ └── www
│ └── nextcloud (web root)

Full directory tree inside chroot:
/
├── dev
│ ├── null
│ ├── random
│ ├── urandom
│ └── zero
├── etc
│ ├── hosts
│ ├── resolv.conf
│ └── ssl
├── lib
│ └── x86_64-linux-gnu
├── nextclouddata (Nexcloud User data)
│ ├── appdata_oc1ip557q2ir
│ ├── audit.log
│ ├── audit.log.1
│ ├── User0
│ ├── User6
│ ├── files_external
│ ├── flow.log
│ ├── flow.log.1
│ ├── User4
│ ├── User1
│ ├── index.html
│ ├── User2
│ ├── nextcloud.log
│ ├── nextcloud.log.1
│ ├── tmp
│ ├── updater.log
│ ├── updater-oc1ip557q2ir
│ └── User3
├── tmp
├── update
│ ├── actualizar.sh
│ ├── latest.zip
│ ├── nextcloud -> ../../nextcloud.website.com/www/nextcloud
│ ├── nextcloud-28.0.6.zip.1
│ └── old
├── usr
│ ├── bin
│ ├── lib
│ └── share
└── www
└── nextcloud (web root)
`

PHP-FPM pool config:
[nextcloud.website.com]
;Privilges config
user = nextcloud.website.com
group = www-data
listen = /run/php/php-nextcloud.website.com.sock
listen.owner = nextcloud.website.com
listen.group = nextcloud.website.com
listen.mode = 0660
listen.acl_users = www-data,nextcloud.website.com
listen.acl_groups = nextcloud.website.com,www-data

;rendimiento
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 0

;Chroot config
chdir = /
chroot = /home/nextcloud.website.com
php_admin_value[doc_root] = /www

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
; env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
clear_env = no

;hardened PHP settings
php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php8.1-nextcloud.website.com.log
php_admin_flag[log_errors] = on
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@nextcloud.website.com
php_admin_value[memory_limit] = 1G
php_admin_value[disable_functions] = "passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_nice, proc_terminate, proc_get_status, proc_close, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, escapeshellcmd, exec"
php_admin_value[open_basedir] = "/home/nextcloud.website.com/www:/home/nextcloud.website.com/tmp:/usr/share/php:/tmp:/dev/random:/dev/urandom:/www:/nextclouddata:/tmp"
php_admin_value[expose_php] = Off
php_admin_value[sys_temp_dir] = /tmp/
php_admin_value[upload_tmp_dir] = /tmp/

@kamalmjt kamalmjt added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement labels Jun 12, 2024
@kesselb
Copy link
Contributor

kesselb commented Jun 12, 2024

See #10904 (comment)

For your next report, please use the right template and/or visit https://help.nextcloud.com/ first.

@kesselb kesselb closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement
Projects
None yet
Development

No branches or pull requests

2 participants