mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-29 21:58:36 +02:00
updating squid config
This commit is contained in:
parent
bfe498bb09
commit
27083fb562
1 changed files with 67 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
|||
(define-module (glicid services networking)
|
||||
#:use-module (gnu packages bash)
|
||||
#:use-module (gnu packages networking)
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services shepherd)
|
||||
|
@ -22,6 +23,9 @@
|
|||
(port squid-configuration-port
|
||||
(default 3128)
|
||||
)
|
||||
(loglevel squid-configuration-loglevel
|
||||
(default 1)
|
||||
)
|
||||
(pid-file squid-configuration-pid-file
|
||||
(default "/var/run/squid/squid.pid")
|
||||
)
|
||||
|
@ -45,25 +49,25 @@
|
|||
(start #~(make-forkexec-constructor
|
||||
(list
|
||||
#$(file-append squid "/sbin/squid")
|
||||
"-d 1"
|
||||
"--foreground"
|
||||
"-d" #$loglevel
|
||||
"-N"
|
||||
"-f" #$config-file
|
||||
)
|
||||
#:pid-file #$pid-file
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "nobody"))
|
||||
#:user (passwd:uid (getpwnam "squid"))
|
||||
))
|
||||
(stop #~(exec-command
|
||||
(list
|
||||
#$(file-append squid "/sbin/squid")
|
||||
"-d 1"
|
||||
"--foreground"
|
||||
"-d" #$loglevel
|
||||
"-N"
|
||||
"-k" "shutdown"
|
||||
"-f" #$config-file
|
||||
)
|
||||
#:pid-file #$pid-file
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "nobody"))
|
||||
#:user (passwd:uid (getpwnam "squid"))
|
||||
))
|
||||
(actions (list
|
||||
(shepherd-action
|
||||
|
@ -72,14 +76,46 @@
|
|||
(procedure #~(exec-command
|
||||
(list
|
||||
#$(file-append squid "/sbin/squid")
|
||||
"-d 1"
|
||||
"--foreground"
|
||||
"-d" #$loglevel
|
||||
"-N"
|
||||
"-k" "reconfigure"
|
||||
"-f" #$config-file
|
||||
)
|
||||
#:pid-file #$pid-file
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "nobody"))
|
||||
#:user (passwd:uid (getpwnam "squid"))
|
||||
))
|
||||
)
|
||||
(shepherd-action
|
||||
(name 'check-config)
|
||||
(documentation "Check the settings file from disk.")
|
||||
(procedure #~(exec-command
|
||||
(list
|
||||
#$(file-append squid "/sbin/squid")
|
||||
"-d" #$loglevel
|
||||
"-N"
|
||||
"-k" "parse"
|
||||
"-f" #$config-file
|
||||
)
|
||||
#:pid-file #$pid-file
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "squid"))
|
||||
))
|
||||
)
|
||||
(shepherd-action
|
||||
(name 'kill)
|
||||
(documentation "Ultimatly kill the squid process.")
|
||||
(procedure #~(exec-command
|
||||
(list
|
||||
#$(file-append squid "/sbin/squid")
|
||||
"-d" #$loglevel
|
||||
"-N"
|
||||
"-k" "kill"
|
||||
"-f" #$config-file
|
||||
)
|
||||
#:pid-file #$pid-file
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "squid"))
|
||||
))
|
||||
)
|
||||
))
|
||||
|
@ -104,24 +140,39 @@
|
|||
(touch "/var/log/squid/squid_access.log")
|
||||
(touch "/var/log/squid/squid_cache.log")
|
||||
(touch "/var/log/squid/squid_cache_store.log")
|
||||
(chown "/var/run/squid" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/log/squid" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/cache/squid" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/spool/squid" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/log/squid/squid_access.log" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/log/squid/squid_cache.log" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/log/squid/squid_cache_store.log" (passwd:uid (getpwnam "nobody")))
|
||||
(chown "/var/run/squid" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/log/squid" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/cache/squid" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/spool/squid" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/log/squid/squid_access.log" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/log/squid/squid_cache.log" (passwd:uid (getpwnam "squid")))
|
||||
(chown "/var/log/squid/squid_cache_store.log" (passwd:uid (getpwnam "squid")))
|
||||
#t
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define %squid-accounts
|
||||
(list
|
||||
(user-group (name "squid") (system? #t))
|
||||
(user-account
|
||||
(name "squid")
|
||||
(group "squid")
|
||||
(system? #t)
|
||||
(comment "Squid server user")
|
||||
(home-directory "/var/spool/squid")
|
||||
(shell (file-append bash "/bin/bash"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define squid-service-type
|
||||
(service-type (name 'squid)
|
||||
(extensions
|
||||
(list
|
||||
(service-extension shepherd-root-service-type squid-shepherd-service)
|
||||
(service-extension activation-service-type (const %squid-activation))
|
||||
(service-extension account-service-type (const %squid-accounts))
|
||||
)
|
||||
)
|
||||
(description "Run @uref{http://www.squid-cache.org/, squid} community developped Squid software.")
|
||||
|
|
Loading…
Add table
Reference in a new issue